vlm / asn1c

The ASN.1 Compiler
http://lionet.info/asn1c/
BSD 2-Clause "Simplified" License
1.03k stars 553 forks source link

uper decodes sequence of only gets first two after sending three of them #416

Closed Di-Gu closed 3 years ago

Di-Gu commented 3 years ago

Here is the asn: Link

I used following command to generate the .h and .c files: asn1c -S ~/asn1c/skeletons/ -no-gen-example -fincludes-quoted -no-gen-OER c-v2x.asn

The received bytes are:

0x20,0xc7,0x27,0x37,0x53,0x13,0x23,0x33,0x43,0x5b,0x5a,0x4e,0x90,0x06,0xb4,0x9d,0x1f,0xf1,0x00,0x02,0x4b,0x40,0x00,0x00,0x72,0x73,0x75,0x31,0x32,0x33,0x34,0x35,0x53,0x25,0x66,0xb4,0x9d,0x23,0x96,0xb4,0x9d,0x21,0xd0,0x00,0x06,0x00,0x00,0x7e,0x7d,0x07,0xd0,0x7f,0x7f,0xff,0x80,0x40,0x04,0x14,0x02,0x96,0x00,0x00,0x00,0xe4,0xe6,0xea,0x62,0x64,0x66,0x68,0x6a,0xa6,0x4a,0xcd,0x69,0x3a,0x46,0xad,0x69,0x3a,0x4b,0x20,0x00,0x16,0x00,0x02,0xfc,0xfa,0x0f,0xa0,0xfe,0xff,0xff,0x02,0x00,0x14,0x10,0x29,0x2d,0x00,0x00,0xc1,0xc9,0xcd,0xd4,0xc4,0xc8,0xcc,0xd0,0xd5,0x4c,0x95,0x9a,0xd2,0x74,0x7f,0xda,0xd2,0x74,0x80,0x40,0x00,0x0a,0x00,0x0f,0xfd,0xfe,0xc5,0xed,0xfd,0xff,0xfe,0x00,0x00,0x00,0x00,0x08

The decode way is UPER.

Here is the code for decoding:

uint8_t buf[] = {0x20,0xc7,0x27,0x37,0x53,0x13,0x23,0x33,0x43,0x5b,0x5a,0x4e,0x90,0x06,0xb4,0x9d,0x1f,0xf1,0x00,0x02,0x4b,0x40,0x00,0x00,0x72,0x73,0x75,0x31,0x32,0x33,0x34,0x35,0x53,0x25,0x66,0xb4,0x9d,0x23,0x96,0xb4,0x9d,0x21,0xd0,0x00,0x06,0x00,0x00,0x7e,0x7d,0x07,0xd0,0x7f,0x7f,0xff,0x80,0x40,0x04,0x14,0x02,0x96,0x00,0x00,0x00,0xe4,0xe6,0xea,0x62,0x64,0x66,0x68,0x6a,0xa6,0x4a,0xcd,0x69,0x3a,0x46,0xad,0x69,0x3a,0x4b,0x20,0x00,0x16,0x00,0x02,0xfc,0xfa,0x0f,0xa0,0xfe,0xff,0xff,0x02,0x00,0x14,0x10,0x29,0x2d,0x00,0x00,0xc1,0xc9,0xcd,0xd4,0xc4,0xc8,0xcc,0xd0,0xd5,0x4c,0x95,0x9a,0xd2,0x74,0x7f,0xda,0xd2,0x74,0x80,0x40,0x00,0x0a,0x00,0x0f,0xfd,0xfe,0xc5,0xed,0xfd,0xff,0xfe,0x00,0x00,0x00,0x00,0x08};
asn_dec_rval_t rval;
MessageFrame_t *msg = 0;
size_t a = sizeof(buf);
rval = uper_decode_complete(0, &asn_DEF_MessageFrame, (void **)&msg, buf, a);
asn_fprint(stdout, &asn_DEF_MessageFrame, msg);

the stdout only give the first two particiantData instead of three

RSM ::= {
    msgCnt: 12
    id: 72 73 75 31 32 33 34 35
    refPos: Position3D ::= {
        lat: 0
        long: 0
        elevation: 0
    }
    participants: ParticipantList ::= {
        ParticipantData ::= {
            ptcType: 4 (rsu)
            ptcId: 0
            source: 0 (unknown)
            id: 72 73 75 31 32 33 34 35
            secMark: 21285
            pos: PositionOffsetLLV ::= {
                offsetLL: Position-LLmD-64b ::= {
                    lon: 58
                    lat: 14
                }
            }
            accuracy: PositionConfidenceSet ::= {
                pos: 0 (unavailable)
                elevation: 0 (unavailable)
            }
            speed: 12
            heading: 0
            angle: 0
            accelSet: AccelerationSet4Way ::= {
                long: 0
                lat: 0
                vert: 0
                yaw: 0
            }
            size: VehicleSize ::= {
                width: 2
                vehicleLength: 2
                vehicleHeight: 5
            }
            vehicleClass: VehicleClassification ::= {
                classification: 1
            }
        }
        ParticipantData ::= {
            ptcType: 0 (unknown)
            ptcId: 0
            source: 0 (unknown)
            id: 72 73 75 31 32 33 34 35
            secMark: 21285
            pos: PositionOffsetLLV ::= {
                offsetLL: Position-LLmD-64b ::= {
                    lon: 54
                    lat: 44
                }
            }
            accuracy: PositionConfidenceSet ::= {
                pos: 0 (unavailable)
                elevation: 0 (unavailable)
            }
            speed: 22
            heading: 1
            angle: 0
            accelSet: AccelerationSet4Way ::= {
                long: 0
                lat: 0
                vert: 0
                yaw: 0
            }
            size: VehicleSize ::= {
                width: 8
                vehicleLength: 5
                vehicleHeight: 2
            }
            vehicleClass: VehicleClassification ::= {
                classification: 10
            }
        }
    }
}

Process finished with exit code 0

I used OSS playground checked and get 3 particiantData from there.

I'm confused about where goes wrong inside of my code.

Can anyone help?

Di-Gu commented 3 years ago

solved with using v.0.9.28....