First of all, I'm not sure if I should post this question here or in the uamodeler forum, but I think the answer to my question is specific to the c++ SDK so that's why I put it here.
I have managed to create an opcua server and a client that use the same datamodel. Now on the server side I use code that was generated by uamodeler. This code contains wrapper classes for the different object types etc, so knowledge of the tree structure of the model is embedded into that generated code. Now on the client side, when browsing nodes, I have to do a lot of manual coding like this (pseudocode):
Code: Select all
m_pClient->browse(UaNodeId("SomeContainerObject"), browseContext, [](const OpcUa_ReferenceDescription& ref){
UaNodeId nodeId(ref.NodeId.NodeId);
UaClientSdk::BrowseContext browseContext2;
browseContext2.referenceId = OpcUaId_HasProperty;
/* Browse into the node that was just browsed before */
m_pClient->browse(nodeId, browseContext2, [] (const OpcUaReferenceDescription& ref2) {
/* Read some data from the node here ..... */
}
});