-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGPSParserSentences.h
195 lines (155 loc) · 5.57 KB
/
GPSParserSentences.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
////////////////////////////////////////////////////////////
// Author: Jon Bennett ([email protected]) http://jondbennett.com
//
// GPS Parser sentence objects
////////////////////////////////////////////////////////////
#ifndef GPSPARSER_SENTENCES
#define GPSPARSER_SENTENCES
// Sentence types
typedef enum GPSSentenceE
{
GPSSentence_T_Unknown = 0,
#if (GPSParser_INCLUDE_GPGGA)
GPSSentence_T_GPGGA, // Global Positioning System Fix Data
#endif
#if (GPSParser_INCLUDE_GPRMC)
GPSSentence_T_GPRMC, // Recommended minimum specific GPS/Transit data
#endif
#if (GPSParser_INCLUDE_GPGSA)
GPSSentence_T_GPGSA, // GPS DOP and active satellites
#endif
#if (GPSParser_INCLUDE_GPGSV)
GPSSentence_T_GPGSV, // GPS Satellites in view
#endif
#if (GPSParser_INCLUDE_GPVTG)
GPSSentence_T_GPVTG, // Track Made Good and Ground Speed.
#endif
} GPSSentence_T;
// Data structure used to accumulate data
// as sentences are parsed
typedef union GPSSentenceData_U
{
#if (GPSParser_INCLUDE_GPGGA)
struct
{
double m_utc; // hhmmss.ss = UTC of position
double m_lat; // ddmm.mmmm = latitude of position
bool m_north; // a = N or S
double m_lon; // dddmm.mmmm = Longitude of position
bool m_east; // a = E or W
int m_fixQuality; // x = GPS Quality indicator (0=no fix, 1=GPS fix, 2=Dif. GPS fix)
int m_nSats; // xx = number of satellites in use
double m_hDOP; // x.x = horizontal dilution of precision
double m_altitude; // x.x = Antenna altitude above mean-sea-level
double m_heightAboveWGS84; // x.x = WGS84 geoidal separation
int m_timeSinceLastDGPSUpdate; // x.x = Age of Differential GPS data (seconds)
int m_dgpsStationID; // xxxx = Differential reference station ID
} GPGGA;
#endif
#if (GPSParser_INCLUDE_GPRMC)
struct
{
double m_utc; // hhmmss.ss = UTC of position
bool m_valid; // validity - A-ok, V-invalid
double m_lat; // ddmm.mmmm = latitude of position
bool m_north; // a = N or S
double m_lon; // dddmm.mmmm = Longitude of position
bool m_east; // a = E or W
double m_speedKnots; // x.x = Speed over ground in knots
double m_trackTrue; // x.x = Track made good in degrees True
long m_date; // DDMMYY - Date of fix Year = YY
double m_magDecl; // Magnetic declination from true North
bool m_magDeclEast; // Magnet declination is East (true) or West (false)
} GPRMC;
#endif
#if (GPSParser_INCLUDE_GPGSA)
struct
{
int m_modeMA; // 0 = manual, 1 = automatic (auto select of 2D or 3D)
int m_fixType; // 1 = no fix, 2 = 2D, 3 = 3D
int m_satIDs[GPS_MAX_SATS]; // IDs of sats used for fix
double m_pDOP;
double m_hDOP;
double m_vDOP;
} GPGSA;
#endif
#if (GPSParser_INCLUDE_GPGSV)
struct
{
int m_totalMessages; // Typically 3
int m_messageNumber; // Could be 1,2, or 3
int m_totalSatsInView; // Could be as high as 12
int m_PRN_1; // Sat ID number
int m_elevation_1; // Elevation in degrees
int m_azimuth_1; // Azimuth (direction) in degrees (True)
int m_SNR_1; // Signal quality (0-99) or null when not tracking
int m_PRN_2; // Sat ID number
int m_elevation_2; // Elevation in degrees
int m_azimuth_2; // Azimuth (direction) in degrees (True)
int m_SNR_2; // Signal quality (0-99) or null when not tracking
int m_PRN_3; // Sat ID number
int m_elevation_3; // Elevation in degrees
int m_azimuth_3; // Azimuth (direction) in degrees (True)
int m_SNR_3; // Signal quality (0-99) or null when not tracking
int m_PRN_4; // Sat ID number
int m_elevation_4; // Elevation in degrees
int m_azimuth_4; // Azimuth (direction) in degrees (True)
int m_SNR_4; // Signal quality (0-99) or null when not tracking
} GPGSV;
#endif
#if (GPSParser_INCLUDE_GPVTG)
struct
{
double m_trackTrue; // x.x = Track made good in degrees True
double m_trackMag; // Track (magnetic)
double m_speedKnots; // x.x = Speed over ground in knots
double m_speedKPH; // x.x = Speed over ground in kph
} GPVTG;
#endif
} GPSSentenceData_T;
#if GPSParser_INCLUDE_GPGGA
class CGPSSentence_GPGGA
{
public:
static void init(GPSSentenceData_T &_sentenceData);
static bool processTerm(const char _term[], int _termNumber, GPSSentenceData_T &_sentenceData);
static void transferData(CGPSParserData &_gpsParserData, GPSSentenceData_T &_sentenceData);
};
#endif
#if (GPSParser_INCLUDE_GPRMC)
class CGPSSentence_GPRMC
{
public:
static void init(GPSSentenceData_T &_sentenceData);
static bool processTerm(const char _term[], int _termNumber, GPSSentenceData_T &_sentenceData);
static void transferData(CGPSParserData &_gpsParserData, GPSSentenceData_T &_sentenceData);
};
#endif
#if (GPSParser_INCLUDE_GPGSA)
class CGPSSentence_GPGSA
{
public:
static void init(GPSSentenceData_T &_sentenceData);
static bool processTerm(const char _term[], int _termNumber, GPSSentenceData_T &_sentenceData);
static void transferData(CGPSParserData &_gpsParserData, GPSSentenceData_T &_sentenceData);
};
#endif
#if (GPSParser_INCLUDE_GPGSV)
class CGPSSentence_GPGSV
{
public:
static void init(GPSSentenceData_T &_sentenceData);
static bool processTerm(const char _term[], int _termNumber, GPSSentenceData_T &_sentenceData);
static void transferData(CGPSParserData &_gpsParserData, GPSSentenceData_T &_sentenceData);
};
#endif
#if (GPSParser_INCLUDE_GPVTG)
class CGPSSentence_GPVTG
{
public:
static void init(GPSSentenceData_T &_sentenceData);
static bool processTerm(const char _term[], int _termNumber, GPSSentenceData_T &_sentenceData);
static void transferData(CGPSParserData &_gpsParserData, GPSSentenceData_T &_sentenceData);
};
#endif
#endif