Decoding array of structs (ExtensionObject)

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

Moderator: uasdknet

Post Reply
Rusle
Full Member
Full Member
Posts: 9
Joined: 30 Jan 2014, 15:47

Decoding array of structs (ExtensionObject)

Post by Rusle »

On my server I have variable which is an array of structs (4 fields that all are double).

When I read the value of this node in my .NET Client application, the DataValue.WrappedValue.TypeInfo is ExtensionObject[] and ValueRank 1, and the DataValue.WrappedValue.Value field is {UnifiedAutomation.UaBase.ExtensionObject[20]} containing unintelligble data.

Iterating through the elements in this array, I get the single ExtensionObjects with the TypeId {nsu=http://mynamespace.com/;i=5004}.

Where do I go from here to extract the actual structs? The structure type is defined on the server ( Types > DataTypes > BaseDataType > Structure > MyStruct ). I tried looking at some examples for the C++ SDK, but the classes and functions used there did not apply to the .NET SDK (UaStructureDefinition, UaSession::structureDefinition(), UaGenericValue ).

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

Re: Decoding array of structs (ExtensionObject)

Post by Support Team »

Hi,

The .NET SDK supports only known structures (known at compile time). The necessary code to handle these known structures can be created with the UaModeler.

The generic support for unknown structure like already available for the C++ SDK will be available with the next feature release of the .NET SDK which will be version 2.3. This version is currently under development but the generic data type handling is already working. The release is scheduled for end of August this year.

Best Regards,
Unified Automation Support Team

Rusle
Full Member
Full Member
Posts: 9
Joined: 30 Jan 2014, 15:47

Re: Decoding array of structs (ExtensionObject)

Post by Rusle »

Edit: I found a good tutorial for this in the "Handbook" in UaModeler. I had previously just checked http://documentation.unified-automation.com/index.html for documentation for the modeller.


Do you have any examples of doing this? Just looking at the generated code I can't get any idea on how to get the actual structs from a Data Change on a monitored item of this.

UA Modeler generated two files, a "mynamespaceTypes.cs" and "mynamespaceIdentifiers.cs".

In the Types-file there are classes for MyStruct and MyStructCollection

Post Reply