Kevin, thanks for the help!
What is it you’re trying to accomplish here? Do you really want to be creating a Property and PropertyNode?
I'm creating UaFolderNode
or UaVariableNode
nodes to represent folders and tags from my device. Each folder and tag on my device has an address that uniquely identifies it. The address is made up of two arbitrary strings. I wanted to store each string in a property of its corresponding folder or variable node. That way, when I get a request to read a node's value, I could retrieve the node's two address properties and use them to access the corresponding tag on the device.
I could do the same thing by keeping a Map
of node IDs to device addresses. However, since OPC UA already has a facility for keeping track of arbitrary meta-information that is related to a node (a property), I thought I could leverage that and keep the data together.
However, I don't seem to be able to read any properties that I create. As in the code above, even using the same QualifiedProperty
to set and get a property doesn't work -- the "set" seems to work, but the "get" comes back empty. In general, if a value can be set via object.set(key, value)
I would expect object.get(key)
to retrieve the value, but there must be something different going on here.
Is using properties in this way a bad idea? Would you recommend using my own Map
instead as mentioned above, or is there some better way this usually is done?
Using [$deviceName]
prepended is a convention used by Ignition’s device API and the helper function is just there to make it easier to create correct NodeIds for your Device instance.
This makes sense in hindsight, just was unexpected that the node ID I specified would be changed. I guess this is one of the "unwritten rules" of writing a device driver for Ignition. Looks like this happens when creating a NodeId
via DeviceContext.nodeId()
. Would be good to have basic JavaDoc on DeviceContext
and what its purpose is, when to use it, how it modifies node IDs, etc. However, the com.inductiveautomation.ignition.gateway.opcua.server.api
package is missing from the JavaDoc, so the only thing to go on is the method signatures and class names from the bytecode in the opc-ua-gateway-api
JAR.
Perhaps there is other documentation on using the classes in that API package, but I haven't found it.
If it existed, I would assume it would be in the Ignition SDK Programmer's Guide. However, the section on writing an OPC UA driver still references the old 7.x Driver
API. The missing documentation the for the new 8.x API leads to a difficult first-time experience, especially combined with having to learn OPC UA to make use of it.
So, there probably are some misunderstandings I'm having that seem quite basic to you, but for someone having to learn all of this via method signatures and OPC UA spec documents, it's quite difficult to know what path to follow in the sea of options. I appreciate all of the guidance you've been able to provide so far.