asn1tools icon indicating copy to clipboard operation
asn1tools copied to clipboard

Error when encoding Basic APER Bit String

Open tangkai-prc opened this issue 4 years ago • 1 comments

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.

tangkai-prc avatar Mar 31 '21 07:03 tangkai-prc

Feel free to implement a fix. I don't have time to do so myself.

eerimoq avatar Mar 31 '21 08:03 eerimoq