open62541 / open62541

Open source implementation of OPC UA (OPC Unified Architecture) aka IEC 62541 licensed under Mozilla Public License v2.0
http://open62541.org
Mozilla Public License 2.0
2.59k stars 1.24k forks source link

How to copy nodes? #6047

Open capce opened 1 year ago

capce commented 1 year ago

Hello there,

i want to copy object nodes and insert the copies in the address space as a child of another node. What is the intended way to do this? Is it to traverse all child nodes, create a new node for each and copy each attribute with the appropriate copy function? Is there a better/easier or more elegant solution open62541 provides? I would be thankful for any tip.

Checklist

Please provide the following information:

JustinF02 commented 11 months ago

Hi ! I am looking for the same solution for my project.

This sample here with a server and a client might help you : https://github.com/open62541/open62541/tree/master/examples/custom_datatype

Theses objects can be requested using a nodeID and contains several values.

If you want to put nodes under a parent node, i suggest looking at this :

https://github.com/open62541/open62541/blob/effaeb395bded7e31f62ad4d7001c9ded8f2ae60/examples/tutorial_server_object.c#L269