Open trungpham135 opened 6 years ago
Hi @trungpham135,
The latest version has a generic asn_encode
method which you could use instead of uper_encode
https://github.com/vlm/asn1c/blob/4cc779fd9bd7f556699b5863cf111b359da10b66/skeletons/asn_application.h#L118-L134
Can you provide a little bit as an example for that?.
You could find some examples in the skeletons and tests directories.
$ grep "uper_encode(" tests skeletons/ -R
tests/tests-c-compiler/check-src/check-119.-gen-PER.c: rval = uper_encode(&asn_DEF_PDU, 0, st,
tests/tests-c-compiler/check-src/check-119.-fwide-types.-gen-PER.c: rval = uper_encode(&asn_DEF_PDU, 0, st,
tests/tests-c-compiler/check-src/check-126.-gen-PER.c: rval = uper_encode(&asn_DEF_PDU, 0, st, _buf_writer, 0);
skeletons/per_encoder.h:asn_enc_rval_t uper_encode(
skeletons/per_encoder.h: * A variant of uper_encode() which encodes data into the existing buffer
skeletons/per_encoder.h: * encoding of uper_encode() and uper_encode_to_buffer().
skeletons/asn_application.c: er = uper_encode(td, 0, sptr, callback, callback_key);
skeletons/constr_SET_OF.c: erval = uper_encode(elm->type,
skeletons/per_encoder.c:uper_encode(const asn_TYPE_descriptor_t *td,
skeletons/per_encoder.c: return uper_encode(td, constraints, sptr, encode_to_buffer_cb, &key);
skeletons/per_encoder.c: er = uper_encode(td, constraints, sptr, encode_dyn_cb, &key);
Dear vlm, Previously, I do PER encoding with only 04 parameters, now when I upgrade my ASN Compiler, the function uper_encoding requires 05 parameters, including _asn_per_constraintst. I've tried to set the value.flags and size.flags into APC_UNCONSTRAINTS but it seems not work.
Can you provide a little bit as an example for that?.
In my case, the data tobe encoded has the definitions: MIB ::= SEQUENCE { systemFrameNumber BIT STRING (SIZE (6)), subCarrierSpacingCommon ENUMERATED {scs15or60, scs30or120}, ssb-SubcarrierOffset INTEGER (0..15), dmrs-TypeA-Position ENUMERATED {pos2, pos3}, pdcch-ConfigSIB1 INTEGER (0..255), cellBarred ENUMERATED {barred, notBarred}, intraFreqReselection ENUMERATED {allowed, notAllowed}, spare BIT STRING (SIZE (1)) }
Thank you so much.