asn1tools
asn1tools copied to clipboard
Error when encoding Basic APER Bit String
When Encoding a APER BitString like the following format:
TriggerConditions ::= BIT STRING {
reserved (0),
data-change (1),
quality-change (2),
data-update (3),
integrity (4),
general-interrogation (5)
} (SIZE(6))
foo = asn1tools.compile_files('gsp_commu_service_all.asn','per')
res = foo.encode('TriggerConditions', (b'\xff',6))
And what I am looking for is 0xFC ,but the result is : 0xFF,
however when I modified the asn syntax like this:
TriggerConditions := BIT STRING(SIZE(6))
The result would be right. I think maybe something wrong when encode BIT String described like that way.
Feel free to implement a fix. I don't have time to do so myself.