Dear support,
I configured NodeAccessInfo for nodes with "Role-Role" mode and generated corresponding C++ codes. The definition and initialization of configured ids located in the cpp file of node management base. From the C++ SDK demo, the access infor configuration realized in myservercallback files. So my question is how to use the configuration in UaModeler to myservercallback? Because the document from Uamodeler only support tutorial for .NET server.
Thanks.
How to use NodeAccessInfo for C++
Moderator: uamodeler
- Support Team
- Hero Member
- Posts: 3069
- Joined: 18 Mar 2011, 15:09
Re: How to use NodeAccessInfo for C++
Hello Gloria,
UaModeler generates members for each role you use in the model. As you already figured out these are located in the generated MyNodeManagerBase class.
What you still need to do is to set them to the Ids your server uses.
In the DemoServer example the Ids are defines in myservercallback.h:
Instead you could also read them from some configuration file or database.
In the DemoServer example the IDs are set in the constructor of NodeManagerAccess. For your implementation you maybe want to add a method to MyNodeManager to set them.
Another step that is necessary is to map a user context to an user or role. So if a client connects with username / password you need to create a context and assign a number of roles to that context.
Again in the DemoServer example this happens in MyServerCallback::logonSessionUser.
UaModeler generates members for each role you use in the model. As you already figured out these are located in the generated MyNodeManagerBase class.
What you still need to do is to set them to the Ids your server uses.
In the DemoServer example the Ids are defines in myservercallback.h:
Code: Select all
// Ids for Users and Groups - these Ids will usually come from a UserManagement component
const OpcUa_UInt16 UserIdJoe = 1;
const OpcUa_UInt16 UserIdJohn = 2;
const OpcUa_UInt16 UserIdSue = 3;
In the DemoServer example the IDs are set in the constructor of NodeManagerAccess. For your implementation you maybe want to add a method to MyNodeManager to set them.
Another step that is necessary is to map a user context to an user or role. So if a client connects with username / password you need to create a context and assign a number of roles to that context.
Again in the DemoServer example this happens in MyServerCallback::logonSessionUser.
Best regards
Unified Automation Support Team
Unified Automation Support Team