87 lines
1.9 KiB
C++
87 lines
1.9 KiB
C++
//
|
|
// Linux GPS
|
|
//
|
|
// NMEA Parser code stolen from Pascal Martin's RoadMap
|
|
//
|
|
|
|
/* prevent multiple inclusions */
|
|
#ifndef __NmeaParser__
|
|
#define __NmeaParser__
|
|
|
|
/* includes *****************************************************************/
|
|
|
|
#include <vector>
|
|
|
|
#include "netlib.h"
|
|
|
|
#include "GpsListener.h"
|
|
#include "GpsParser.h"
|
|
|
|
#include "NmeaProtocol.h"
|
|
#include "NmeaSentence.h"
|
|
|
|
/* defines ******************************************************************/
|
|
|
|
/* macros *******************************************************************/
|
|
|
|
/* structs & typedefs *******************************************************/
|
|
|
|
/* c class definitions ******************************************************/
|
|
|
|
//
|
|
class NmeaParser : public GpsParser {
|
|
// public data
|
|
public:
|
|
|
|
protected:
|
|
// private data
|
|
std::vector<NmeaSentence *> NmeaSentences;
|
|
|
|
// Standard
|
|
NmeaSentenceGPRMC GPRMC;
|
|
NmeaSentenceGPVTG GPVTG;
|
|
NmeaSentenceGPGGA GPGGA;
|
|
NmeaSentenceGPGSA GPGSA;
|
|
NmeaSentenceGPGSV GPGSV;
|
|
NmeaSentenceGPGLL GPGLL;
|
|
NmeaSentenceGPGST GPGST;
|
|
NmeaSentenceGPZDA GPZDA;
|
|
|
|
// private data
|
|
private:
|
|
// incoming data buffer
|
|
|
|
// NMEA record for notification
|
|
char posfixnmea[8];
|
|
char timefixnmea[8];
|
|
|
|
// private methods
|
|
|
|
// static data
|
|
|
|
// public methods
|
|
public:
|
|
// constructors
|
|
NmeaParser();
|
|
|
|
// destructor
|
|
virtual ~NmeaParser();
|
|
|
|
// virtual functions
|
|
int GpsDecode( const char *buf, int max ) { return NmeaDecode( buf, max ); };
|
|
int GpsParse( const char *buf, int max ) { return NmeaParse( buf, max ); };
|
|
|
|
// public methods
|
|
int NmeaDecode( const char *msg, int max );
|
|
int NmeaParse( const char *msg, int max );
|
|
|
|
// misc
|
|
void NmeaPosFix( const char *str )
|
|
{ strncpy(posfixnmea,str,sizeof(posfixnmea)-1);};
|
|
|
|
// static functions
|
|
static int CsvSplit( char *buf, char *field[], int max );
|
|
};
|
|
|
|
#endif
|