I use :
subscribeAsync(TagPath tagPath, TagChangeListener listener)
But when i test to use
subscribeAsync(getTagPaths(), getListeners())
I have this error : Cannot resolve method 'subscribeAsync(List, List)'
getTagPaths() return List and getListeners() return List
TagChangeSDK implements TagChangeListener
Seems pretty obvious. You will have to loop over the getTagPath()
result and call subscribe for each one.
yes, that's what I do now, but I would like to use getTagPath() as it is a List, without going through a loop if it's possible
If the interface doesn't have a method that takes a list, then no, you cannot avoid the loop.
No but the interface have a method that take a list :
Hmm. Point. Not sure what's going on.
Are you sure you're compiling against the right version of the SDK?
I corrected this but currently I'm trying to pass the context for another class in order to launch other processes and read "readAsync" tags but I can't Is there a specific class for that or a link with RPC that I didn't really understand ?
Processes outside of Ignition have no access to any of this. Or did you mean threads?
If you need to offer external access, you have two options:
-
Implement a servlet that will integrate with the gateway's jetty instance, or
-
Create a listening socket that will accept connections and spawn threads for them and use any protocol you wish to implement.
No it's inside ignitin ,I have another class that will be in the ignition module that I call with tagchange listener, and I want to read some tags
If you just want to read some tags, why do you need a listener?
Please share more of the architecture you are trying to achieve.
I supervise a single tag, and when the latter changes to a specific value I launch a specific calculation and the latter needs to read specific tag values for its calculation.
For that I need to launch the calculation in this class with a reading of the tags and I need the context ?
Ok. Include the context in the listener's constructor, then. Or perhaps just hand off the TagManager. The listener can do the calculations if they aren't too long. (Few milliseconds.)
I guess I'm just not seeing enough. You have a null pointer exception on your listener's line 31. Follow that clue.