Write a value of a custom type

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
AlexanderSt
Jr. Member
Jr. Member
Posts: 1
Joined: 11 Jun 2018, 15:43

Write a value of a custom type

Post by AlexanderSt »

Dear All,

how can I write the data of a custom type.
I am following http://documentation.unified-automation ... on03Step05
With the builtin types, it was enough for me to specify Datatype in UaWriteValues:

UaWriteValues nodesToWrite;
nodesToWrite.create(1);
nodesToWrite[0].Value.Value.Datatype = OpcUaType_UInt32;
nodesToWrite[0].Value.Value.Value.UInt32 = 4;

Here Datatype magically corresponds to datatype Identifier with the namespace equal to 0.
As the node type has been changed to a custom enumeration, which has namespace 5, I cannot see the place where to specify this namespace.
How can one write to a node of a custom type? Is the case of a custom enumeration specific?

Thank you

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

Re: Write a value of a custom type

Post by Support Team »

Hello AlexanderSt,

it depends on the kind of custom type you want to write. For subtypes of enumeration it's easy. Just write an UInt32.
So the code you posted above is still fine.
Best regards
Unified Automation Support Team

Post Reply