Hello All,
In my sample server I have to reference nodes from different nodemanager(s). Is there any example? Sombody can provide any description what has to be done?
Thank you for your time.
Martin
Cross reference between nodemanagers
Moderator: uasdkcpp
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re:Cross reference between nodemanagers
Hello Martin,
There is already sample code in the tutorials and server examples. There are overloads for NodeManagerUaNode::addUaReference() and NodeManagerUaNode::addNodeAndReference(). They take either a UaNode pointer or a UaNodeId. If both nodes are in the same namespace, you can pass in the node pointers. If one node (source or target) is in another namespace, you can pass in the NodeId of source and target node. The NodeManagerUaNode (included in NodeManagerBase) takes care about creating references between NodeManagers.
See the following pseudo code for examples.
Best Regards,
Unified Automation Support Team
There is already sample code in the tutorials and server examples. There are overloads for NodeManagerUaNode::addUaReference() and NodeManagerUaNode::addNodeAndReference(). They take either a UaNode pointer or a UaNodeId. If both nodes are in the same namespace, you can pass in the node pointers. If one node (source or target) is in another namespace, you can pass in the NodeId of source and target node. The NodeManagerUaNode (included in NodeManagerBase) takes care about creating references between NodeManagers.
See the following pseudo code for examples.
Best Regards,
Unified Automation Support Team
Code: Select all
UaNode* pSourceNode;
UaNode* pTargetNode;
UaNodeId sourceNodeId;
UaNodeId targetNodeId;
UaNodeId referenceTypeNodeId;
// Adds new node with reference
// Source node is in different namespace
addNodeAndReference(sourceNodeId, pTargetNode, referenceTypeNodeId);
// Source and target are in same namespace
addNodeAndReference(pSourceNode, pTargetNode, referenceTypeNodeId);
// Adds only reference
// Source or target are in different namespace
addUaReference(sourceNodeId, targetNodeId, referenceTypeNodeId);
// Source and target are in same namespace
addUaReference(pSourceNode, pTargetNode, referenceTypeNodeId);
Best regards
Unified Automation Support Team
Unified Automation Support Team