Hi Dima_t,
As per the code posted above shows that,
variable.base_config.node_handle is same as
variable1.base_config.node_handle. In that case server cannot create another node with the same node handle.
May be I was not clear in my previous response. <variable_name>.base_config.node_handle should not match with any of the node_handle which is already in address space as well as <variable_name>.base_config.display_name_handle also should not match with any of the display_name_handle which is in address space.
In ua_types.h it clearly says display_name_handle should be a unique identifier, as well as node_handle should also be a unique identifier. Please refer the ua_types.h file for the same
It is possible to create more than 1 folder and more than 1 variable. All needs to be done for creating more than 1 folder and more than 1 variable is, have unique node_handle and display_name_handle.
In the example code which is provided,
#define HANDLE_Folder 1
#define HANDLE_Variable 2
HANDLE_Folder represents the index in the array ENGLISH_TEXT which holds the information about the folder name.
HANDLE_Variable represents the index in the array ENGLISH_TEXT which holds the information about the Variable name.
So, when we browse the node in UA Client (ex: UA Expert), it will basically calls the UAServer_Callback_translate(), for getting the display name of the node. We can see that, UAServer_Callback_translate() actually returns the address of the ENGLISH_TEXT array index entry which was passed as display_name_handle.
So if you want to create an another folder and another variables, We can define new handles for the same and we have to add the entries to the ENGLISH_TEXT array and then pass the respective display_name_handle. For Ex:
#define HANDLE_Folder 1
#define HANDLE_Variable 2
#define HANDLE_Folder2 3
#define HANDLE_Variable2 4
In the ENGLISH_TEXT array please make an entry for HANDLE_Folder2 and HANDLE_Variable2 at the respective index.
Then while creating the Folder node for Folder2 please mention the display_name_handle as HANDLE_Folder2, For creating the another variable node Variable2, please mentions the display_name_handle as HANDLE_Variable2.
node_handle is the unique uint32_t value. So for each variable or folder node_handle value should always be the unique uint32_t value. as we have the unique display_name_handle s for each folder and each variable in the example above, node_handle can also be assigned with respective HANDLE_<folder/variable>.
I hope this will help to solve the problem.
Regards,
Basavaraju B V
Edited by user Monday, February 1, 2016 9:14:51 PM(UTC)
| Reason: Not specified