Page 1 of 1

DataTypeDefinition attribute

Posted: 28 Jun 2021, 13:31
by mari21
Hello!

I'm new to OPC UA. I need to parse data from DataTypeDefinition attribute? I have looked through examples, but didn't find the one how StructureDefinition is extracted. Based on my understanding, after reading a DataType Node (with attributeId =OpcUa_Attributes_DataTypeDefinition) I extract an ExtensionObject from UaVariant value. Then I somehow should get UaStructureDefinition object from the ExtensionObject. And I'm not sure how to do it.
I would be appreciated if an example can be posted for retrieving data from DataTypeDefinition attribute.
Thank you!

Re: DataTypeDefinition attribute

Posted: 29 Jun 2021, 14:08
by mari21
I've figured out that I can create an instance of the class UaStructureDefinitionDataType initialized with value from a UaExtensionObject and this will contain struct in DataTypeDefinition attribute. Also because OpcUa_StructureDefinition is known to client side stack it is automatically decoded by the stack and can be accessed directly. Is it a right way to consume data from DataTypeDefinition attribute?

Another question, how can UaStructureDefinitionDataType help decode a complex structure value of this type from an ExtensionObject?
Examples show how to do decoding using UaStructureDefinition, not UaStructureDefinitionDataType.

Thank you!