SELKIELogger
1.0.0
|
Functions | |
void | nmea_calc_checksum (const nmea_msg_t *msg, uint8_t *cs) |
Calculate checksum for NMEA message. More... | |
void | nmea_set_checksum (nmea_msg_t *msg) |
Set checksum bytes for NMEA message. More... | |
bool | nmea_check_checksum (const nmea_msg_t *msg) |
Verify checksum bytes of NMEA message. More... | |
size_t | nmea_message_length (const nmea_msg_t *msg) |
Calculate number of bytes required to represent message. More... | |
size_t | nmea_flat_array (const nmea_msg_t *msg, char **out) |
Convert NMEA message to array of bytes for transmission. More... | |
char * | nmea_string_hex (const nmea_msg_t *msg) |
Return NMEA message as string. More... | |
void | nmea_print_hex (const nmea_msg_t *msg) |
Print NMEA message. More... | |
strarray * | nmea_parse_fields (const nmea_msg_t *nmsg) |
Parse raw data into fields. More... | |
struct tm * | nmea_parse_zda (const nmea_msg_t *msg) |
Get date/time from NMEA ZDA message. More... | |
Convert and verify NMEA protocol messages
void nmea_calc_checksum | ( | const nmea_msg_t * | msg, |
uint8_t * | cs | ||
) |
Calculate checksum for NMEA message.
Calculates the checksum for an NMEA0183 style message
[in] | msg | Input message |
[out] | cs | Checksum byte |
Definition at line 37 of file NMEAMessages.c.
bool nmea_check_checksum | ( | const nmea_msg_t * | msg | ) |
Verify checksum bytes of NMEA message.
Calculates checksum with nmea_calc_checksum() and compares to checksumstored in the provided message.
[in] | msg | Input message |
Definition at line 85 of file NMEAMessages.c.
size_t nmea_flat_array | ( | const nmea_msg_t * | msg, |
char ** | out | ||
) |
Convert NMEA message to array of bytes for transmission.
Allocates a new array of bytes and copies message into array in transmission order (e.g. out[0] to be sent first). Note that this will include a trailing CRLF pair!
Output array must be freed by caller.
[in] | msg | Input message |
[out] | out | Base address of output array |
Definition at line 127 of file NMEAMessages.c.
size_t nmea_message_length | ( | const nmea_msg_t * | msg | ) |
Calculate number of bytes required to represent message.
Calculate the number of bytes/characters required to represent or transmit an NMEA message
[in] | msg | Pointer to NMEA message structure |
Definition at line 99 of file NMEAMessages.c.
strarray* nmea_parse_fields | ( | const nmea_msg_t * | nmsg | ) |
Parse raw data into fields.
Parses fields from raw into a string array
[in] | nmsg | Pointer to NMEA message |
Definition at line 203 of file NMEAMessages.c.
struct tm* nmea_parse_zda | ( | const nmea_msg_t * | msg | ) |
Get date/time from NMEA ZDA message.
Converts time encoded in message to a libc struct tm representation
Caller to free returned structure
[in] | msg | Input message |
Definition at line 240 of file NMEAMessages.c.
void nmea_print_hex | ( | const nmea_msg_t * | msg | ) |
Print NMEA message.
Primarily for debug purposes. Will print string generated by nmea_string_hex() to stdout.
[in] | *msg | Input message |
Definition at line 188 of file NMEAMessages.c.
void nmea_set_checksum | ( | nmea_msg_t * | msg | ) |
Set checksum bytes for NMEA message.
Simple wrapper around nmea_calc_checksum() to update the checksum bytes within the structure.
[in,out] | msg | Message to update |
Definition at line 74 of file NMEAMessages.c.
char* nmea_string_hex | ( | const nmea_msg_t * | msg | ) |
Return NMEA message as string.
Allocates a character array and fills with hexadecimal character pairs representing the message content.
As we're dealing with ASCII anyway, this just wraps nmea_flat_array and adds a null terminator
Character array must be freed by caller.
[in] | msg | Input message |
Definition at line 174 of file NMEAMessages.c.