NMEA2000 Library  0.1
Library to handle NMEA 2000 Communication written in C++
Seasmart.h File Reference

Conversion functions between N2k and Seasmart. More...

#include <N2kMsg.h>
Include dependency graph for Seasmart.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

size_t N2kToSeasmart (const tN2kMsg &msg, uint32_t timestamp, char *buffer, size_t size)
 Converts a tN2kMsg into a $PCDIN NMEA sentence. More...
 
bool SeasmartToN2k (const char *buffer, uint32_t &timestamp, tN2kMsg &msg)
 Converts a null terminated $PCDIN NMEA sentence into a tN2kMsg. More...
 

Detailed Description

Conversion functions between N2k and Seasmart.

Definition in file Seasmart.h.

Function Documentation

◆ N2kToSeasmart()

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).

Parameters
msgReference to a N2kMsg Object
timestampTimestamp of the message
bufferchar array buffer for seasmart message
sizesize of the char buffer
Returns
size_t

Definition at line 67 of file Seasmart.cpp.

◆ SeasmartToN2k()

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.

Parameters
bufferchar array buffer with seasmart message
timestampTimestamp of the message
msgReference to a N2kMsg Object
Returns
true -> Success
false -> an error occurred

Definition at line 121 of file Seasmart.cpp.