Closed JonSmet closed 1 year ago
@jamidon Hello, I was reading through your recent issue (#113) and saw that you were able to successfully add an element to a BasicSafetyMessage's regional sequence and encode the message. That seems very similar to the work I am trying to do, if you have time would you be willing to describe how you were able to do this?
I was able to fix this issue. I ended up adding to partII->list using the following approach:
VehicleMessage_t* vehicle_msg;
vehicle_msg = (VehicleMessage_t*) calloc(1, sizeof(VehicleMessage_t));
vehicle_msg->speed = 24; // Set VehicleMessage 'speed' field
VehicleMessage_t::VehicleMessage__extensionList* extension_list;
extension_list = (VehicleMessage_t::VehicleMessage__extensionList*) calloc(1, sizeof(VehicleMessage_t::VehicleMessage__extensionList));
VehicleMessageExtension_t* extension_element;
extension_element= (VehicleMessageExtension_t*) calloc(1, sizeof(VehicleMessageExtension_t));
extension_element->extension_Id = 1; // Set extension ID to 1 for 'eightWheelerExt'
extension_element->extension_Value.present = VehicleMessageExtension__extension_Value_PR_EightWheelerExtensions;
asn_sequence_add(&extension_list->list, extension_element);
vehicle_msg->extensionList = extension_list;
// Encode message
uint8_t buffer[544];
size_t buffer_size=sizeof(buffer);
asn_enc_rval_t ec;
ec = uper_encode_to_buffer(&asn_DEF_VehicleMessage, 0 , vehicle_msg, buffer , buffer_size);
Hello,
I am working with the J2735 201603 ASN spec (which was compiled using the vlm-master branch of this repository), and I am unable to UPER encode a message that has a 'SEQUENCE' field after trying to add an element to this SEQUENCE. I have tried different approaches over the past week for adding an element to this 'SEQUENCE' field, but none have enabled me to successfully UPER encode the message.
Since I am unable to share the J2735 ASN spec, I've provided a simpler example ASN spec for a made-up VehicleMessage below, along with snippets from relevant generated header files and a code snippet where the UPER encoding fails after adding an element to the VehicleMessage's SEQUENCE field. Hopefully this helps convey the issue I am running into.
Any guidance on how to properly add an element to this 'SEQUENCE' field would be appreciated! I suspect I am incorrectly using asn_sequence_add(), but am unsure how to fix it. Please let me know if any additional information is needed.
Simplified ASN Spec (Modified excerpt from my .asn file since I am unable to share it):
Relevant snippets from the generated header files:
Code snippet below that describes some of my failed attempts at encoding the message after adding an element to the VehicleMessage_t's extensionList sequence.: