MBot Software Library
v1.0
An API documentation to mbot_firmware repository
|
Functions | |
void | comms_listener_loop (void) |
Main loop for the communication listener. More... | |
int | read_header (uint8_t *header_data) |
Read the header data from the communication interface. More... | |
int | validate_header (uint8_t *header_data) |
Validate the integrity of the header data. More... | |
int | read_message (uint8_t *header_data, uint8_t *msg_data_serialized, uint16_t message_len, char *topic_msg_data_checksum) |
Read a message from the communication interface. More... | |
int | validate_message (uint8_t *header_data, uint8_t *msg_data_serialized, uint16_t message_len, char topic_msg_data_checksum) |
Validate the integrity of the message data. More... | |
void comms_listener_loop | ( | void | ) |
Main loop for the communication listener.
This function continuously reads and validates headers and messages from the communication interface. If the header and message are valid, it processes the message and calls the appropriate callback function.
int read_header | ( | uint8_t * | header_data | ) |
Read the header data from the communication interface.
header_data | Pointer to the array where the header data will be stored. |
int read_message | ( | uint8_t * | header_data, |
uint8_t * | msg_data_serialized, | ||
uint16_t | message_len, | ||
char * | topic_msg_data_checksum | ||
) |
Read a message from the communication interface.
header_data | Pointer to the array containing the header data. |
msg_data_serialized | Pointer to the array where the serialized message data will be stored. |
message_len | Length of the message to read, as specified in the header data. |
topic_msg_data_checksum | Pointer to a char where the checksum of the message data will be stored. |
int validate_header | ( | uint8_t * | header_data | ) |
Validate the integrity of the header data.
header_data | Pointer to the array containing the header data to validate. |
int validate_message | ( | uint8_t * | header_data, |
uint8_t * | msg_data_serialized, | ||
uint16_t | message_len, | ||
char | topic_msg_data_checksum | ||
) |
Validate the integrity of the message data.
header_data | Pointer to the array containing the header data. |
msg_data_serialized | Pointer to the array containing the serialized message data. |
message_len | Length of the message, as specified in the header data. |
topic_msg_data_checksum | Checksum of the message data. |