Initial commit of files
This commit is contained in:
197
include/libgps++/NmeaSentence.h
Normal file
197
include/libgps++/NmeaSentence.h
Normal file
@ -0,0 +1,197 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
// NMEA Parser code stolen from Pascal Martin's RoadMap
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __NmeaSentence__
|
||||
#define __NmeaSentence__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "GpsMath.h"
|
||||
#include "GpsListener.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
#define NMEA_MAX_SATELLITE 32
|
||||
|
||||
#define NMEA_FIX_INVALID 0
|
||||
#define NMEA_FIX_NOFIX 0
|
||||
#define NMEA_FIX_GPS 1
|
||||
#define NMEA_FIX_DGPS 2
|
||||
#define NMEA_FIX_PPS 3
|
||||
#define NMEA_FIX_RTK_FIXED 4
|
||||
#define NMEA_FIX_RTK_FLOAT 5
|
||||
#define NMEA_FIX_DEAD_RECKONING 6
|
||||
#define NMEA_FIX_MANUAL 7
|
||||
#define NMEA_FIX_SIMULATION 8
|
||||
|
||||
#define NMEA_MODE_AUTOMATIC 'A'
|
||||
#define NMEA_MODE_DIFFERENTIAL 'D'
|
||||
#define NMEA_MODE_ESTIMATED 'E' // dead reckoning
|
||||
#define NMEA_MODE_MANUAL 'M'
|
||||
#define NMEA_MODE_SIMULATED 'S'
|
||||
#define NMEA_MODE_INVALID 'N'
|
||||
|
||||
#define NMEA_TYPE_INVALID 0
|
||||
#define NMEA_TYPE_NOFIX 1
|
||||
#define NMEA_TYPE_2D 2
|
||||
#define NMEA_TYPE_3D 3
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
#define DecodeCoordinate(A,B) GpsMath::Minutes2Degrees(A,B)
|
||||
#define DecodeTime(A,B) GpsMath::String2Time(A,B)
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
class NmeaSentence {
|
||||
public:
|
||||
char name[8];
|
||||
char argc;
|
||||
char parsed; // just parsed flag
|
||||
u_long counter;
|
||||
timespec timestamp;
|
||||
|
||||
NmeaSentence();
|
||||
virtual ~NmeaSentence();
|
||||
|
||||
virtual int Decode( int argc, char *argv[] );
|
||||
virtual void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
||||
};
|
||||
|
||||
class NmeaSentenceGPGGA : public NmeaSentence {
|
||||
public:
|
||||
timespec fixtime;
|
||||
double latitude; // decimal degrees
|
||||
double longitude;
|
||||
int quality;
|
||||
int satellites;
|
||||
float horizontal_dilution;
|
||||
double altitude; // meters
|
||||
double geoid;
|
||||
|
||||
NmeaSentenceGPGGA();
|
||||
~NmeaSentenceGPGGA();
|
||||
|
||||
int Decode( int argc, char *argv[] );
|
||||
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
||||
};
|
||||
|
||||
class NmeaSentenceGPGLL : public NmeaSentence {
|
||||
public:
|
||||
double latitude;
|
||||
double longitude;
|
||||
timespec utctime;
|
||||
char status;
|
||||
char mode;
|
||||
|
||||
NmeaSentenceGPGLL();
|
||||
~NmeaSentenceGPGLL();
|
||||
|
||||
int Decode( int argc, char *argv[] );
|
||||
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
||||
};
|
||||
|
||||
class NmeaSentenceGPGSA : public NmeaSentence {
|
||||
public:
|
||||
char mode;
|
||||
char type;
|
||||
char satellite[NMEA_MAX_SATELLITE];
|
||||
float position_dilution;
|
||||
float horizontal_dilution;
|
||||
float vertical_dilution;
|
||||
|
||||
NmeaSentenceGPGSA();
|
||||
~NmeaSentenceGPGSA();
|
||||
|
||||
int Decode( int argc, char *argv[] );
|
||||
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
||||
};
|
||||
|
||||
class NmeaSentenceGPGST : public NmeaSentence {
|
||||
public:
|
||||
timespec utctime;
|
||||
// standard deviation of error
|
||||
float rms_deviation;
|
||||
float semimajor_deviation;
|
||||
float semiminor_deviation;
|
||||
float semimajor_orientation;
|
||||
float latitude_deviation;
|
||||
float longitude_deviation;
|
||||
float altitude_deviation;
|
||||
|
||||
NmeaSentenceGPGST();
|
||||
~NmeaSentenceGPGST();
|
||||
|
||||
int Decode( int argc, char *argv[] );
|
||||
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
||||
};
|
||||
|
||||
class NmeaSentenceGPGSV : public NmeaSentence {
|
||||
public:
|
||||
char total;
|
||||
char sequence;
|
||||
char satellites;
|
||||
struct {
|
||||
char id;
|
||||
char elevation;
|
||||
short azimuth;
|
||||
short signal2noise;
|
||||
} satellite[NMEA_MAX_SATELLITE];
|
||||
|
||||
NmeaSentenceGPGSV();
|
||||
~NmeaSentenceGPGSV();
|
||||
|
||||
int Decode( int argc, char *argv[] );
|
||||
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
||||
};
|
||||
|
||||
class NmeaSentenceGPRMC : public NmeaSentence {
|
||||
public:
|
||||
timespec utctime;
|
||||
char status;
|
||||
double latitude;
|
||||
double longitude;
|
||||
double speed; // convert knots to kph
|
||||
double course;
|
||||
double variation;
|
||||
|
||||
NmeaSentenceGPRMC();
|
||||
~NmeaSentenceGPRMC();
|
||||
|
||||
int Decode( int argc, char *argv[] );
|
||||
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
||||
};
|
||||
|
||||
class NmeaSentenceGPVTG : public NmeaSentence {
|
||||
public:
|
||||
double course;
|
||||
double speed;
|
||||
char mode;
|
||||
|
||||
NmeaSentenceGPVTG();
|
||||
~NmeaSentenceGPVTG();
|
||||
|
||||
int Decode( int argc, char *argv[] );
|
||||
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
||||
};
|
||||
|
||||
class NmeaSentenceGPZDA : public NmeaSentence {
|
||||
public:
|
||||
timespec utctime;
|
||||
|
||||
NmeaSentenceGPZDA();
|
||||
~NmeaSentenceGPZDA();
|
||||
|
||||
int Decode( int argc, char *argv[] );
|
||||
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user