sbgECom  1.11.920-stable
sbgEComBinaryLogGps.h
Go to the documentation of this file.
1 
20 #ifndef __SBG_ECOM_BINARY_LOG_GPS_H__
21 #define __SBG_ECOM_BINARY_LOG_GPS_H__
22 
23 #include <sbgCommon.h>
24 #include <streamBuffer/sbgStreamBuffer.h>
25 
26 //----------------------------------------------------------------------//
27 //- Log GPS velocity const definitions -//
28 //----------------------------------------------------------------------//
29 
33 #define SBG_ECOM_GPS_VEL_STATUS_SHIFT (0u)
34 #define SBG_ECOM_GPS_VEL_STATUS_MASK (0x0000003Fu)
35 #define SBG_ECOM_GPS_VEL_TYPE_SHIFT (6u)
36 #define SBG_ECOM_GPS_VEL_TYPE_MASK (0x0000003Fu)
38 //----------------------------------------------------------------------//
39 //- Log GPS position const definitions -//
40 //----------------------------------------------------------------------//
41 
45 #define SBG_ECOM_GPS_POS_STATUS_SHIFT (0u)
46 #define SBG_ECOM_GPS_POS_STATUS_MASK (0x0000003Fu)
47 #define SBG_ECOM_GPS_POS_TYPE_SHIFT (6u)
48 #define SBG_ECOM_GPS_POS_TYPE_MASK (0x0000003Fu)
53 #define SBG_ECOM_GPS_POS_GPS_L1_USED (0x00000001u << 12)
54 #define SBG_ECOM_GPS_POS_GPS_L2_USED (0x00000001u << 13)
55 #define SBG_ECOM_GPS_POS_GPS_L5_USED (0x00000001u << 14)
56 #define SBG_ECOM_GPS_POS_GLO_L1_USED (0x00000001u << 15)
57 #define SBG_ECOM_GPS_POS_GLO_L2_USED (0x00000001u << 16)
59 //----------------------------------------------------------------------//
60 //- Log GPS HDT const definitions -//
61 //----------------------------------------------------------------------//
62 
66 #define SBG_ECOM_GPS_HDT_STATUS_SHIFT (0u)
67 #define SBG_ECOM_GPS_HDT_STATUS_MASK (0x0000003Fu)
72 #define SBG_ECOM_GPS_HDT_BASELINE_VALID (0x0001 << 6)
74 //----------------------------------------------------------------------//
75 //- Log GPS RAW const definitions -//
76 //----------------------------------------------------------------------//
77 
78 #define SBG_ECOM_GPS_RAW_MAX_BUFFER_SIZE (4086u)
80 //----------------------------------------------------------------------//
81 //- Log GPS velocity enums definitions -//
82 //----------------------------------------------------------------------//
83 
88 {
94 
98 typedef enum _SbgEComGpsVelType
99 {
105 
106 //----------------------------------------------------------------------//
107 //- Log GPS position enums definitions -//
108 //----------------------------------------------------------------------//
109 
114 {
120 
124 typedef enum _SbgEComGpsPosType
125 {
138 
139 //----------------------------------------------------------------------//
140 //- Log GPS HDT enums definitions -//
141 //----------------------------------------------------------------------//
142 
147 {
153 
154 //----------------------------------------------------------------------//
155 //- Helpers methods for velocity status access -//
156 //----------------------------------------------------------------------//
157 
164 {
166 }
167 
173 SBG_INLINE SbgEComGpsVelType sbgEComLogGpsVelGetType(uint32_t status)
174 {
176 }
177 
185 {
186  //
187  // Create the combined status field
188  //
189  return ((((uint32_t)status)&SBG_ECOM_GPS_VEL_STATUS_MASK) << SBG_ECOM_GPS_VEL_STATUS_SHIFT) |
191 }
192 
193 //----------------------------------------------------------------------//
194 //- Helpers methods for position status access -//
195 //----------------------------------------------------------------------//
196 
203 {
205 }
206 
212 SBG_INLINE SbgEComGpsPosType sbgEComLogGpsPosGetType(uint32_t status)
213 {
215 }
216 
224 SBG_INLINE uint32_t sbgEComLogGpsPosBuildStatus(SbgEComGpsPosStatus status, SbgEComGpsPosType type, uint32_t masks)
225 {
226  //
227  // Create the combined status field
228  //
229  return ((((uint32_t)status)&SBG_ECOM_GPS_POS_STATUS_MASK) << SBG_ECOM_GPS_POS_STATUS_SHIFT) |
230  ((((uint32_t)type)&SBG_ECOM_GPS_POS_TYPE_MASK) << SBG_ECOM_GPS_POS_TYPE_SHIFT) | masks;
231 }
232 
233 //----------------------------------------------------------------------//
234 //- Helpers methods for HDT status access -//
235 //----------------------------------------------------------------------//
236 
243 {
245 }
246 
253 SBG_INLINE uint32_t sbgEComLogGpsHdtBuildStatus(SbgEComGpsHdtStatus status, uint32_t masks)
254 {
255  //
256  // Create the combined status field
257  //
258  return ((((uint32_t)status)&SBG_ECOM_GPS_HDT_STATUS_MASK) << SBG_ECOM_GPS_HDT_STATUS_SHIFT) | masks;
259 }
260 
261 //----------------------------------------------------------------------//
262 //- Log structure definitions -//
263 //----------------------------------------------------------------------//
264 
268 typedef struct _SbgLogGpsVel
269 {
270  uint32_t timeStamp;
271  uint32_t status;
272  uint32_t timeOfWeek;
273  float velocity[3];
274  float velocityAcc[3];
275  float course;
276  float courseAcc;
277 } SbgLogGpsVel;
278 
282 typedef struct _SbgLogGpsPos
283 {
284  uint32_t timeStamp;
285  uint32_t status;
286  uint32_t timeOfWeek;
287  double latitude;
288  double longitude;
289  double altitude;
290  float undulation;
294  uint8_t numSvUsed;
295  uint16_t baseStationId;
296  uint16_t differentialAge;
297 } SbgLogGpsPos;
298 
302 typedef struct _SbgLogGpsHdt
303 {
304  uint32_t timeStamp;
305  uint16_t status;
306  uint32_t timeOfWeek;
307  float heading;
309  float pitch;
311  float baseline;
312 } SbgLogGpsHdt;
313 
317 typedef struct _SbgLogGpsRaw
318 {
319  uint8_t rawBuffer[SBG_ECOM_GPS_RAW_MAX_BUFFER_SIZE];
320  size_t bufferSize;
321 } SbgLogGpsRaw;
322 
323 //----------------------------------------------------------------------//
324 //- Operations -//
325 //----------------------------------------------------------------------//
326 
333 SbgErrorCode sbgEComBinaryLogParseGpsVelData(SbgStreamBuffer *pInputStream, SbgLogGpsVel *pOutputData);
334 
341 SbgErrorCode sbgEComBinaryLogWriteGpsVelData(SbgStreamBuffer *pOutputStream, const SbgLogGpsVel *pInputData);
342 
349 SbgErrorCode sbgEComBinaryLogParseGpsPosData(SbgStreamBuffer *pInputStream, SbgLogGpsPos *pOutputData);
350 
357 SbgErrorCode sbgEComBinaryLogWriteGpsPosData(SbgStreamBuffer *pOutputStream, const SbgLogGpsPos *pInputData);
358 
365 SbgErrorCode sbgEComBinaryLogParseGpsHdtData(SbgStreamBuffer *pInputStream, SbgLogGpsHdt *pOutputData);
366 
373 SbgErrorCode sbgEComBinaryLogWriteGpsHdtData(SbgStreamBuffer *pOutputStream, const SbgLogGpsHdt *pInputData);
374 
381 SbgErrorCode sbgEComBinaryLogParseGpsRawData(SbgStreamBuffer *pInputStream, SbgLogGpsRaw *pOutputData);
382 
389 SbgErrorCode sbgEComBinaryLogWriteGpsRawData(SbgStreamBuffer *pOutputStream, const SbgLogGpsRaw *pInputData);
390 
391 #endif
enum _SbgEComGpsPosType SbgEComGpsPosType
Definition: sbgEComBinaryLogGps.h:150
Definition: sbgEComBinaryLogGps.h:136
struct _SbgLogGpsVel SbgLogGpsVel
Definition: sbgEComBinaryLogGps.h:282
uint32_t status
Definition: sbgEComBinaryLogGps.h:285
_SbgEComGpsPosStatus
Definition: sbgEComBinaryLogGps.h:113
float velocityAcc[3]
Definition: sbgEComBinaryLogGps.h:274
Definition: sbgEComBinaryLogGps.h:90
SbgErrorCode sbgEComBinaryLogParseGpsHdtData(SbgStreamBuffer *pInputStream, SbgLogGpsHdt *pOutputData)
Definition: sbgEComBinaryLogGps.h:89
float course
Definition: sbgEComBinaryLogGps.h:275
Definition: sbgEComBinaryLogGps.h:118
float courseAcc
Definition: sbgEComBinaryLogGps.h:276
SBG_INLINE SbgEComGpsVelType sbgEComLogGpsVelGetType(uint32_t status)
Definition: sbgEComBinaryLogGps.h:173
SBG_INLINE uint32_t sbgEComLogGpsPosBuildStatus(SbgEComGpsPosStatus status, SbgEComGpsPosType type, uint32_t masks)
Definition: sbgEComBinaryLogGps.h:224
struct _SbgLogGpsPos SbgLogGpsPos
uint32_t timeOfWeek
Definition: sbgEComBinaryLogGps.h:272
Definition: sbgEComBinaryLogGps.h:92
SbgErrorCode sbgEComBinaryLogWriteGpsHdtData(SbgStreamBuffer *pOutputStream, const SbgLogGpsHdt *pInputData)
#define SBG_ECOM_GPS_VEL_STATUS_SHIFT
Definition: sbgEComBinaryLogGps.h:33
_SbgEComGpsHdtStatus
Definition: sbgEComBinaryLogGps.h:146
#define SBG_ECOM_GPS_RAW_MAX_BUFFER_SIZE
Definition: sbgEComBinaryLogGps.h:78
float undulation
Definition: sbgEComBinaryLogGps.h:290
#define SBG_ECOM_GPS_HDT_STATUS_SHIFT
Definition: sbgEComBinaryLogGps.h:66
float baseline
Definition: sbgEComBinaryLogGps.h:311
Definition: sbgEComBinaryLogGps.h:131
Definition: sbgEComBinaryLogGps.h:102
float altitudeAccuracy
Definition: sbgEComBinaryLogGps.h:293
Definition: sbgEComBinaryLogGps.h:148
Definition: sbgEComBinaryLogGps.h:132
#define SBG_ECOM_GPS_POS_STATUS_SHIFT
Definition: sbgEComBinaryLogGps.h:45
SbgErrorCode sbgEComBinaryLogParseGpsPosData(SbgStreamBuffer *pInputStream, SbgLogGpsPos *pOutputData)
#define SBG_ECOM_GPS_VEL_STATUS_MASK
Definition: sbgEComBinaryLogGps.h:34
Definition: sbgEComBinaryLogGps.h:134
enum _SbgEComGpsVelType SbgEComGpsVelType
uint32_t timeStamp
Definition: sbgEComBinaryLogGps.h:304
Definition: sbgEComBinaryLogGps.h:302
uint32_t timeStamp
Definition: sbgEComBinaryLogGps.h:270
float longitudeAccuracy
Definition: sbgEComBinaryLogGps.h:292
Definition: sbgEComBinaryLogGps.h:116
SBG_INLINE SbgEComGpsHdtStatus sbgEComLogGpsHdtGetStatus(uint32_t status)
Definition: sbgEComBinaryLogGps.h:242
SBG_INLINE uint32_t sbgEComLogGpsVelBuildStatus(SbgEComGpsVelStatus status, SbgEComGpsVelType type)
Definition: sbgEComBinaryLogGps.h:184
float pitchAccuracy
Definition: sbgEComBinaryLogGps.h:310
SbgErrorCode sbgEComBinaryLogWriteGpsPosData(SbgStreamBuffer *pOutputStream, const SbgLogGpsPos *pInputData)
SBG_INLINE uint32_t sbgEComLogGpsHdtBuildStatus(SbgEComGpsHdtStatus status, uint32_t masks)
Definition: sbgEComBinaryLogGps.h:253
enum _SbgEComGpsHdtStatus SbgEComGpsHdtStatus
Definition: sbgEComBinaryLogGps.h:135
Definition: sbgEComBinaryLogGps.h:151
uint16_t status
Definition: sbgEComBinaryLogGps.h:305
float pitch
Definition: sbgEComBinaryLogGps.h:309
double longitude
Definition: sbgEComBinaryLogGps.h:288
SBG_INLINE SbgEComGpsVelStatus sbgEComLogGpsVelGetStatus(uint32_t status)
Definition: sbgEComBinaryLogGps.h:163
uint16_t differentialAge
Definition: sbgEComBinaryLogGps.h:296
float heading
Definition: sbgEComBinaryLogGps.h:307
uint32_t timeOfWeek
Definition: sbgEComBinaryLogGps.h:286
Definition: sbgEComBinaryLogGps.h:149
SBG_INLINE SbgEComGpsPosType sbgEComLogGpsPosGetType(uint32_t status)
Definition: sbgEComBinaryLogGps.h:212
double altitude
Definition: sbgEComBinaryLogGps.h:289
Definition: sbgEComBinaryLogGps.h:130
#define SBG_ECOM_GPS_VEL_TYPE_SHIFT
Definition: sbgEComBinaryLogGps.h:35
enum _SbgEComGpsPosStatus SbgEComGpsPosStatus
Definition: sbgEComBinaryLogGps.h:268
SbgErrorCode sbgEComBinaryLogWriteGpsVelData(SbgStreamBuffer *pOutputStream, const SbgLogGpsVel *pInputData)
uint32_t timeOfWeek
Definition: sbgEComBinaryLogGps.h:306
double latitude
Definition: sbgEComBinaryLogGps.h:287
#define SBG_ECOM_GPS_HDT_STATUS_MASK
Definition: sbgEComBinaryLogGps.h:67
Definition: sbgEComBinaryLogGps.h:127
Definition: sbgEComBinaryLogGps.h:100
Definition: sbgEComBinaryLogGps.h:117
Definition: sbgEComBinaryLogGps.h:101
float velocity[3]
Definition: sbgEComBinaryLogGps.h:273
float latitudeAccuracy
Definition: sbgEComBinaryLogGps.h:291
struct _SbgLogGpsHdt SbgLogGpsHdt
uint32_t status
Definition: sbgEComBinaryLogGps.h:271
float headingAccuracy
Definition: sbgEComBinaryLogGps.h:308
Definition: sbgEComBinaryLogGps.h:133
uint16_t baseStationId
Definition: sbgEComBinaryLogGps.h:295
size_t bufferSize
Definition: sbgEComBinaryLogGps.h:320
Definition: sbgEComBinaryLogGps.h:317
Definition: sbgEComBinaryLogGps.h:128
_SbgEComGpsVelStatus
Definition: sbgEComBinaryLogGps.h:87
uint8_t numSvUsed
Definition: sbgEComBinaryLogGps.h:294
Definition: sbgEComBinaryLogGps.h:126
SbgErrorCode sbgEComBinaryLogParseGpsVelData(SbgStreamBuffer *pInputStream, SbgLogGpsVel *pOutputData)
Definition: sbgEComBinaryLogGps.h:91
SbgErrorCode sbgEComBinaryLogParseGpsRawData(SbgStreamBuffer *pInputStream, SbgLogGpsRaw *pOutputData)
#define SBG_ECOM_GPS_POS_TYPE_SHIFT
Definition: sbgEComBinaryLogGps.h:47
enum _SbgEComGpsVelStatus SbgEComGpsVelStatus
#define SBG_ECOM_GPS_POS_STATUS_MASK
Definition: sbgEComBinaryLogGps.h:46
#define SBG_ECOM_GPS_POS_TYPE_MASK
Definition: sbgEComBinaryLogGps.h:48
#define SBG_ECOM_GPS_VEL_TYPE_MASK
Definition: sbgEComBinaryLogGps.h:36
SBG_INLINE SbgEComGpsPosStatus sbgEComLogGpsPosGetStatus(uint32_t status)
Definition: sbgEComBinaryLogGps.h:202
Definition: sbgEComBinaryLogGps.h:115
Definition: sbgEComBinaryLogGps.h:103
uint32_t timeStamp
Definition: sbgEComBinaryLogGps.h:284
struct _SbgLogGpsRaw SbgLogGpsRaw
_SbgEComGpsVelType
Definition: sbgEComBinaryLogGps.h:98
_SbgEComGpsPosType
Definition: sbgEComBinaryLogGps.h:124
SbgErrorCode sbgEComBinaryLogWriteGpsRawData(SbgStreamBuffer *pOutputStream, const SbgLogGpsRaw *pInputData)
Definition: sbgEComBinaryLogGps.h:129