u9n / dlms-cosem

A Python library for DLMS/COSEM
Other
80 stars 41 forks source link

X-ADR, Error on structure as top element #23

Closed Krolken closed 3 years ago

Krolken commented 3 years ago

when reading attributes on certain interface classes the top element is a structure.

Right now the element count seems to be interpreted as a data tag.

data = b'\x02\x07\x06\x00\x00\x00\x00\x12\x00\x00\x11\x00\x11\x00\x12\x00\x00\x12\x00\x00\x12\x00\x00'

 return cls.MAP[tag]
KeyError: 7
Krolken commented 3 years ago

The issue seems related to getting a not implemented error on UTF8String for the following data:

data=b'\x02\x05\x12\x02\xd0\x12\x0c\xa8\x11\x12\x11\x1e\x0f\xc0'

The tag 05 exists and is interpreted wrongly and shifts the parsing.