Page 1 of 1

Read/Write Variables with dynamically added Enumeration Type

Posted: 20 Apr 2020, 06:07
by fczech

I need to add variables with own enumeration datatypes to the running server.
The enumerations are configurable by the use, so I can't create and add static nodes to the nodeset created by uamodeler.

With my current solution I can create the dataclass node with the corresponding enum value property, and add a variable with the newly created node as type.
The following approach is used to add the dataclass node and the enumvaluetype property.

1. Create enum_datatype node
2. Set nodeid, displayname, browsename of enum_datatype node
3. Add reference enum_datatype node to enumeration node
4. Add variable node with datatype UA_ID_ENUMVALUETYPE and add property reference zo enum_datatype node

When the enumvaluetype property is read I create an ua_enumvaluetype array and add it as a extensionobject to the ua_variant (with ua_variant_attach_extensionobject_array).
This seems to work correctly and the output in UaExpert is identically to the solution when I have added a static enumeration to the nodeset.

1. But when I read the variable node it only shows me the integer value. Currently I use Int64 as ua_varianttype when reading the node. Do I need to use an extensionobject as well for this? If yes, which type do I have to use?

2. When I add a static enumeration datatype to the nodeset created by UaModeler and add a variable with this type, all enumeration values are listed when I try to write the value in UaExpert. This is not the case for the variable nodes with the dynamically added Enumeration Type (it's like writing an integer value). Am I missing some required steps when creating the datatype node?

Thanks in advance