11/11/2015
Hello,
I’m trying to find a way to parse the binary structured data from an ExtensionObject.
I know, how to get the correct DataTypeNode of the received data. But didn’t find any way on how to use it to decode the binary data.
Hopefully, anyone can give me a hint how to do this with the .NET SDK.
Thanks!
05/30/2017
https://github.com/OPCFoundati…..Encoder.cs
public ExtensionObject ReadExtensionObject(string fieldName)
11/11/2015
Thanks for your reply!
But how do I use the Binary decoder? And whats the fieldName?
Is there a possibility to the the DataTypeNode for the decoder?
The following code does not work…
DataValue Data = GetDataFromServer(…);
var ExtData = GenericData.Value as ExtensionObject;using var Decoder = new BinaryDecoder(ExtData .Body as byte[], ServiceMessageContext.GlobalContext);
var Result = Decoder.ReadExtensionObject(null);
05/30/2017
The binary decoder needs to exact the fields of the custom structure.
i.e.
field1 = Decoder.ReadInt32();
field2 = Decoder.ReadString();
The process is the same as you would expect if you were extracting information from an XML or JSON document.
Some stacks that have helper classes that can parse ExtensionObjects from a schema definition but I am not sure NETStandard has that yet.
1 Guest(s)