TinyRobotics
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
NMEAParser Class Reference

Parses NMEA sentences from GPS modules and extracts GPS data. More...

#include <NMEAParser.h>

Public Member Functions

 NMEAParser (GPSFormat fmt)
 
bool parse (const char *sentence, GPSCoordinate &gps) const
 
bool parse (const std::string &sentence, GPSCoordinate &gps) const
 

Protected Member Functions

bool parseGGA (const std::string &sentence, GPSCoordinate &gps) const
 
bool parseRMC (const std::string &sentence, GPSCoordinate &gps) const
 
std::vector< std::string > split (const std::string &str, char delim)
 

Static Protected Member Functions

static bool safe_stof (const std::string &s, float &out)
 
static bool safe_stoi (const std::string &s, int &out)
 

Protected Attributes

GPSFormat format
 

Detailed Description

Parses NMEA sentences from GPS modules and extracts GPS data.

The NMEAParser class supports parsing of common NMEA sentences such as GGA (fix data) and RMC (recommended minimum), converting them into structured GPSCoordinate objects.

Features:

Example usage:

NMEAParser parser(GPSFormat::GGA);
if
(parser.parse("$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47",
gps)) {
// gps now contains parsed data
}
Represents a geodetic GPS coordinate with latitude, longitude, and optional altitude.
Definition: GPSCoordinate.h:52
Parses NMEA sentences from GPS modules and extracts GPS data.
Definition: NMEAParser.h:47

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