How can I handle already existing nodes from the server side?

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
gsoutono
Jr. Member
Jr. Member
Posts: 1
Joined: 16 Jun 2022, 15:47

How can I handle already existing nodes from the server side?

Post by gsoutono »

Hello,

I want to be able to set values to a node from the server side, as is being done for the pVariable in L2TutorialServerHelloWorld.html#L3TutorialServerHelloWorld_6

In this example, the Node is previously created in the server's address space using pNodeConfig->addNodeAndReference, and pVariable is used to set values into the Node. In my case, I don't have a pVariable like as I'm not creating the nodes, I'm loading them into the server's address space using a xml file with:
UaNodeSetXmlParserUaNode *pXmlParser = new UaNodeSetXmlParserUaNode(sNodesetFile, pNodeManagerCreator, base_node_factory, NULL);
pServer->addModule(pXmlParser);
I'm able to connect to the server and see the endpoints from the client side, but I wonder, from the server side, how can I handle the loaded nodes from the server's address space to be able to set the variables?

Thanks in advance.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: How can I handle already existing nodes from the server side?

Post by Support Team »

Hello,

There are two ways to set the initial value of the variable.

1) Set the variable value in NodesetXML --> XML parser will process and set the value.
2) There is a variableCreated() method in the NodeManagerNodeSetXml class, which can be implemented by the subclass.
https://documentation.unified-automation.com/uasdkcpp/1.8.1/html/classNodeManagerNodeSetXml.html#ac7f69f16c5d22db29fdd19a1577b3801
Once the variable is created you will end up in the variableCreated() method, where you can set the initial values.

We have an example in the DemoServer application that comes with the SDK.
Please check void MyNodeManagerNodeSetXml::variableCreated(UaVariable* pNewNode, UaBase::Variable *pVariable)
Best regards
Unified Automation Support Team

Post Reply