126 lines
2.8 KiB
C++
126 lines
2.8 KiB
C++
//
|
|
// Linux GPS
|
|
//
|
|
|
|
/* prevent multiple inclusions */
|
|
#ifndef __GarminParser__
|
|
#define __GarminParser__
|
|
|
|
/* includes *****************************************************************/
|
|
|
|
#include <vector>
|
|
|
|
#include "netlib.h"
|
|
|
|
#include "GpsListener.h"
|
|
#include "GpsParser.h"
|
|
|
|
#include "NmeaParser.h"
|
|
#include "NmeaProtocol.h"
|
|
|
|
/* defines ******************************************************************/
|
|
|
|
/* macros *******************************************************************/
|
|
|
|
/* structs & typedefs *******************************************************/
|
|
|
|
/* c class definitions ******************************************************/
|
|
|
|
|
|
// Garmin
|
|
class NmeaSentencePGRME : public NmeaSentence {
|
|
public:
|
|
float horizontal;
|
|
char horizontal_unit[4];
|
|
float vertical;
|
|
char vertical_unit[4];
|
|
float three_dimensions;
|
|
char three_dimensions_unit[4];
|
|
|
|
NmeaSentencePGRME();
|
|
~NmeaSentencePGRME();
|
|
|
|
int Decode( int argc, char *argv[] );
|
|
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
|
};
|
|
|
|
class NmeaSentencePGRMF : public NmeaSentence {
|
|
public:
|
|
int week;
|
|
int seconds;
|
|
struct timespec utctime;
|
|
int leap;
|
|
double latitude;
|
|
double longitude;
|
|
char mode;
|
|
int type;
|
|
double speed;
|
|
double course;
|
|
double position_dilution;
|
|
double time_dilution;
|
|
|
|
NmeaSentencePGRMF();
|
|
~NmeaSentencePGRMF();
|
|
|
|
int Decode( int argc, char *argv[] );
|
|
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
|
};
|
|
|
|
class NmeaSentencePGRMM : public NmeaSentence {
|
|
public:
|
|
char datum[256];
|
|
|
|
NmeaSentencePGRMM();
|
|
~NmeaSentencePGRMM();
|
|
|
|
int Decode( int argc, char *argv[] );
|
|
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
|
};
|
|
|
|
class NmeaSentencePGRMZ : public NmeaSentence {
|
|
public:
|
|
|
|
NmeaSentencePGRMZ();
|
|
~NmeaSentencePGRMZ();
|
|
|
|
int Decode( int argc, char *argv[] );
|
|
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
|
};
|
|
|
|
// main class
|
|
class GarminParser : public NmeaParser {
|
|
// public data
|
|
public:
|
|
|
|
// protected data
|
|
protected:
|
|
// Garmin
|
|
NmeaSentencePGRME PGRME;
|
|
NmeaSentencePGRMF PGRMF;
|
|
NmeaSentencePGRMM PGRMM;
|
|
|
|
// private data
|
|
private:
|
|
// data
|
|
|
|
// private methods
|
|
|
|
// public methods
|
|
public:
|
|
// constructors
|
|
GarminParser();
|
|
|
|
// destructor
|
|
virtual ~GarminParser();
|
|
|
|
// virtual functions
|
|
int GpsDecode( const char *buf, int max ) { return GarminDecode( (const u_char *)buf, max); };
|
|
int GpsParse( const char *buf, int max ) { return GarminParse( buf, max ); };
|
|
|
|
// public methods
|
|
int GarminDecode( const u_char *buf, int max );
|
|
int GarminParse( const char *buf, int max );
|
|
};
|
|
|
|
#endif
|