Reading Ignition Tag Values

Hi,

I am trying to add functionality to a module that will allow data written to a value in ignition to be passed to the module and back to a device.

For reading values from the ignition database would this be the correct call to make?

provider.getTag(p).getValue()

We also need indication of when the value was changed by ignition so that we don’t have to track the last read value in the module. Ideally we would like to register a callback or have an event fired off when a value is changed in ignition.

com.inductiveautomation.ignition.common.expressions.TagListener looks like it implements some of that functionality, is there a better class or function to use?

Tom K

Are you trying to do this in Ignition 7.9 or 8.0? The concepts are similar but the APIs are different.

We are targeting both 7.9 and 8.0.

Ok, you’re gonna need 2 separate modules.

In both 7.9 and 8.0 though the TagManager you get from the GatewayContext has methods to subscribe to a given TagPath and receives a listener that will get callback when tags change, so start there.

Thanks Kevin. Is there any mechanism that indicates the source of the tag change? (Tagvalue changed via ignition or from the module)

No, no information like that. You might be able to figure out if your module was the source of the change some other way but there’s no info about the source available in the TagChangeEvent you get.