opendroneid / opendroneid-core-c

Open Drone ID Core C Library
Apache License 2.0
178 stars 64 forks source link

int odid_message_process_pack #91

Closed Greg-C10 closed 3 months ago

Greg-C10 commented 3 months ago

wifi.c implements odid_message_process_pack from opendroneid.h.

It does not return 0 on success. It is returning size.

from opendroneid.h:

int odid_message_process_pack(ODID_UAS_Data UAS_Data, uint8_t pack, size_t buflen);

/* odid_wifi_receive_message_pack_nan_action_frame - processes a received message pack

Implementation in wifi.c:

int odid_message_process_pack(ODID_UAS_Data UAS_Data, uint8_t pack, size_t buflen) { ODID_MessagePack_encoded msg_pack_enc = (ODID_MessagePack_encoded ) pack; size_t size = sizeof(msg_pack_enc) - ODID_MESSAGE_SIZE (ODID_PACK_MAX_MESSAGES - msg_pack_enc->MsgPackSize); if (size > buflen) return -ENOMEM;

odid_initUasData(UAS_Data);

if (decodeMessagePack(UAS_Data, msg_pack_enc) != ODID_SUCCESS)
    return -1;

return (int) size;

}

gabrielcox commented 3 months ago

Fixed on this commit .