Receives and parses NMEA0183 GPS streams into C strings.
More...
#include <gpsparser.h>
|
bool | Start (const int rx_pin, const int tx_pin, const int baud) |
| Create the parser and launch a new cog. More...
|
|
| ~GPSParser () |
| Stop the GPS parsing, and the cog that was started. More...
|
|
char * | Get () |
| Gets a NMEA string. More...
|
|
char * | Get (char string[], const int maxBytes=kNmeaMaxLength) |
| Same as Get(), but with the option of specifying a buffer to use instead of the internal buffer. More...
|
|
Receives and parses NMEA0183 GPS streams into C strings.
Requires 1 cog to operate.
- Warning
- The PGTOP sentences (if any) can't have any "$" characters in them. The parsing would treat that as a new NMEA string. While technically not correct, it's a bit easier to implement.
- Author
- SRLM (srlm@.nosp@m.srlm.nosp@m.produ.nosp@m.ctio.nosp@m.ns.co.nosp@m.m)
GPSParser::~GPSParser |
( |
) | |
|
|
inline |
Stop the GPS parsing, and the cog that was started.
Gets a NMEA string.
Note that the returned string address is valid (will not be overwritten) until the next time GetStr() is called.
The returned string includes all characters from the GPS except for the and
(<CR><LF>) at the end.
Partial sentences may be thrown away (if a sentence is not being currently recorded).
Ignores the PGTOP type sentence.
- Returns
- NULL pointer if no string, null terminated string otherwise
char* GPSParser::Get |
( |
char |
string[], |
|
|
const int |
maxBytes = kNmeaMaxLength |
|
) |
| |
|
inline |
Same as Get(), but with the option of specifying a buffer to use instead of the internal buffer.
- Warning
- If you want to switch between buffers, you must not switch until immediately after gps.Get(s) != NULL (ie, right after it returns a string). Otherwise, part of the string will be stored in one buffer, and part of the string will be stored in the other.
- Parameters
-
string | The buffer to use. Must be at least 85 characters long (the NMEA string length). |
maxBytes | The maximum number of bytes to record in this string. Defaults to maximum NMEA sentence length. |
- Returns
- NULL pointer if no string, null terminated string otherwise (in buffer s).
bool GPSParser::Start |
( |
const int |
rx_pin, |
|
|
const int |
tx_pin, |
|
|
const int |
baud |
|
) |
| |
|
inline |
Create the parser and launch a new cog.
- Parameters
-
rx_pin | the serial pin to receive data from the GPS. |
tx_pin | the pin to transmit data to the GPS. If not used, set to -1. |
baud | the baud rate to use for tranmission and receiving. |
The documentation for this class was generated from the following file: