libpropeller
Making PropellerGCC Easier
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
Public Member Functions | Protected Attributes | List of all members
GPSParser Class Reference

Receives and parses NMEA0183 GPS streams into C strings. More...

#include <gpsparser.h>

Inheritance diagram for GPSParser:
Inheritance graph
[legend]
Collaboration diagram for GPSParser:
Collaboration graph
[legend]

Public Member Functions

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

Protected Attributes

Serial gps_serial_
 

Detailed Description

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)

Constructor & Destructor Documentation

GPSParser::~GPSParser ( )
inline

Stop the GPS parsing, and the cog that was started.

Here is the call graph for this function:

Member Function Documentation

char* GPSParser::Get ( )
inline

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
stringThe buffer to use. Must be at least 85 characters long (the NMEA string length).
maxBytesThe 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).

Here is the call graph for this function:

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_pinthe serial pin to receive data from the GPS.
tx_pinthe pin to transmit data to the GPS. If not used, set to -1.
baudthe baud rate to use for tranmission and receiving.

Here is the call graph for this function:

Member Data Documentation

Serial GPSParser::gps_serial_
protected

The documentation for this class was generated from the following file: