Aria  2.8.0
ArNMEAParser Class Reference

NMEA Parser. More...

#include <ArNMEAParser.h>

Classes

struct  Message
 Message data passed to handlers. More...
 

Public Types

enum  { ParseFinished = 1, ParseError = 2, ParseData = 4, ParseUpdated = 8 }
 Flags to indicates what the parse() method did. More...
 
typedef ArFunctor1< ArNMEAParser::MessageHandler
 NMEA message handler type. More...
 
typedef std::map< std::string, ArNMEAParser::Handler * > HandlerMap
 
typedef std::vector< std::string > MessageVector
 NMEA message, divided into parts. More...
 

Public Member Functions

void addHandler (const char *message, ArNMEAParser::Handler *handler)
 Set a handler for an NMEA message. More...
 
 ArNMEAParser (const char *name="NMEA Parser")
 
const ArNMEAParser::HandlerMap & getHandlersRef () const
 
int parse (ArDeviceConnection *dev)
 
int parse (const char *buf, int n)
 
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. More...
 

Detailed Description

NMEA Parser.

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.

Member Typedef Documentation

◆ Handler

NMEA message handler type.

◆ MessageVector

typedef std::vector<std::string> ArNMEAParser::MessageVector

NMEA message, divided into parts.

Member Enumeration Documentation

◆ anonymous enum

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

Enumerator
ParseFinished 

There was no data to parse.

ParseError 

There was an error.

ParseData 

Input was recieved and stored, but no complete messages were parsed.

ParseUpdated 

At least one complete message was parsed.

Constructor & Destructor Documentation

◆ ArNMEAParser()

ArNMEAParser::ArNMEAParser ( const char *  name = "NMEA Parser")
Parameters
nameUsed in log messages

Member Function Documentation

◆ addHandler()

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.

Member Data Documentation

◆ ParseFlags

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


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