#include <ArNMEAParser.h>
Parses NMEA input data and calls callbacks for certain messages with message parts. NMEA is a standard output data protocol used by GPS devices and others (e.g. compass, altimiter, etc.) This class is used internally by ArNMEAParser and subclasses, and by ArTCMCompassDirect.
Public Types | |
enum | { ParseFinished = 1, ParseError = 2, ParseData = 4, ParseUpdated = 8 } |
Flags to indicates what the parse() method did. i.e. If nothing was done, then the result will be 0. To check a parse() return result result to see if data was updated, use (result & ParseUpdated). To check if there was an error, use (result & ParseError). More... | |
typedef ArFunctor1< ArNMEAParser::Message > | Handler |
typedef std::map< std::string, ArNMEAParser::Handler * > | HandlerMap |
typedef std::vector< std::string > | MessageVector |
Public Member Functions | |
void | addHandler (const char *message, ArNMEAParser::Handler *handler) |
ArNMEAParser (const char *name="NMEA Parser") | |
const ArNMEAParser::HandlerMap & | getHandlersRef () const |
int | parse (const char *buf, int n) |
int | parse (ArDeviceConnection *dev) |
void | removeHandler (const char *message) |
void | setIgnoreChecksum (bool ignore) |
Set whether checksum is ignored (default behavior is not to ignore it, and skip messages with incorrect checksums, and log a warning mesage). | |
Public Attributes | |
enum ArNMEAParser:: { ... } | ParseFlags |
Flags to indicates what the parse() method did. i.e. If nothing was done, then the result will be 0. To check a parse() return result result to see if data was updated, use (result & ParseUpdated). To check if there was an error, use (result & ParseError). | |
Classes | |
struct | Message |
NMEA message handler type.
typedef std::vector<std::string> ArNMEAParser::MessageVector |
NMEA message, divided into parts.
anonymous enum |
Flags to indicates what the parse() method did. i.e. If nothing was done, then the result will be 0. To check a parse() return result result to see if data was updated, use (result & ParseUpdated). To check if there was an error, use (result & ParseError).
ArNMEAParser::ArNMEAParser | ( | const char * | name = "NMEA Parser" |
) |
name | Used in log messages |
void ArNMEAParser::addHandler | ( | const char * | message, | |
ArNMEAParser::Handler * | handler | |||
) |
Set a handler for an NMEA message. Mostly for internal use or to be used by related classes, but you could use for ususual or custom messages emitted by a device that you wish to be handled outside of the ArNMEAParser class.