Decoding Extended Object Body |OPC UA Implementation: Stacks, Tools, and Samples|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Decoding Extended Object Body
Avatar
Jens Königsmann
New Member
Members
Forum Posts: 1
Member Since:
02/12/2021
sp_UserOfflineSmall Offline
1
03/22/2022 - 09:00
sp_Permalink sp_Print

Hello,

how can I decode an extended object body (byte array) that should have the following structure:

UDT Alert  
DateTime LDT
AlertNumber Int16
AlertMessage String

 

What I get when reading the data is a byte-array like that:

 

– exObjArr {Opc.Ua.ExtensionObject[30]} Opc.Ua.ExtensionObject[]
– [0] {Byte[113]} Opc.Ua.ExtensionObject
+ Body {byte[113]} object {byte[]}
Encoding Binary Opc.Ua.ExtensionObjectEncoding
+ TypeId {nsu=http://www.siemens.com/simatic-s7-opcua;s=TE_”typeOPCUA_Alarme”} Opc.Ua.ExpandedNodeId
+ XmlEncodedBody “Element, Name=\”ByteString\”” System.Xml.XmlElement
+ XmlEncodedTypeId null Opc.Ua.NodeId
– m_body {byte[113]} object {byte[]}
[0] 122 byte
[1] 45 byte
[2] 130 byte
[3] 189 byte
[4] 245 byte
[5] 61 byte
[6] 216 byte
[7] 1 byte
[8] 1 byte
[9] 0 byte
[10] 99 byte
[11] 0 byte
[12] 0 byte
[13] 0 byte
[14] 83 byte
[15] 105 byte
[16] 99 byte
[17] 104 byte
[18] 101 byte
[19] 114 byte
[20] 117 byte
[21] 110 byte
[22] 103 byte
[23] 32 byte
[24] 50 byte
[25] 51 byte
[26] 48 byte
[27] 86 byte
[28] 65 byte
[29] 67 byte
[30] 32 byte
[31] 105 byte
[32] 115 byte
[33] 116 byte
[34] 32 byte
[35] 114 byte
[36] 97 byte
[37] 117 byte
[38] 115 byte
[39] 103 byte
[40] 101 byte
[41] 102 byte
[42] 108 byte
[43] 111 byte
[44] 103 byte
[45] 101 byte
[46] 110 byte
[47] 45 byte
[48] 32 byte
[49] 83 byte
[50] 101 byte
[51] 114 byte
[52] 118 byte
[53] 105 byte
[54] 99 byte
[55] 101 byte
[56] 115 byte
[57] 116 byte
[58] 101 byte
[59] 99 byte
[60] 107 byte
[61] 100 byte
[62] 111 byte
[63] 115 byte
[64] 101 byte
[65] 44 byte
[66] 32 byte
[67] 83 byte
[68] 99 byte
[69] 104 byte
[70] 97 byte
[71] 108 byte
[72] 116 byte
[73] 115 byte
[74] 99 byte
[75] 104 byte
[76] 114 byte
[77] 97 byte
[78] 110 byte
[79] 107 byte
[80] 98 byte
[81] 101 byte
[82] 108 byte
[83] 101 byte
[84] 117 byte
[85] 99 byte
[86] 104 byte
[87] 116 byte
[88] 117 byte
[89] 110 byte
[90] 103 byte
[91] 44 byte
[92] 32 byte
[93] 83 byte
[94] 99 byte
[95] 104 byte
[96] 97 byte
[97] 108 byte
[98] 116 byte
[99] 115 byte
[100] 99 byte
[101] 104 byte
[102] 114 byte
[103] 97 byte
[104] 110 byte
[105] 107 byte
[106] 108 byte
[107] 117 byte
[108] 101 byte
[109] 102 byte
[110] 116 byte
[111] 101 byte
[112] 114 byte

Avatar
Randy Armstrong
Admin
Forum Posts: 1580
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
03/23/2022 - 07:11
sp_Permalink sp_Print

The server provides either a DataTypeDictionary: (v1.03 and earlier)
https://reference.opcfoundatio…..Part5/E.1/

Or a DataTypeDefinition Attribute on the DataType: (v1.04 and later)
https://reference.opcfoundatio…..rt3/5.8.3/

These structures provide metadata needed to parse the byte string.

Note that most SDKs have code generators that can produce the serialization code from the definitions.

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 25
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1446
Posts: 4891