Subscribe to UDT Parameters property for value changed?

ignition80
#1

@mgross, @PGriffith
I try to subscribe to UDT Parameters property value changed with:

public abstract java.util.concurrent.CompletableFuture<Void> subscribeAsync(java.util.List<com.inductiveautomation.ignition.common.tags.model.TagPath> list,
                                                                           java.util.List<com.inductiveautomation.ignition.common.tags.model.event.TagChangeListener> list1)

It seem I receive the initial notification, but when the value change and dont’ receive any change notification.

is subscribeAsync the right function to use for UDT Parameters property ???

0 Likes

#2

I was able to get my subscription listener to fire multiple times, but I was using nightly code as of 9/25. Here is what I did:

TagPath paramPath = TagPathParser.parse("[default]Basic UDT instances/BasicUDT_Instance0/Parameters.MyParam");
SubscriptionListener listener = new SubscriptionListener(paramPath);

tagManager.subscribeAsync(paramPath, listener).get(TIMEOUT, TimeUnit.SECONDS);

QualifiedValue qv = new BasicQualifiedValue("new value");
List<QualityCode> qc = defaultProvider.writeAsync(
            Arrays.asList(paramPath), Arrays.asList(qv), SecurityContext.emptyContext())
            .get(TIMEOUT, TimeUnit.SECONDS);
0 Likes

#3

Thanks, I use a TagChangeListener instead of SubscriptionListener with a build before 9/25.
I’ll try to test again with the last nightly.

0 Likes

#4

Oh sorry, I was using my own implementation of TagChangeListener that I called SubscriptionListener.

0 Likes

#5

I have not implemented getTagProperty in the TagChangeListener.
By default, Value is used for the subscribed tags or subscribed udt instance parameters ?

or I need to add something like:

    public TagProp getTagProperty(){
        return TagProp.Value;
    }
0 Likes

#6

I think you are using the wrong TagChangeListener class. You want to be using this one:

com.inductiveautomation.ignition.common.tags.model.event.TagChangeListener

The tagChanged() method passes a TagChangeEvent, where you can get the changed value using getValue().

0 Likes

#7

@mgross, I have to do more test, but I subscribe with:
[default]Basic UDT instances/BasicUDT_Instance0/Parameters/MyParam
instead of:
[default]Basic UDT instances/BasicUDT_Instance0/Parameters.MyParam

read operation is possible with Parameters/MyParam but perhaps subscribe is not possible ?

0 Likes

#8

@mgross,

It’s OK for subscription with:

[default]Basic UDT instances/BasicUDT_Instance0/Parameters.MyParam

instead of:

[default]Basic UDT instances/BasicUDT_Instance0/Parameters/MyParam
0 Likes