Initial commit of files
This commit is contained in:
62
include/libgps++/ApplanixParser.h
Normal file
62
include/libgps++/ApplanixParser.h
Normal file
@ -0,0 +1,62 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __ApplanixParser__
|
||||
#define __ApplanixParser__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "netlib.h"
|
||||
|
||||
#include "GpsListener.h"
|
||||
#include "GpsParser.h"
|
||||
|
||||
#include "NmeaParser.h"
|
||||
#include "NmeaProtocol.h"
|
||||
//#include "ApplanixProtocol.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
class ApplanixParser : public NmeaParser {
|
||||
// public data
|
||||
public:
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
// data
|
||||
u_char state; // parser state
|
||||
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
ApplanixParser();
|
||||
|
||||
// destructor
|
||||
virtual ~ApplanixParser();
|
||||
|
||||
// virtual functions
|
||||
int GpsDecode( const char *buf, int max ) { return ApplanixDecode( (const u_char *)buf, max); };
|
||||
int GpsParse( const char *buf, int max ) { return ApplanixParse( buf, max ); };
|
||||
|
||||
// public methods
|
||||
int ApplanixDecode( const u_char *buf, int max );
|
||||
int ApplanixParse( const char *buf, int max );
|
||||
};
|
||||
|
||||
#endif
|
||||
56
include/libgps++/DgpsClient.h
Normal file
56
include/libgps++/DgpsClient.h
Normal file
@ -0,0 +1,56 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __DgpsClient__
|
||||
#define __DgpsClient__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include "TcpClient.h"
|
||||
#include "netlib.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
class DgpsClient : public TcpClient {
|
||||
// public data
|
||||
public:
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
unsigned long count;
|
||||
|
||||
// private methods
|
||||
|
||||
// static data
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
DgpsClient();
|
||||
|
||||
// destructor
|
||||
virtual ~DgpsClient();
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
int DgpsConnect( const char *host, const char *service );
|
||||
void DgpsClose(void) {Close();};
|
||||
|
||||
int DgpsRead( char *buf, int max );
|
||||
int DgpsWrite( const char *buf, int max );
|
||||
};
|
||||
|
||||
#endif
|
||||
73
include/libgps++/FastraxParser.h
Normal file
73
include/libgps++/FastraxParser.h
Normal file
@ -0,0 +1,73 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __FastraxParser__
|
||||
#define __FastraxParser__
|
||||
|
||||
/* 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 ******************************************************/
|
||||
|
||||
// Fastrax iTrax03
|
||||
class NmeaSentencePFST : public NmeaSentence {
|
||||
public:
|
||||
char msg[4];
|
||||
|
||||
NmeaSentencePFST();
|
||||
~NmeaSentencePFST();
|
||||
|
||||
int Decode( int argc, char *argv[] );
|
||||
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
||||
};
|
||||
|
||||
class FastraxParser : public NmeaParser {
|
||||
// public data
|
||||
public:
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
// Fastrax iTrax03
|
||||
NmeaSentencePFST PFST;
|
||||
|
||||
// private data
|
||||
private:
|
||||
// data
|
||||
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
FastraxParser();
|
||||
|
||||
// destructor
|
||||
virtual ~FastraxParser();
|
||||
|
||||
// virtual functions
|
||||
int GpsDecode( const char *buf, int max ) { return FastraxDecode( (const u_char *)buf, max); };
|
||||
int GpsParse( const char *buf, int max ) { return FastraxParse( buf, max ); };
|
||||
|
||||
// public methods
|
||||
int FastraxDecode( const u_char *buf, int max );
|
||||
int FastraxParse( const char *buf, int max );
|
||||
};
|
||||
|
||||
#endif
|
||||
125
include/libgps++/GarminParser.h
Normal file
125
include/libgps++/GarminParser.h
Normal file
@ -0,0 +1,125 @@
|
||||
//
|
||||
// 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
|
||||
52
include/libgps++/GpsDevice.h
Normal file
52
include/libgps++/GpsDevice.h
Normal file
@ -0,0 +1,52 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __GpsDevice__
|
||||
#define __GpsDevice__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include "netlib.h"
|
||||
|
||||
#include "SerialIO.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
class GpsDevice : public SerialIO {
|
||||
// public data
|
||||
public:
|
||||
// parser
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
GpsDevice();
|
||||
|
||||
// destructor
|
||||
virtual ~GpsDevice();
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
int GpsOpen( const char *dev, int baud=38400 );
|
||||
int GpsRead( char *buf, int max ) {return Read(buf,max); };
|
||||
int GpsWrite( const char *buf, int max ) {return Write(buf,max); };
|
||||
void GpsClose(void) { Close(); };
|
||||
};
|
||||
|
||||
#endif
|
||||
95
include/libgps++/GpsListener.h
Normal file
95
include/libgps++/GpsListener.h
Normal file
@ -0,0 +1,95 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __GpsListener__
|
||||
#define __GpsListener__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "netlib.h"
|
||||
|
||||
#include "GpsPoint.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
#define NMEA_MAX_SATELLITE 32
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
typedef struct _ErrorInfo {
|
||||
// GPGSA dilution of precision (DOP)
|
||||
double PositionDilution; // PDOP
|
||||
double HorizontalDilution; // HDOP
|
||||
double VerticalDilution; // VDOP
|
||||
|
||||
// GPGST standard deviation of error
|
||||
double HorizontalDeviation; // largest
|
||||
double VerticalDeviation;
|
||||
|
||||
// PUBX-01
|
||||
double HorizontalAccuracy;
|
||||
double VerticalAccuracy;
|
||||
double TimeDilution; // TDOP
|
||||
} ErrorInfo;
|
||||
|
||||
typedef struct _SatelliteInfo {
|
||||
// GPGSV, PUBX-03
|
||||
u_int Satellites;
|
||||
struct {
|
||||
char Id;
|
||||
char Status;
|
||||
double Elevation;
|
||||
double Azimuth;
|
||||
double Signal2noise;
|
||||
} Satellite[NMEA_MAX_SATELLITE];
|
||||
} SatelliteInfo;
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
class GpsListener {
|
||||
// public data
|
||||
public:
|
||||
// Position Data
|
||||
GpsPoint PosData;
|
||||
|
||||
// Accuracy, Dilution, Error
|
||||
ErrorInfo ErrInfo;
|
||||
|
||||
// Satellite info
|
||||
SatelliteInfo SatInfo;
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
|
||||
// private methods
|
||||
|
||||
// static data
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
GpsListener();
|
||||
|
||||
// destructor
|
||||
virtual ~GpsListener();
|
||||
|
||||
// virtual functions
|
||||
virtual void PositionListener( const GpsPoint &Pos, const ErrorInfo &Err );
|
||||
virtual void TimeListener( const struct timespec &Time );
|
||||
|
||||
// public methods
|
||||
int GpsTime( struct timespec *tv ) {*tv=PosData.TimeStamp;return PosData.Fix;};
|
||||
int GpsFix(void) {return PosData.Fix;};
|
||||
};
|
||||
|
||||
#endif
|
||||
81
include/libgps++/GpsMath.h
Normal file
81
include/libgps++/GpsMath.h
Normal file
@ -0,0 +1,81 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __GpsMath__
|
||||
#define __GpsMath__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include "netlib.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
// degrees <-> radians
|
||||
#define DEG2RAD(X) ((X)*M_PI/180.0)
|
||||
#define RAD2DEG(X) ((X)*180.0/M_PI)
|
||||
|
||||
// (nautical mile to km) to meters per degree
|
||||
#define MPERDEG (111.13285*1000.0)
|
||||
#define EARTHRADIUS 6378100.0 // meters
|
||||
|
||||
// speed conversions
|
||||
#define KNOTS_KPH 1.85200
|
||||
#define KNOTS_METERSPERSEC (KNOTS_KPH*1000.0/3600.0)
|
||||
|
||||
#define KPH2MSEC(X) ((X)*0.277777778)
|
||||
#define MSEC2KPH(X) ((X)/0.277777778)
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
// GpsLinux because it depennds on GPSd, the HAMLIB and NMEAP libraries
|
||||
//
|
||||
class GpsMath {
|
||||
// public data
|
||||
public:
|
||||
|
||||
// parser
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
// static data
|
||||
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
GpsMath();
|
||||
|
||||
// destructor
|
||||
virtual ~GpsMath();
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
|
||||
// static methods
|
||||
static double Minutes2Degrees(char *value, char *side = NULL);
|
||||
static void Degrees2Minutes(double deg, char *buf, int max, bool lat);
|
||||
static timespec String2Time(const char *hhmmss, const char *ddmmyy);
|
||||
|
||||
static double Bearing( double lat1, double lon1, double lat2, double lon2 );
|
||||
static double Distance( double lat1, double lon1, double lat2, double lon2 );
|
||||
static double DistanceX( double lat1, double lon1, double lat2, double lon2 );
|
||||
static double DistanceY( double lat1, double lon1, double lat2, double lon2 );
|
||||
static double DistanceXY(double lat1, double lon1, double lat2, double lon2, double &x, double &y );
|
||||
static double Travel( double *lat, double *lon, double *ele, double x, double y, double z);
|
||||
};
|
||||
|
||||
#endif
|
||||
93
include/libgps++/GpsParser.h
Normal file
93
include/libgps++/GpsParser.h
Normal file
@ -0,0 +1,93 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __GpsParser__
|
||||
#define __GpsParser__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "netlib.h"
|
||||
|
||||
#include "GpsListener.h"
|
||||
#include "NmeaProtocol.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
class GpsParser : public NmeaProtocol {
|
||||
// public data
|
||||
public:
|
||||
char Vendor[32];
|
||||
char Product[32];
|
||||
|
||||
// Position Data
|
||||
GpsPoint PosData;
|
||||
|
||||
// Accuracy, Dilution, Error
|
||||
ErrorInfo ErrInfo;
|
||||
|
||||
// Satellite info
|
||||
SatelliteInfo SatInfo;
|
||||
|
||||
protected:
|
||||
// protected data
|
||||
std::vector<GpsListener *> GpsListeners;
|
||||
|
||||
// incoming data buffer
|
||||
u_char data[2048];
|
||||
u_char lastc;
|
||||
u_short numbytes; // current byte count
|
||||
u_short totbytes; // expect byte count
|
||||
u_short checksum;
|
||||
u_long counter; // # parsed
|
||||
|
||||
// private data
|
||||
private:
|
||||
// private methods
|
||||
|
||||
// static data
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
GpsParser();
|
||||
|
||||
// destructor
|
||||
virtual ~GpsParser();
|
||||
|
||||
// virtual functions
|
||||
virtual void GpsInit( void ) {};
|
||||
virtual int GpsDecode( const char *buf, int max );
|
||||
virtual int GpsParse( const char *buf, int max );
|
||||
|
||||
// public methods
|
||||
|
||||
// subscribe/unsubscribe
|
||||
void Subscribe( GpsListener *ear ) {
|
||||
GpsInit();
|
||||
if (ear)
|
||||
GpsListeners.push_back(ear);
|
||||
};
|
||||
|
||||
int GetNumParsed(void) {return counter;};
|
||||
|
||||
// misc
|
||||
int GpsTime( struct timespec *tv ) {*tv=PosData.TimeStamp;return PosData.Fix;};
|
||||
int GpsFix(void) {return PosData.Fix;};
|
||||
int Gps2Vii( char *buf, int max );
|
||||
|
||||
// static functions
|
||||
};
|
||||
|
||||
#endif
|
||||
123
include/libgps++/GpsPoint.h
Normal file
123
include/libgps++/GpsPoint.h
Normal file
@ -0,0 +1,123 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __GpsPoint__
|
||||
#define __GpsPoint__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include "GpsMath.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
// Gps Point on the planet
|
||||
//
|
||||
class GpsPoint : public GpsMath {
|
||||
// public data
|
||||
public:
|
||||
timespec TimeStamp;
|
||||
double Latitude;
|
||||
double Longitude;
|
||||
double Altitude;
|
||||
double Speed; // m/sec
|
||||
double Heading; // deg
|
||||
|
||||
// fix information (GpsListener) for point
|
||||
int Fix; // GPGGA
|
||||
int Mode; // GPGSA
|
||||
int Type; // GPGSA
|
||||
double Accel; // m/sec2
|
||||
double Yaw; // deg/sec (-left, +right)
|
||||
|
||||
// parser
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
// static data
|
||||
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
GpsPoint();
|
||||
GpsPoint( double lat, double lon );
|
||||
GpsPoint(const GpsPoint ©);
|
||||
|
||||
// destructor
|
||||
virtual ~GpsPoint();
|
||||
|
||||
// operators
|
||||
GpsPoint &operator=(const GpsPoint &rhs);
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
double GetLatitude(void) {return Latitude;};
|
||||
double GetLongitude(void) {return Longitude;};
|
||||
double GetAltitude(void) {return Altitude;};
|
||||
double GetElevation(void) {return Altitude;};
|
||||
void GetPosition( double *lat, double *lon, double *elev=NULL );
|
||||
double GetSpeed(void) {return Speed;};
|
||||
double GetHeading(void) {return Heading;};
|
||||
timespec GetTimeVal(void) {return TimeStamp;};
|
||||
uint64_t GetTimeStamp(void) {return (TimeStamp.tv_sec*1000L)+(TimeStamp.tv_nsec/1000000L);};
|
||||
time_t GetTimeStampSec(void) {return TimeStamp.tv_sec;};
|
||||
|
||||
void SetLatitude(double lat) {Latitude = lat;};
|
||||
void SetLongitude(double lon) {Longitude = lon;};
|
||||
void SetAltitude(double alt) {Altitude = alt;};
|
||||
void SetElevation(double ele) {Altitude = ele;};
|
||||
void SetPosition(double lat, double lon, double ele = 0.0)
|
||||
{Latitude=lat;Longitude=lon;Altitude=ele;};
|
||||
void SetSpeed(double spd) {Speed = spd;}; // kph
|
||||
void SetHeading(double hdg) {Heading = hdg;};
|
||||
void SetTimeStamp(timespec &tv) {TimeStamp=tv;};
|
||||
void SetTimeStamp(time_t t) {TimeStamp.tv_sec=t;TimeStamp.tv_nsec=0;};
|
||||
void SetTimeStamp(uint64_t t);
|
||||
void SetTimeStamp(double t);
|
||||
void SetTimeStamp(const char *str);
|
||||
|
||||
void AddMeters( double x, double y ); // add meters
|
||||
void Extrapolate( double speed, double accel, double yaw, double time );
|
||||
|
||||
double Bearing( const GpsPoint &gpt ); // bearing to point
|
||||
double Distance( const GpsPoint &gpt ); // distance to point
|
||||
double Distance( double lat, double lon );
|
||||
double Travel( double x, double y, double z );
|
||||
|
||||
double DistanceX( const GpsPoint &gpt )
|
||||
{ return GpsMath::DistanceX(Latitude, Longitude, gpt.Latitude, gpt.Longitude); };
|
||||
double DistanceY( const GpsPoint &gpt )
|
||||
{ return GpsMath::DistanceY(Latitude, Longitude, gpt.Latitude, gpt.Longitude); };
|
||||
double DistanceX(double lat, double lon)
|
||||
{ return GpsMath::DistanceX(Latitude, Longitude, Latitude, lon); };
|
||||
double DistanceY(double lat, double lon)
|
||||
{ return GpsMath::DistanceY(Latitude, Longitude, lat, Longitude); };
|
||||
double DistanceX(double lon)
|
||||
{ return GpsMath::DistanceX(Latitude, Longitude, Latitude, lon); };
|
||||
double DistanceY(double lat)
|
||||
{ return GpsMath::DistanceY(Latitude, Longitude, lat, Longitude); };
|
||||
|
||||
double DistanceXY( const GpsPoint &gpt1, const GpsPoint &gpt2, double &x, double &y );
|
||||
double DistanceXY( const GpsPoint &gpt1, double lat, double lon, double &x, double &y );
|
||||
|
||||
bool Inside( const GpsPoint polygon[], int num );
|
||||
bool Traversed( GpsPoint &gpt, const GpsPoint polygon[], int num );
|
||||
|
||||
// static methods
|
||||
};
|
||||
|
||||
#endif
|
||||
70
include/libgps++/GpsTrack.h
Normal file
70
include/libgps++/GpsTrack.h
Normal file
@ -0,0 +1,70 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __GpsTrack__
|
||||
#define __GpsTrack__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "GpsPoint.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
typedef std::vector<GpsPoint> GpsTrack_t;
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
// GpsLinux because it depennds on GPSd, the HAMLIB and NMEAP libraries
|
||||
//
|
||||
class GpsTrack {
|
||||
// public data
|
||||
public:
|
||||
char Name[64];
|
||||
GpsTrack_t Points;
|
||||
|
||||
// parser
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
// static data
|
||||
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
GpsTrack();
|
||||
GpsTrack(const char *name);
|
||||
GpsTrack(const GpsTrack ©);
|
||||
|
||||
// destructor
|
||||
virtual ~GpsTrack();
|
||||
|
||||
// operators
|
||||
GpsTrack &operator=(const GpsTrack &rhs);
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
void SetName( const char *name ) { strncpy(Name,name,sizeof(Name)-1); };
|
||||
int AddPoint( const GpsPoint &Pt );
|
||||
|
||||
int GenerateKML( const char *kmlfile );
|
||||
int ParseKML( const char *kmlfile );
|
||||
|
||||
// static methods
|
||||
};
|
||||
|
||||
#endif
|
||||
70
include/libgps++/GpsdClient.h
Normal file
70
include/libgps++/GpsdClient.h
Normal file
@ -0,0 +1,70 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __GpsdClient__
|
||||
#define __GpsdClient__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include "TcpClient.h"
|
||||
#include "netlib.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
// Connect to http://gpsd.berlios.de/ GPSD
|
||||
//
|
||||
class GpsdClient : public TcpClient {
|
||||
// public data
|
||||
public:
|
||||
int Fix;
|
||||
int Satellites;
|
||||
|
||||
struct timespec Time;
|
||||
double Latitude;
|
||||
double Longitude;
|
||||
double Elevation;
|
||||
double Heading;
|
||||
double Speed;
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
|
||||
// static data
|
||||
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
GpsdClient();
|
||||
GpsdClient( const char *host );
|
||||
|
||||
// destructor
|
||||
virtual ~GpsdClient();
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
int GpsdParse( char *msg );
|
||||
int GpsdConnect( const char *host = "localhost" );
|
||||
|
||||
int GpsdRead( void );
|
||||
int GpsdWrite( const char *msg, int max );
|
||||
|
||||
int Gpsd2Vii( char *buf, int max );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
73
include/libgps++/KmlFile.h
Normal file
73
include/libgps++/KmlFile.h
Normal file
@ -0,0 +1,73 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __KmlFile__
|
||||
#define __KmlFile__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#include "netlib.h"
|
||||
|
||||
#include "GpsTrack.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
// GpsLinux because it depennds on GPSd, the HAMLIB and NMEAP libraries
|
||||
//
|
||||
class KmlFile {
|
||||
// public data
|
||||
public:
|
||||
xmlDocPtr xmlDoc;
|
||||
xmlNodePtr xmlRoot;
|
||||
|
||||
// folders we're interested in
|
||||
xmlNodePtr xmlRoutes;
|
||||
xmlNodePtr xmlTracks;
|
||||
xmlNodePtr xmlWaypoints;
|
||||
|
||||
// parser
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
FILE *fileKml;
|
||||
|
||||
// private data
|
||||
private:
|
||||
// static data
|
||||
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
KmlFile();
|
||||
|
||||
// destructor
|
||||
virtual ~KmlFile();
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
int Open( const char *file );
|
||||
void Close( void );
|
||||
int Create( const char *file );
|
||||
|
||||
GpsTrack *GetTracks(void);
|
||||
|
||||
// static methods
|
||||
static time_t ParseTime( const char *time );
|
||||
};
|
||||
|
||||
#endif
|
||||
86
include/libgps++/NmeaParser.h
Normal file
86
include/libgps++/NmeaParser.h
Normal file
@ -0,0 +1,86 @@
|
||||
//
|
||||
// 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
|
||||
50
include/libgps++/NmeaProtocol.h
Normal file
50
include/libgps++/NmeaProtocol.h
Normal file
@ -0,0 +1,50 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __NmeaProtocol__
|
||||
#define __NmeaProtocol__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include "netlib.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
// GpsLinux because it depennds on GPSd, the HAMLIB and NMEAP libraries
|
||||
//
|
||||
class NmeaProtocol {
|
||||
// public data
|
||||
public:
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
NmeaProtocol();
|
||||
|
||||
// destructor
|
||||
virtual ~NmeaProtocol();
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
static int NmeaChecksum( char *msg, int len, int max = 0 );
|
||||
};
|
||||
|
||||
#endif
|
||||
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
|
||||
65
include/libgps++/NtripClient.h
Normal file
65
include/libgps++/NtripClient.h
Normal file
@ -0,0 +1,65 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __NtripClient__
|
||||
#define __NtripClient__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include "TcpClient.h"
|
||||
#include "netlib.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
// GpsLinux because it depennds on GPSd, the HAMLIB and NMEAP libraries
|
||||
//
|
||||
class NtripClient : public TcpClient {
|
||||
// public data
|
||||
public:
|
||||
char Uri[1024];
|
||||
|
||||
protected:
|
||||
unsigned long count;
|
||||
|
||||
// private data
|
||||
private:
|
||||
|
||||
// private methods
|
||||
|
||||
// static data
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
NtripClient();
|
||||
|
||||
// destructor
|
||||
virtual ~NtripClient();
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
int NtripConnect( const char *host, const char *service,
|
||||
const char *user = "anonymous", const char *pass = "",
|
||||
const char *path = "" );
|
||||
int NtripConnect( const char *uri );
|
||||
int NtripReconnect( void ) {return NtripConnect( Uri ); };
|
||||
void NtripClose(void) {Close();};
|
||||
|
||||
int NtripRead( unsigned char *buf, int max );
|
||||
int NtripWrite( const unsigned char *buf, int max )
|
||||
{return TcpClient::Send((const char *)buf,max);};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
62
include/libgps++/RtcmDevice.h
Normal file
62
include/libgps++/RtcmDevice.h
Normal file
@ -0,0 +1,62 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __RtcmDevice__
|
||||
#define __RtcmDevice__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include "TcpClient.h"
|
||||
#include "netlib.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
class RtcmDevice {
|
||||
// public data
|
||||
public:
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
int SerialFd; // serial port
|
||||
|
||||
// private data
|
||||
private:
|
||||
|
||||
// private methods
|
||||
int SerialOpen( const char *dev, int baud );
|
||||
int SerialRead( char *buf, int max );
|
||||
void SerialClose( void );
|
||||
|
||||
// static data
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
RtcmDevice();
|
||||
|
||||
// destructor
|
||||
virtual ~RtcmDevice();
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
int GetFd(void) {return SerialFd;};
|
||||
|
||||
int RtcmOpen( const char *dev, int baud ) {return SerialOpen(dev,baud); };
|
||||
void RtcmClose(void) {SerialClose();};
|
||||
|
||||
int RtcmRead( char *buf, int max );
|
||||
int RtcmWrite( const char *buf, int max );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
62
include/libgps++/SirfParser.h
Normal file
62
include/libgps++/SirfParser.h
Normal file
@ -0,0 +1,62 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __SirfParser__
|
||||
#define __SirfParser__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "netlib.h"
|
||||
|
||||
#include "GpsListener.h"
|
||||
#include "GpsParser.h"
|
||||
|
||||
#include "NmeaParser.h"
|
||||
#include "NmeaProtocol.h"
|
||||
#include "SirfProtocol.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
class SirfParser : public NmeaParser, public SirfProtocol {
|
||||
// public data
|
||||
public:
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
// data
|
||||
u_char state; // parser state
|
||||
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
SirfParser();
|
||||
|
||||
// destructor
|
||||
virtual ~SirfParser();
|
||||
|
||||
// virtual functions
|
||||
int GpsDecode( const char *buf, int max ) { return SirfDecode( (const u_char *)buf, max); };
|
||||
int GpsParse( const char *buf, int max ) { return SirfParse( buf, max ); };
|
||||
|
||||
// public methods
|
||||
int SirfDecode( const u_char *buf, int max );
|
||||
int SirfParse( const char *buf, int max );
|
||||
};
|
||||
|
||||
#endif
|
||||
53
include/libgps++/SirfProtocol.h
Normal file
53
include/libgps++/SirfProtocol.h
Normal file
@ -0,0 +1,53 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __SirfProtocol__
|
||||
#define __SirfProtocol__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include "netlib.h"
|
||||
|
||||
#include "NmeaProtocol.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
//
|
||||
// GpsLinux because it depennds on GPSd, the HAMLIB and NMEAP libraries
|
||||
//
|
||||
class SirfProtocol {
|
||||
// public data
|
||||
public:
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
SirfProtocol();
|
||||
|
||||
// destructor
|
||||
virtual ~SirfProtocol();
|
||||
|
||||
// virtual functions
|
||||
|
||||
// public methods
|
||||
static void SirfChecksum( unsigned char *buf, int len );
|
||||
static void SirfBinary2Nmea( int baud, unsigned char *buf, int max );
|
||||
};
|
||||
|
||||
#endif
|
||||
111
include/libgps++/UbloxParser.h
Normal file
111
include/libgps++/UbloxParser.h
Normal file
@ -0,0 +1,111 @@
|
||||
//
|
||||
// Linux GPS
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __UbloxParser__
|
||||
#define __UbloxParser__
|
||||
|
||||
/* 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 ******************************************************/
|
||||
|
||||
class NmeaSentencePUBX : public NmeaSentence {
|
||||
public:
|
||||
int id;
|
||||
timespec utctime;
|
||||
// 00
|
||||
double latitude;
|
||||
double longitude;
|
||||
double altitude_ref;
|
||||
char navstat[4];
|
||||
double horizontal_accuracy;
|
||||
double vertical_accuracy;
|
||||
double speed;
|
||||
double course;
|
||||
double vvel;
|
||||
double agec;
|
||||
double horizontal_dilution;
|
||||
double vertical_dilution;
|
||||
double time_dilution;
|
||||
int gps;
|
||||
int glonass;
|
||||
int dead_reckoning;
|
||||
|
||||
// 01
|
||||
|
||||
// 03
|
||||
int satellites;
|
||||
struct {
|
||||
int prn;
|
||||
char status;
|
||||
double azimuth;
|
||||
double elevation;
|
||||
int signal2noise;
|
||||
int locktime;
|
||||
} satellite[NMEA_MAX_SATELLITE];
|
||||
|
||||
// 04
|
||||
double utc_tow;
|
||||
int week;
|
||||
int clk_b;
|
||||
double clk_d;
|
||||
int granularity;
|
||||
|
||||
NmeaSentencePUBX();
|
||||
~NmeaSentencePUBX();
|
||||
|
||||
int Decode( int argc, char *argv[] );
|
||||
void Update( GpsPoint &PosData, ErrorInfo &ErrInfo, SatelliteInfo &SatInfo );
|
||||
};
|
||||
|
||||
class UbloxParser : public NmeaParser {
|
||||
// public data
|
||||
public:
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
// u-Blox
|
||||
NmeaSentencePUBX PUBX;
|
||||
|
||||
// private data
|
||||
private:
|
||||
// data
|
||||
u_char state; // parser state
|
||||
|
||||
// private methods
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
UbloxParser();
|
||||
|
||||
// destructor
|
||||
virtual ~UbloxParser();
|
||||
|
||||
// virtual functions
|
||||
int GpsDecode( const char *buf, int max ) { return UbloxDecode( (const u_char *)buf, max); };
|
||||
int GpsParse( const char *buf, int max ) { return UbloxParse( buf, max ); };
|
||||
|
||||
// public methods
|
||||
int UbloxDecode( const u_char *buf, int max );
|
||||
int UbloxParse( const char *buf, int max );
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user