Hello, I am attempting to create a new OPC UA Driver extending ManagedDevice. I have a working implementation using predefined nodes for all data being accessed. Now, I am trying to make it more dynamic and since there may be a rather large amount of possible nodes, I would rather be able to access them in a method similar to the Modbus Driver with the “ns=1;s=[device]HRF1234” methodology.
I am able to perform direct OPC reads via the Script console at this point but I cannot figure out the subscription bit for usage with tags. The tags are giving an “Error_Configuration” message, though they work with my old driver. I am addressing the various attributes using values I found by logging a predefined diagnostic node. Here is what I am trying for a node that is not in the NodeManager:
String nodeName = getNodeName(id.getNodeId());
DataValue value = httpJsonHandler.getValue(nodeName);
AttributeId attributeId = AttributeId.from(id.getAttributeId()).get();
Object v;
switch (attributeId)
{
case AccessLevel:
v = AccessLevel.READ_ONLY;
break;
case UserAccessLevel:
v = AccessLevel.READ_ONLY;
break;
case EventNotifier:
v = null;
break;
case MinimumSamplingInterval:
v = -1.0;
break;
case DataType:
v = BuiltinDataType.Float.getNodeId();
break;
default:
v = null;
break;
}
if (attributeId == AttributeId.Value)
results.add(value);
else
results.add(new DataValue(new Variant(v)));
I tried logging the onDataItemsCreated and only the predefined node appeared. I couldn’t find any docs on the ManagedDevice but I have been basing everything so far on Milo’s ManagedAddressSpaceServices. Any help you can offer would be appreciated.
Thank you,
Noah