How to use NodeAccessInfo for C++

Questions regarding the use of UaModeler

Moderator: uamodeler

Post Reply
Gloria
Jr. Member
Jr. Member
Posts: 1
Joined: 20 Oct 2016, 09:14

How to use NodeAccessInfo for C++

Post by Gloria »

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.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: How to use NodeAccessInfo for C++

Post by Support Team »

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:

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;
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.
Best regards
Unified Automation Support Team

Post Reply