|
SELKIELogger
1.0.0
|


Go to the source code of this file.
Macros | |
| #define | N2K_BUFF 1024 |
| Default serial buffer allocation size. | |
Functions | |
| int | n2k_openConnection (const char *device, const int baud) |
| Open connection to an N2K serial device. More... | |
| void | n2k_closeConnection (int handle) |
| Close N2K serial connection. More... | |
| bool | n2k_act_readMessage (int handle, n2k_act_message *out) |
| Static wrapper around n2k_readMessage_buf. More... | |
| bool | n2k_act_readMessage_buf (int handle, n2k_act_message *out, uint8_t buf[N2K_BUFF], size_t *index, size_t *hw) |
| Read data from handle, and parse message if able. More... | |
N2K connection handling
Definition in file N2KConnection.h.
| bool n2k_act_readMessage | ( | int | handle, |
| n2k_act_message * | out | ||
| ) |
Static wrapper around n2k_readMessage_buf.
For single threaded development and testing, uses static variables rather than requiring state to be tracked by caller.
See n2k_act_readMessage_buf() for full description.
| [in] | handle | File descriptor from n2k_openConnection() |
| [out] | out | Pointer to message structure to fill with data |
Definition at line 61 of file N2KConnection.c.
| bool n2k_act_readMessage_buf | ( | int | handle, |
| n2k_act_message * | out, | ||
| uint8_t | buf[N2K_BUFF], | ||
| size_t * | index, | ||
| size_t * | 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
| [in] | handle | File descriptor from n2k_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 85 of file N2KConnection.c.
| void n2k_closeConnection | ( | int | handle | ) |
Close N2K serial connection.
| [in] | handle | File handle from n2k_openConnection() |
Definition at line 46 of file N2KConnection.c.
| int n2k_openConnection | ( | const char * | device, |
| const int | baud | ||
| ) |
Open connection to an N2K serial device.
Delegates to openSerialConnection() to open the serial device.
| [in] | device | Path to device to open |
| [in] | baud | Baud rate to connect with (as integer) |
Definition at line 38 of file N2KConnection.c.