I want to browse a specific node on my OPC UA Server and use its method. I use the open62541 stack and i want to use a selfmade client. My Client connects to the Server and then i use the given example to browse some Objects. It shows me the first layer of nodes after the root-folder- How can i find a specific node? Or have i to browse to this point? Is there an example file in the open62541 project which i don't see that would open my eyes?
I also find the Method "Service_TranslateBrowsePathsToNodeIds" but i'm not quite sure how to use it the right way and which part is interesting for me.
As an example: I want to browse the Node "FileSystem", which is in a deeper layer than the root-folder, and want to use its Method createFile.
To call a method, you need two node ids:
If you already have these node ids, you can call the method right away. If not, OPC UA in general supports two options to get these node ids:
Start at the root node (ns=0;i=84
) and recursively browse all the child nodes until you find the node with the specific browse name.
https://github.com/open62541/open62541/blob/58bd161557111847d068650eff5ad670a9aa0395/examples/client.c#L61
Use the TranslateBrowsePathsToNodeIds
Service if you have a browse path. I.e., give /Objects/MyDevice/FileSystem/UploadFile
(concatenation of browse names) with start node Root (ns=0;i=84
) and the server will return you the node id of that specific node if it exists. This service is taking relative paths, therefore you can also use other nodes as start nodes
https://github.com/open62541/open62541/blob/58bd161557111847d068650eff5ad670a9aa0395/examples/client_async.c#L183