NMEA2000 Library
0.1
Library to handle NMEA 2000 Communication written in C++
|
Go to the source code of this file.
Functions | |
static int | append2Bytes (char *s, uint16_t i) |
static int | appendByte (char *s, uint8_t byte) |
static int | appendWord (char *s, uint32_t i) |
size_t | N2kToSeasmart (const tN2kMsg &msg, uint32_t timestamp, char *buffer, size_t size) |
Converts a tN2kMsg into a $PCDIN NMEA sentence. More... | |
static uint8_t | nmea_compute_checksum (const char *sentence) |
static bool | readNHexByte (const char *s, unsigned int n, uint32_t &value) |
bool | SeasmartToN2k (const char *buffer, uint32_t ×tamp, tN2kMsg &msg) |
Converts a null terminated $PCDIN NMEA sentence into a tN2kMsg. More... | |
Variables | |
static const char * | hex = "0123456789ABCDEF" |
|
static |
Definition at line 39 of file Seasmart.cpp.
|
static |
Definition at line 33 of file Seasmart.cpp.
|
static |
Definition at line 45 of file Seasmart.cpp.
size_t N2kToSeasmart | ( | const tN2kMsg & | msg, |
uint32_t | timestamp, | ||
char * | buffer, | ||
size_t | size | ||
) |
Converts a tN2kMsg into a $PCDIN NMEA sentence.
Converts a tN2kMsg into a $PCDIN NMEA sentence, following the Seasmart specification. The buffer must be at least (30 + 2*msg.DataLen) bytes long.
[Seasmart Protocol Reference] (http://www.seasmart.net/pdf/SeaSmart_HTTP_Protocol_RevG_043012.pdf)
If the buffer is not long enough, this function returns 0 and does not do anything.
If the buffer is long enough, this function returns the number of bytes written including the terminating \0 (but this function does not add the NMEA separator \r\n).
msg | Reference to a N2kMsg Object |
timestamp | Timestamp of the message |
buffer | char array buffer for seasmart message |
size | size of the char buffer |
Definition at line 67 of file Seasmart.cpp.
|
static |
Definition at line 51 of file Seasmart.cpp.
|
static |
Definition at line 102 of file Seasmart.cpp.
bool SeasmartToN2k | ( | const char * | buffer, |
uint32_t & | timestamp, | ||
tN2kMsg & | msg | ||
) |
Converts a null terminated $PCDIN NMEA sentence into a tN2kMsg.
Converts a null terminated $PCDIN NMEA sentence into a tN2kMsg and updates timestamp with the timestamp of the sentence.
[Seasmart Protocol Reference] (http://www.seasmart.net/pdf/SeaSmart_HTTP_Protocol_RevG_043012.pdf)
The NMEA \r\n terminator is not required.
buffer | char array buffer with seasmart message |
timestamp | Timestamp of the message |
msg | Reference to a N2kMsg Object |
Definition at line 121 of file Seasmart.cpp.
|
static |
Definition at line 31 of file Seasmart.cpp.