SELKIELogger  1.0.0
GPSTypes.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Swansea University
3  *
4  * This file is part of the SELKIELogger suite of tools.
5  *
6  * SELKIELogger is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation, either version 3 of the License, or (at your option)
9  * any later version.
10  *
11  * SELKIELogger is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this SELKIELogger product.
18  * If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef SELKIELoggerGPS_Types
22 #define SELKIELoggerGPS_Types
23 
29 #include <stdbool.h>
30 #include <stdint.h>
31 
43 #define UBX_SYNC_BYTE1 0xB5
44 
50 #define UBX_SYNC_BYTE2 0x62
51 
53 typedef enum ubx_class {
54  UBXNAV = 0x01,
55  UBXRXM = 0x02,
56  UBXINF = 0x04,
57  UBXACK = 0x05,
58  UBXCFG = 0x06,
59  UBXUPD = 0x09,
60  UBXMON = 0x0A,
61  UBXAID = 0x0B,
62  UBXTIM = 0x0D,
63  UBXESF = 0x10,
64  UBXMGA = 0x13,
65  UBXLOG = 0x21,
66  UBXSEC = 0x27,
67  UBXHNR = 0x28,
69 
80 typedef struct ubx_message {
81  uint8_t sync1;
82  uint8_t sync2;
83  uint8_t msgClass;
84  uint8_t msgID;
85  uint16_t length;
86  uint8_t data[256];
87  uint8_t csumA;
88  uint8_t csumB;
89  uint8_t *extdata;
92 
94 typedef struct ubx_message_name {
95  uint8_t msgClass;
96  uint8_t msgID;
97  char name[30];
99 
101 typedef struct ubx_nav_pvt {
102  uint32_t tow;
103  uint16_t year;
104  uint8_t month;
105  uint8_t day;
106  uint8_t hour;
107  uint8_t minute;
108  uint8_t second;
109  bool validDate;
110  bool validTime;
111  bool validMagDec;
112  uint32_t accuracy;
113  int32_t nanosecond;
114  uint8_t fixType;
115  uint8_t fixFlags;
116  uint8_t fixFlags2;
117  uint8_t numSV;
118  float longitude;
119  float latitude;
120  int32_t height;
121  int32_t ASL;
122  uint32_t horizAcc;
123  uint32_t vertAcc;
124  int32_t northV;
125  int32_t eastV;
126  int32_t downV;
127  int32_t groundSpeed;
128  float heading;
129  int32_t speedAcc;
130  int32_t headingAcc;
131  uint16_t pDOP;
132  uint8_t pvtFlags;
135  float magDecAcc;
138 #endif
struct ubx_message_name ubx_message_name
UBX Message descriptions.
struct ubx_message ubx_message
Internal representation of a UBX message.
struct ubx_nav_pvt ubx_nav_pvt
Represent decoded NAV-PVT message.
ubx_class
UBX Message class ID bytes.
Definition: GPSTypes.h:53
UBX Message descriptions.
Definition: GPSTypes.h:94
uint8_t msgID
Message ID byte.
Definition: GPSTypes.h:96
char name[30]
Human readable description/name.
Definition: GPSTypes.h:97
uint8_t msgClass
ubx_class value
Definition: GPSTypes.h:95
Internal representation of a UBX message.
Definition: GPSTypes.h:80
uint8_t csumB
Checksum part B.
Definition: GPSTypes.h:88
uint8_t * extdata
Definition: GPSTypes.h:89
uint8_t sync1
Should always be 0xB5.
Definition: GPSTypes.h:81
uint8_t sync2
Should always be 0x62.
Definition: GPSTypes.h:82
uint8_t data[256]
Data if length <= 256.
Definition: GPSTypes.h:86
uint8_t msgClass
A value from ubx_class.
Definition: GPSTypes.h:83
uint8_t msgID
Message ID byte.
Definition: GPSTypes.h:84
uint16_t length
Message length.
Definition: GPSTypes.h:85
uint8_t csumA
Checksum part A.
Definition: GPSTypes.h:87
Represent decoded NAV-PVT message.
Definition: GPSTypes.h:101
int32_t downV
Velocity (Down, mm/s)
Definition: GPSTypes.h:126
uint8_t second
Second (UTC)
Definition: GPSTypes.h:108
uint32_t tow
GPS Time of Week.
Definition: GPSTypes.h:102
uint8_t minute
Minute (UTC)
Definition: GPSTypes.h:107
uint8_t numSV
Number of satellites used for current solution.
Definition: GPSTypes.h:117
int32_t ASL
Height above mean sea level (?datum)
Definition: GPSTypes.h:121
uint32_t accuracy
Estimated time accuracy (ns)
Definition: GPSTypes.h:112
float magneticDeclination
Local magnetic field declination.
Definition: GPSTypes.h:134
float latitude
WGS84 Latitude.
Definition: GPSTypes.h:119
uint32_t vertAcc
Vertical accuracy estimate.
Definition: GPSTypes.h:123
int32_t headingAcc
Heading accuracy estimate.
Definition: GPSTypes.h:130
bool validTime
Time data valid.
Definition: GPSTypes.h:110
uint8_t fixType
Navigation Fix type.
Definition: GPSTypes.h:114
int32_t speedAcc
Speed/velocity accuracy estimate.
Definition: GPSTypes.h:129
uint16_t year
Calendar year.
Definition: GPSTypes.h:103
int32_t groundSpeed
Ground Speed (mm/s)
Definition: GPSTypes.h:127
int32_t northV
Velocity (North, mm/s)
Definition: GPSTypes.h:124
int32_t height
WGS84 Height.
Definition: GPSTypes.h:120
uint8_t pvtFlags
More flags.
Definition: GPSTypes.h:132
uint32_t horizAcc
Horizontal accuracy estimate (mm)
Definition: GPSTypes.h:122
bool validMagDec
Magnetic declination data valid.
Definition: GPSTypes.h:111
float heading
Motion heading.
Definition: GPSTypes.h:128
int32_t eastV
Velocity (East, mm/s)
Definition: GPSTypes.h:125
uint8_t fixFlags
Navigation status flags.
Definition: GPSTypes.h:115
uint16_t pDOP
Position dilution.
Definition: GPSTypes.h:131
uint8_t fixFlags2
Expanded navigation status flags.
Definition: GPSTypes.h:116
int32_t nanosecond
+/- nanosecond (UTC)
Definition: GPSTypes.h:113
uint8_t month
Calendar month.
Definition: GPSTypes.h:104
float magDecAcc
Estimated accuracty of magnetic field declination.
Definition: GPSTypes.h:135
float longitude
WGS84 Longitude.
Definition: GPSTypes.h:118
uint8_t day
Calendar day.
Definition: GPSTypes.h:105
uint8_t hour
Hour (UTC)
Definition: GPSTypes.h:106
float vehicleHeading
Vehicle orientation.
Definition: GPSTypes.h:133
bool validDate
Date data valid.
Definition: GPSTypes.h:109