BIT_STRING example
Hello,
Anyone have an example of BIT_STRING encoding and decoding with asn1c?
For example using the below definition:
/* Dependencies */ typedef enum TestValue { Test_Value_unavailable = 0, Test_Value_1 = 1, Test_Value_2 = 2, } e_TestValue;
/* TestValue */ typedef BIT_STRING_t TestValue_t;
Thanks,
Probably this original poster does not need an answer any longer. Anyway here a possible solution for future reference and to be able to close the ticket.
The given structure belongs to following ASN.1 specs:
MyModule DEFINITIONS ::= BEGIN
TestValue ::= BIT STRING {
unavailable(0),
value1(1),
value2(2)
}
END
Running asn1c with it creates the file Test-Value.h which contains the Test_Value C enum definition.
And an example of this BIT_STRING encoding could be as follows:
<Test-Value>1100</Test-Value>
Where the initial 3 bits are mapped to unavailable, value1 and value2 respectively and the last bit is not used.
I think that the above answer is sufficient. If not - please re-open.