Copernicus  1.0
An Arduino module for the Trimble Copernicus GPS receiver
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Groups
gpstype.h
Go to the documentation of this file.
1 /*
2  * File: gpstype.h
3  * Author: tbabb
4  *
5  * Created on October 7, 2013, 11:04 PM
6  */
7 
8 #ifndef GPSTYPE_H
9 #define GPSTYPE_H
10 
11 #include <stdint.h>
12 #include <float.h>
13 
14 class CopernicusGPS; // fwd decl
15 
26 /***************************
27  * enums *
28  ***************************/
29 
30 enum CommandID {
32 };
33 
34 enum ReportType {
36  RPT_ERROR = -1,
38  RPT_NONE = 0x00,
39 
40  // position/velocity fixes
41 
54 
55  // other auto-reports
56 
58  RPT_GPSTIME = 0x41,
60  RPT_HEALTH = 0x46,
66  RPT_SBAS_MODE = 0x82,
67 
68  // replies
69 
72 };
73 
74 enum GPSHealth {
76  HLTH_UNKNOWN = 0xFF,
95 };
96 
106 };
107 
108 enum AltMode {
110  ALT_HAE = 0x00,
112  ALT_MSL = 0x01,
114  ALT_NOCHANGE = 0xFF,
115 };
116 
117 enum PPSMode {
119  PPS_ALWAYS = 0x00,
121  PPS_FIX = 0x20,
123  PPS_OFF = 0x40,
125  PPS_NOCHANGE = 0x60,
126 };
127 
130  TME_GPSTIME = 0x00,
132  TME_UTCTIME = 0x01,
135 };
136 
137 /***************************
138  * storage types *
139  ***************************/
140 
141 // many/most arduino chipsets do not support 64 bit floats,
142 // but we still need to be able to store the bits of a 64-bit float somehow.
143 
144 union Float32 {
146  uint32_t bits;
147 #if FLT_MANT_DIG == 24 || defined(PARSING_DOXYGEN)
148 
153  float f;
154 #elif DBL_MANT_DIG == 24
155  double f;
156 #endif
157 };
158 
159 union Float64 {
161  uint64_t bits;
162 #if DBL_MANT_DIG == 53 || defined(PARSING_DOXYGEN)
163 
169  double d;
170 #elif LDBL_MANT_DIG == 53
171  long double d;
172 #endif
173 };
174 
175 /***************************
176  * datapoints *
177  ***************************/
178 
179 // all angles are in radians.
180 // fix times are -1 if the fix is not valid.
181 
182 template <typename T>
183 struct LLA_Fix {
184  T lat;
185  T lng;
186  T alt;
187  T bias;
189 };
190 
191 template <typename T>
192 struct XYZ_Fix {
193  T x;
194  T y;
195  T z;
196  T bias;
198 };
199 
200 struct XYZ_VFix {
206 };
207 
208 struct ENU_VFix {
214 };
215 
241 struct PosFix {
242 
245 
246  PosFix();
247 
248  const LLA_Fix<Float32> *getLLA_32() const;
249  const LLA_Fix<Float64> *getLLA_64() const;
250  const XYZ_Fix<Float32> *getXYZ_32() const;
251  const XYZ_Fix<Float64> *getXYZ_64() const;
252 
253 protected:
254 
255  union {
260  };
261 
262  friend class CopernicusGPS;
263 };
264 
289 struct VelFix {
292 
293  VelFix();
294 
295  const XYZ_VFix *getXYZ() const;
296  const ENU_VFix *getENU() const;
297 
298 protected:
299 
300  union {
303  };
304 
305  friend class CopernicusGPS;
306 };
307 
308 struct GPSTime {
310  int16_t week_no;
312 };
313 
314 struct GPSStatus {
315  GPSStatus();
316 
317  GPSHealth health; // pkt 0x46
318  int n_satellites; // pkt 0x6d
319  bool almanac_incomplete; // pkt 0x4b
320  bool rtclock_unavailable; // pkt 0x4b
321  bool sbas_enabled; // pkt 0x82
322  bool sbas_corrected; // pkt 0x82
323 };
324 
326 
327 #endif /* GPSTYPE_H */
328