in the project I'm working on there is an internal requirement that specifies that the Server object of the UA NodeSet2 in namespace 0, with nodeId=2253 and browseName="Server", SHALL have its displayName set to: "<comp><prod><deviceid>" instead of the default "Server" display name.
I therefore tried to set it on the serverObject instance:
Code: Select all
auto newDisplayName = createDisplayname();
UaObjectserver* serverObject = getServerManager()->getNodeManagerRoot()->pServerObject();
serverObject->setDisplayName(newDisplayname);
Question 1: why does the UaObjectServer (or its base class UaObjectBase) not have a setDisplayName-method?
Ok, but what if I just get a reference to the UaNode of the Server object and update its DisplayName attribute? Like this:
Code: Select all
UaNode* node = getServerManager()->getNodeManagerRoot()->getNode(OpcUaId_Server);
if (node)
{
UaDataValue dv(varDisplayName, OpcUa_Good, currentTime, currentTime);
node->setAttributeValue(this, OpcUa_Attributes_DisplayName, dv, NULL, OpcUa_False);
node->releaseReference();
}
Question 2: why is this UaNode::setAttribute method a no-op!? What are the reasons one cannot or maybe even must not update the attributes of UaNode?
Question 3: Since my two attempts above failed to update the displayName of the Server object, I wonder if there is a third way that actually works! If not, I'd be very interested to hear the reason why.
Thanks in advance! :-)
/Tommy