-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CPDLC encoding build failure #13
Comments
Binaries in You may ask then, why is that, given that this function exists in
#include <stdio.h>
#include "asn1/FANSATCUplinkMessage.h"
#include "asn1/FANSTimestamp.h"
#include "asn1/asn_application.h"
void build() {
FANSATCUplinkMessage_t um = {0};
um.aTCMessageheader.msgIdentificationNumber = 15;
um.aTCMessageheader.msgReferenceNumber = NULL;
FANSTimestamp_t t = {0};
t.hours = 9;
t.minutes = 25;
t.seconds = 35;
um.aTCMessageheader.timestamp = &t;
um.aTCuplinkmsgelementId.present = FANSATCUplinkMsgElementId_PR_uM106Speed,
um.aTCuplinkmsgelementId.choice.uM106Speed.present = FANSSpeed_PR_speedIndicated;
um.aTCuplinkmsgelementId.choice.uM106Speed.choice.speedIndicated = 20;
um.aTCuplinkmsgelementid_seqOf = NULL;
unsigned char output[50] = {0};
asn_enc_rval_t rval = uper_encode_to_buffer(&asn_DEF_FANSATCUplinkMessage, &um, output, 50);
if(rval.encoded == -1) {
printf("Encoding failed at type %s\n", rval.failed_type->name);
} else {
printf("Encoding successful, %zd bits produced\n", rval.encoded);
for(int i = 0; i < rval.encoded / 8 + (rval.encoded % 8 > 0); i++) {
printf("%02x ", output[i]);
}
printf("\n");
}
}
int main() {
build();
}
Also note that |
Thanks for your quick reply. I realized that those encode functions were not available in the libacars library so I added a few to support cpdlc encoding like a 'la_cpdlc_build' function to cpdlc.c which calls 'la_asn1_encode_as' function which calls 'uper_encode_to_buffer' and its working great. If you like, I can make a patch for it for your review. It would be great if the libacars library supported both encoding and decoding including the json serialize/deserialize. Thanks for your help |
Thank you for suggestion, however I prefer to keep libacars to be a decoding library. Complete implementation of all encoders would require writing a significant amount of code, which use would be extremely limited, but it would still need to be maintained by someone (guess who). I therefore prefer to spend time on projects that might be interesting to a bit broader audience. |
I am trying to encode an uplink UM106MaintainSpeed message using the following sample code
I added this file to the examples directory and updated the CMakeLists.txt EXAMPLE_BINARIES set
I get the following compile error when running make
Are there other changes needed to be made to build this code ?
The text was updated successfully, but these errors were encountered: