[taste-users] ASN.1 encoding

[ Thread Index | Date Index | More lists.tuxfamily.org/taste-users Archives ]


Hi everybody,

I have some problems with correctly encoding and decoding ASN.1 and/or ACN:

My ASN.1 definition is:

TASTE-Dataview DEFINITIONS ::=
BEGIN
BINARY			::= BOOLEAN
RADIANS		::= REAL (-1.0 .. 1.0)
ATTITUDE		::= SEQUENCE (SIZE(3)) OF RADIANS
ATTRATE		::= SEQUENCE (SIZE(3)) OF RADIANS
MEAS			::= SEQUENCE {att ATTITUDE, rate ATTRATE, simctrl SEQUENCE {simstart BOOLEAN, parm REAL (0.0 .. 1.0)}}
END

My ACN model is:

TASTE-Dataview DEFINITIONS ::= BEGIN
    RADIANS[encoding IEEE754-1985-64, endianness little]
    ATTITUDE []
    ATTRATE []
    MEAS[] {att [], rate [], simctrl [] {simstart [], parm [encoding IEEE754-1985-64, endianness little] }}
END

In a black box system the size of the MEAS is 57 bytes:
#define asn1SccMEAS_REQUIRED_BYTES_FOR_ACN_ENCODING   57

Which is correct 7*8 bytes for the real + 1* 1byte for the Boolean.

Giving a MEAS from a black box device to a c-function result in (in my opinion) a conversion error, also the sizes seem to be wrong:

sizeof(asn1SccMEAS)=64                              
sizeof(asn1SccMEAS_simctrl)=16                      
sizeof(asn1SccATTRATE)=24
sizeof(asn1SccATTITUDE)=24

the latter two make sense (3*8byte), but simctrl is a struct from a double and a "flag" which should be 9 bytes but 16 bytes is give during runtime.
"""
typedef double asn1SccMEAS_simctrl_parm;
typedef struct {
    flag simstart;
    asn1SccMEAS_simctrl_parm parm;
} asn1SccMEAS_simctrl;
"""

If I see it correctly, than there is some problem with ASN.1 BOOLEANs which are converted to c-type "flag".



An example of the conversion from the blackbox device to a c-function:

The MEAS encoded in ACN is (57 bytes):

3f, e4, c4,79, a6,85,36,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3f, e6,66,66,66,66,66,66,                                                                             

converted to the c-struct in the c-function leads to a byte array (asn1SccMEAS, size 64byte):

10,36,85,a6,79,c4,e4,3f,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,cc,cc,cc,cc,cc,cc,7f,2,

The first "double" seems to be converted correctly (little/big endian conversion). The zeros are probably also correct, but the BOOL ("1") from the first array cannot be found inside the second array and the double afterwards is also incorrect. (Also that (again) there are 8 bytes for a BOOL is probably incorrect)

I am sorry for the long and (probably) confusion explanation, but I am unsure where the problem results from. May be I did something wrong in the ASN/ACN model, or the conversion function are broken.

Best regards

Michael Dumke

--------------------------
Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
German Aerospace Center
Institute of Space Systems | Robert-Hooke-Str. 7 | 28359 Bremen | Germany

Michael Dumke
Telephone +49 421 24420-1262 | Telefax +49 421 24420-1120 | michael.dumke@xxxxxx
www.DLR.de












Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/