SELKIELogger
1.0.0
|
Modules | |
NMEA Message support functions | |
Files | |
file | NMEAMessages.h |
file | NMEASerial.h |
file | NMEATypes.h |
Classes | |
struct | nmea_msg_t |
Generic NMEA message structure. More... | |
Macros | |
#define | NMEA_SERIAL_BUFF 1024 |
Default serial buffer allocation size. | |
#define | NMEA_START_BYTE1 0x24 |
NMEA0183 Start Byte 1. | |
#define | NMEA_START_BYTE2 0x21 |
NMEA Start Byte 2. | |
#define | NMEA_CSUM_MARK 0x2a |
NMEA Checksum Delimiter. | |
#define | NMEA_END_BYTE1 0x0d |
NMEA End Byte 1: Carriage Return. | |
#define | NMEA_END_BYTE2 0x0a |
NMEA End Byte 1: Line Feed. | |
Functions | |
int | nmea_openConnection (const char *port, const int baudRate) |
Set up a connection to the specified port. More... | |
void | nmea_closeConnection (int handle) |
Close existing connection. More... | |
bool | nmea_readMessage (int handle, nmea_msg_t *out) |
Static wrapper around mp_readMessage_buf. More... | |
bool | nmea_readMessage_buf (int handle, nmea_msg_t *out, uint8_t buf[NMEA_SERIAL_BUFF], int *index, int *hw) |
Read data from handle, and parse message if able. More... | |
bool | nmea_writeMessage (int handle, const nmea_msg_t *out) |
Send message to attached device. More... | |
void nmea_closeConnection | ( | int | handle | ) |
Close existing connection.
Currently just closes the file descriptor passed as handle
[in] | handle | File descriptor opened with nmea_openConnection() |
Definition at line 52 of file NMEASerial.c.
int nmea_openConnection | ( | const char * | port, |
const int | baudRate | ||
) |
Set up a connection to the specified port.
Currently just wraps openSerialConnection()
[in] | port | Target character device (i.e. Serial port) |
[in] | baudRate | Target baud rate |
Definition at line 43 of file NMEASerial.c.
bool nmea_readMessage | ( | int | handle, |
nmea_msg_t * | out | ||
) |
Static wrapper around mp_readMessage_buf.
For single threaded development and testing, uses static variables rather than requiring state to be tracked by caller.
See nmea_readMessage_buf() for full description.
[in] | handle | File descriptor from nmea_openConnection() |
[out] | out | Pointer to message structure to fill with data |
Definition at line 66 of file NMEASerial.c.
bool nmea_readMessage_buf | ( | int | handle, |
nmea_msg_t * | out, | ||
uint8_t | buf[NMEA_SERIAL_BUFF], | ||
int * | index, | ||
int * | hw | ||
) |
Read data from handle, and parse message if able.
Pulls data from handle
and stores it in buf
, tracking the current search position in index
and the current fill level/buffer high water mark in hw
If a valid message is found then it is written to the structure provided as a parameter and the function returns true.
If a message cannot be read, the function returns false and the first byte of the raw array is set to an error value:
[in] | handle | File descriptor from nmea_openConnection() |
[out] | out | Pointer to message structure to fill with data |
[in,out] | buf | Serial data buffer |
[in,out] | index | Current search position within buf |
[in,out] | hw | End of current valid data in buf |
Definition at line 98 of file NMEASerial.c.
bool nmea_writeMessage | ( | int | handle, |
const nmea_msg_t * | out | ||
) |
Send message to attached device.
Takes a message, validates the checksum and writes it out to the device or file connected to handle
.
[in] | handle | File descriptor from nmea_openConnection() |
[in] | out | Pointer to message structure to be sent. |
handle
Definition at line 318 of file NMEASerial.c.