NMEAParser
NMEA Parser Library - Monte Variakojis @VisualGPS
|
This class will parse NMEA data packet and call its virtual processor methods. More...
#include <NMEAParserPacket.h>
Public Member Functions | |
CNMEAParserPacket () | |
~CNMEAParserPacket () | |
CNMEAParserData::ERROR_E | ProcessNMEABuffer (char *pData, size_t nBufferSize) |
Parses pData for NMEA data. More... | |
void | Reset (void) |
Reset the parser. More... | |
virtual void | OnError (CNMEAParserData::ERROR_E nError, char *pCmd) |
This method is called whenever there is a parsing error. More... | |
Protected Member Functions | |
virtual CNMEAParserData::ERROR_E | ProcessRxCommand (char *pCmd, char *pData)=0 |
Redefine this method to process valid NMEA commands. Make sure that you honer the parameters below. More... | |
virtual void | TimeTag (void) |
This method is called when receiving the start of message of the NMEA packet. More... | |
Private Types | |
enum | PARSE_STATE { PARSE_STATE_SOM = 0, PARSE_STATE_CMD, PARSE_STATE_DATA, PARSE_STATE_CHECKSUM_1, PARSE_STATE_CHECKSUM_2 } |
Private Attributes | |
PARSE_STATE | m_nState |
Current NMEA parse state. More... | |
uint8_t | m_u8Checksum |
Calculated NMEA sentence checksum. More... | |
uint8_t | m_u8ReceivedChecksum |
Received NMEA sentence checksum (if exists) More... | |
uint16_t | m_nIndex |
Index used for command and data. More... | |
char | m_pCommand [CNMEAParserData::c_uMaxCmdLen] |
NMEA command. More... | |
char | m_pData [CNMEAParserData::c_uMaxDataLen] |
NMEA data. More... | |
This class will parse NMEA data packet and call its virtual processor methods.
Below describes the ProcessNMEABuffer() methods state machine. It's whole goal is to connect data, build a command and call ProcessRxCommand robustly.
Definition at line 66 of file NMEAParserPacket.h.
|
private |
Definition at line 70 of file NMEAParserPacket.h.
CNMEAParserPacket::CNMEAParserPacket | ( | ) |
Definition at line 28 of file NMEAParserPacket.cpp.
CNMEAParserPacket::~CNMEAParserPacket | ( | ) |
Definition at line 37 of file NMEAParserPacket.cpp.
|
inlinevirtual |
This method is called whenever there is a parsing error.
Redefine this method to capture errors.
pCmd | Pointer to NMEA command that caused the error. Please note that this parameter may be NULL of not completely defined. Use with caution. |
Definition at line 116 of file NMEAParserPacket.h.
CNMEAParserData::ERROR_E CNMEAParserPacket::ProcessNMEABuffer | ( | char * | pData, |
size_t | nBufferSize | ||
) |
Parses pData for NMEA data.
This method will parse pData for NMEA data.
pData | Pointer to buffer to parse |
nBufferSize | Number of bytes in pData to process. |
Definition at line 41 of file NMEAParserPacket.cpp.
|
protectedpure virtual |
Redefine this method to process valid NMEA commands. Make sure that you honer the parameters below.
pCmd | Pointer to the NMEA command string |
pData | Comma separated data that belongs to the command |
Implemented in CNMEAParser.
void CNMEAParserPacket::Reset | ( | void | ) |
Reset the parser.
A reset will restart the parser to start to look for the start of message.
Definition at line 170 of file NMEAParserPacket.cpp.
|
inlineprotectedvirtual |
This method is called when receiving the start of message of the NMEA packet.
If you need to time tag your NMEA sentences, redefine this method to allow you to capture when the SOM was received. You can then use the ProcessRxCommand() method to capture the NMEA command that this time-tag belongs to.
Definition at line 137 of file NMEAParserPacket.h.
|
private |
Index used for command and data.
Definition at line 83 of file NMEAParserPacket.h.
|
private |
Current NMEA parse state.
Definition at line 80 of file NMEAParserPacket.h.
|
private |
NMEA command.
Definition at line 84 of file NMEAParserPacket.h.
|
private |
NMEA data.
Definition at line 85 of file NMEAParserPacket.h.
|
private |
Calculated NMEA sentence checksum.
Definition at line 81 of file NMEAParserPacket.h.
|
private |
Received NMEA sentence checksum (if exists)
Definition at line 82 of file NMEAParserPacket.h.