When processing association view object list responses, it seems that DLMS Translator can understand and display the object list when it is returned in a get-response-normal response, but can't do the same in case when the object list is returned in get-response-with-datablock response.
First, an example where it correctly parses everything. I took the essential parts from this thread: https://www.gurux.fi/node/21382
In this case, the part that comes after the InvokeIdAndPriority (leading info + the object list) is correctly interpreted down to the last detail of every object returned.
7E
...
C4 -- get response
01 -- get response normal
C1 -- invoke ID and priority
-- leading info (encoded in ASN.1?)
00 -- result
01 -- data
82 01 0F -- sequence of, 271 elements?
-- object list
02 -- structure / sequence of
04 -- four elements
...
F6 09
7E
DLMS_PDU[196] {** GetResponse **}
└──GetResponse[1] {** Get-response-normal **}
└──GetResponseNormal Sequence
├──InvokeIdPriority
│ ├──InvokeID (0..3): 1
│ ├──ServiceClass (6): confirmed
│ └──Priority (7): high
└──GetDataResult Result[0] {** data **}
└──Data[1] {** Array **}
└──SequenceOf 271 Element(s)
├──0: Data[2] {** Structure **}
│ └──SequenceOf 4 Element(s)
│ ├──0: [18] Unsigned16 = 10009 (0x2719)
│ ├──1: [17] Unsigned8 = 82 (0x52)
...
And here is the case when the object list comes in a get-response-with-datablock response. DLMS translator correctly recognizes datablock-G sequence (last block, block number and raw data), but for some reason does not attempt to interpret raw data further.
C4 -- get response
02 -- get response with data block
C1 -- invoke ID and priority
-- result: datablock-G (?)
00 -- last block (false)
00 00 00 00 -- block number
00 -- CHOICE raw-data
82 -- what is this encoding? If it's ASN.1, what's this 0x82 tag?
07 CF -- this is the byte length of all raw-data in this block
01 82 01 65 -- what's this part and why DLMS Translator does not attempt to interpret it?
-- the part below is object-list from Blue Book (DLMS Translator displays it correctly when it is inside a get-response-normal response)
-- 1st object
02 04 12 00 01 11 00 09 06 00 00 2B 01 00 FF 02 02 01 02 02 03 0F 01 16 01 00 02 03 0F 02 16 01 00 01 00
02 04 12 ..
GetResponse>
<GetResponsewithDataBlock>
<!-- Priority: High, ServiceClass: Confirmed, Invoke ID: 1 -->
<InvokeIdAndPriority Value="C1" />
<Result>
<LastBlock Value="00" />
<BlockNumber Value="00000000" />
<Result>
<RawData Value="0182016502041200011100090600... />
</Result>
</Result>
</GetResponsewithDataBlock>
</GetResponse>
I understand that, in the Green Book, raw-data is defined as IMPLICIT OCTET STRING. However, DLMS Translator certainly knows what the actual data structure is, since it was capable to interpret similar byte sequence in case of the get-response-normal request mentioned above.
Why is that? Which encoding is used for raw-data internally? What's the formal definition of the leading info sequence 82 07 CF 01 82 01 65 which precedes the actual object-list?
I know this is too many questions, but they all really refer to the same thing.
Thanks for any help and hints.
Hi, The reason for this is…
Hi,
The reason for this is that there is not all the data available when get-response-with-datablock is received. Because there is not all the data the received bytes can't be translated to XML.
82 07 CF is the length of the data. If the highest bit is set the rest of the bits tell the amount of length bytes. In this case, the length is two bytes.
BR,
Mikko
Thanks Mikko, So it's an A…
Thanks Mikko,
So it's an A-XDR length.
I did try to concatenate all raw-data chunks that constitute the very first block (the block was itself split into several frames) and to see if DLMS Translator would parse it correctly.
It didn't, but now when I see the actual encoded length (~32k), I understand that the DLMS Translator would only parse it correctly if I concatenated and pasted all raw-data chunks from all blocks. All ~32K of raw-data parts.
Thanks to your explanation, I can now see that the leading info has not one but two A-XDR lengths. The first one is few bytes longer than the second. Now that I know what the first one is, I can probably figure out what the second refers to.
But what's the actual ASN.1 definition of this leading info part? I don't remember seeing it anywhere.
Thank you for your time and willingness to help.
Hi, Now, I have to say that…
Hi,
Now, I have to say that I can't remember on what document it was defined. It was more than ten years ago when HDLC framing was implemented. It might be that it's defined on some HDLC documents and not in ASN.1.
BR,
Mikko