I take the build steps recommended at http://www.open62541.org/doc/1.3/nodeset_compiler.html
to build an OPC UA Server by means of open62541 v1.3.2 on Raspberry Pi.
I utilize an OPC UA Modeler tool including companion standards to create an OPC UA Nodeset XML file. It contains numeric NodeIds, e.g. NodeId="ns=6;i=6018
". Using this XML file cmake and the Python compiler of open62541 generate h and c files. Then cmake and gcc compiles and links the c and h files to an executable file. This OPC UA Server runs and is accessible by OPC UA viewers. So far, so good.
Now the OPC UA variables need to be connected with physical variables residing in other processes. For this I want to set a callback function like http://www.open62541.org/doc/1.3/tutorial_server_datasource.html
in my main function and establish some interprocess communication when the OPC UA server starts up. I like to write only this c file with my main function and use the automatically generated h and c files as they are. Otherwise I would have to do the same modifications at every new open62541 version causing additional maintenance efforts.
So, I like to call UA_Server_setVariableNode_valueCallback
which has parameter nodeId
. However, the function UA_Server_addNode_begin
in the generated c files has parameters requestedNewNodeId
. It seems open62541 can automatically change the NodeId. Hence, when calling UA_Server_setVariableNode_valueCallback
I cannot rely on the NodeId of the XML file. Keeping track of the modifications by implementing a translation table requestedNewNodeId
would be possible but UA_Server_addNode_begin
in the generated c files is called with value NULL
for parameter outNewNodeId
, and as mentioned above I don't like to intervene the automatic build process.
- Is there a cmake option to prevent open62541 changing the NodeId when adding a node?
- Is there a cmake option to allow open62541 only adding the NodeId unchanged?
- How can I find out the NodeId which open62541 really assigns to the OPC UA variables without modifying the automatically created h and c files?
- How can I access the OPC UA variables without altering the automatic build process if their NodeId is not guaranteed to be kept?