04/09/2019
I'm now parsing / decoding the byte array that I get from a OPC UA Pub / Sub server and I'm about to write a parser that should parse the dataTypeId field as described in Table A.3 – DataTypeDescription Structure of the Part 14 specification! It says that the dataTypeId is of type NodeId which means I should look into the Part 6 spec where the NodeId Encoding is described.
So from Part 6 of the specification Table 5 – NodeId components describes NodeId components, but I could not understand how I could get it parsed from the sample data that I have. For example., here is the set of Bytes that I have which I believe should be parsed as dataTypeId:
1 1 1 0
Can someone please give me a hint as to how I should go about extracting the NodeId from this set of Bytes? I'm pretty sure that it is just these 4 bytes as the ones that come after this, I have already figured out that it is going to be part of the name in the DataTypeDescription structure!
Help please!
05/30/2017
Part 6 specifies the rules for encoding and tells you exactly the meaning of each byte on the wire.
If you prefer code you can look at the BinaryEncoder and BinaryDecoder classes which are part of the .NET code base:
04/09/2019
I can take a look at the .NET codebase, but I would prefer to understand it first hand! I seriously hate working with a .NET codebase!
So for my example.,
1 1 1 0
Here is how I would understand it!
The first byte 1 identifies the Encoding, which in this case is a 4 byte representation as per the Table 6 given in the Part 6 of the specification.
I then have to refer to Table 9 of the Part 6 specification where the Four Byte NodeId Binary DataEncoding is defined! It says that the Namespace is a Byte long and the Identifier is a UInt16. So applying this to my example., would mean that my namespace is 1 and the identifier is 1 0. Is this correct?
1 Guest(s)