Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
 4.2.99
protocol.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Croxel Inc.
3 * Copyright (c) 2025 CogniPilot Foundation
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef ZEPHYR_MODEM_UBX_PROTOCOL_
9#define ZEPHYR_MODEM_UBX_PROTOCOL_
10
11#include <stdint.h>
13
14#define UBX_FRAME_HEADER_SZ 6
15#define UBX_FRAME_FOOTER_SZ 2
16#define UBX_FRAME_SZ_WITHOUT_PAYLOAD (UBX_FRAME_HEADER_SZ + UBX_FRAME_FOOTER_SZ)
17#define UBX_FRAME_SZ(payload_size) (payload_size + UBX_FRAME_SZ_WITHOUT_PAYLOAD)
18
19#define UBX_PREAMBLE_SYNC_CHAR_1 0xB5
20#define UBX_PREAMBLE_SYNC_CHAR_2 0x62
21
22#define UBX_FRAME_PREAMBLE_SYNC_CHAR_1_IDX 0
23#define UBX_FRAME_PREAMBLE_SYNC_CHAR_2_IDX 1
24#define UBX_FRAME_MSG_CLASS_IDX 2
25
26#define UBX_PAYLOAD_SZ_MAX 512
27#define UBX_FRAME_SZ_MAX UBX_FRAME_SZ(UBX_PAYLOAD_SZ_MAX)
28
37
46
48 UBX_CLASS_ID_NAV = 0x01, /* Navigation Results Messages */
49 UBX_CLASS_ID_RXM = 0x02, /* Receiver Manager Messages */
50 UBX_CLASS_ID_INF = 0x04, /* Information Messages */
51 UBX_CLASS_ID_ACK = 0x05, /* Ack/Nak Messages */
52 UBX_CLASS_ID_CFG = 0x06, /* Configuration Input Messages */
53 UBX_CLASS_ID_UPD = 0x09, /* Firmware Update Messages */
54 UBX_CLASS_ID_MON = 0x0A, /* Monitoring Messages */
55 UBX_CLASS_ID_TIM = 0x0D, /* Timing Messages */
56 UBX_CLASS_ID_MGA = 0x13, /* Multiple GNSS Assistance Messages */
57 UBX_CLASS_ID_LOG = 0x21, /* Logging Messages */
58 UBX_CLASS_ID_SEC = 0x27, /* Security Feature Messages */
59 UBX_CLASS_ID_NMEA_STD = 0xF0, /* Note: Only used to configure message rate */
60 UBX_CLASS_ID_NMEA_PUBX = 0xF1, /* Note: Only used to configure message rate */
61};
62
67
76
81
82#define UBX_NAV_PVT_VALID_DATE BIT(0)
83#define UBX_NAV_PVT_VALID_TIME BIT(1)
84#define UBX_NAV_PVT_VALID_UTC_TOD BIT(2)
85#define UBX_NAV_PVT_VALID_MAGN BIT(3)
86
87#define UBX_NAV_PVT_FLAGS_GNSS_FIX_OK BIT(0)
88#define UBX_NAV_PVT_FLAGS_GNSS_CARR_SOLN_FLOATING BIT(6)
89#define UBX_NAV_PVT_FLAGS_GNSS_CARR_SOLN_FIXED BIT(7)
90
91#define UBX_NAV_PVT_FLAGS3_INVALID_LLH BIT(0)
92
94 struct {
105 } __packed time;
109 struct {
111 int32_t longitude; /* Longitude. Degrees. scaling: 1e-7 */
112 int32_t latitude; /* Latitude. Degrees. scaling: 1e-7 */
113 int32_t height; /* Height above ellipsoid. mm */
114 int32_t hmsl; /* Height above mean sea level. mm */
115 uint32_t horiz_acc; /* Horizontal accuracy estimate. mm */
116 uint32_t vert_acc; /* Vertical accuracy estimate. mm */
117 int32_t vel_north; /* NED north velocity. mm/s */
118 int32_t vel_east; /* NED east velocity. mm/s */
119 int32_t vel_down; /* NED down velocity. mm/s */
120 int32_t ground_speed; /* Ground Speed (2D). mm/s */
121 int32_t head_motion; /* Heading of Motion (2D). Degrees. scaling: 1e-5 */
122 uint32_t speed_acc; /* Speed accuracy estimated. mm/s */
126 uint16_t pdop; /* scaling: 1e-2 */
129 int32_t head_vehicle; /* Heading of vehicle (2D). Degrees. Valid if
130 * flags.head_vehicle_valid is set.
131 */
132 int16_t mag_decl; /* Magnetic declination. Degrees. */
133 uint16_t magacc; /* Magnetic declination accuracy. Degrees. scaling: 1e-2 */
134 } __packed nav;
135} __packed;
136
142
151
152#define UBX_NAV_SAT_FLAGS_SV_USED BIT(3)
153#define UBX_NAV_SAT_FLAGS_RTCM_CORR_USED BIT(17)
154
157 uint8_t version; /* Message version. */
161 uint8_t gnss_id; /* See ubx_gnss_id */
163 uint8_t cno; /* Carrier-to-noise ratio. dBHz */
164 int8_t elevation; /* Elevation (range: +/- 90). Degrees */
165 int16_t azimuth; /* Azimuth (range: 0 - 360). Degrees */
166 int16_t pseu_res; /* Pseudorange Residual. Meters */
168 } sat[];
169};
170
175
185
190
191struct ubx_ack {
192 uint8_t class;
194};
195
196#define UBX_GNSS_SELECTION_GPS BIT(0)
197#define UBX_GNSS_SELECTION_GLONASS BIT(1)
198#define UBX_GNSS_SELECTION_BEIDOU BIT(2)
199#define UBX_GNSS_SELECTION_GALILEO BIT(3)
200
211
218
220 UBX_CFG_PRT_PORT_MODE_CHAR_LEN_5 = 0, /* Not supported */
221 UBX_CFG_PRT_PORT_MODE_CHAR_LEN_6 = 1, /* Not supported */
222 UBX_CFG_PRT_PORT_MODE_CHAR_LEN_7 = 2, /* Supported only with parity */
224};
225
231
238
239#define UBX_CFG_PRT_MODE_CHAR_LEN(val) (((val) & BIT_MASK(2)) << 6)
240#define UBX_CFG_PRT_MODE_PARITY(val) (((val) & BIT_MASK(3)) << 9)
241#define UBX_CFG_PRT_MODE_STOP_BITS(val) (((val) & BIT_MASK(2)) << 12)
242
243#define UBX_CFG_PRT_PROTO_MASK_UBX BIT(0)
244#define UBX_CFG_PRT_PROTO_MASK_NMEA BIT(1)
245#define UBX_CFG_PRT_PROTO_MASK_RTCM3 BIT(5)
246
258
271
277
285
286#define UBX_CFG_NAV5_APPLY_DYN BIT(0)
287#define UBX_CFG_NAV5_APPLY_FIX_MODE BIT(2)
288
291 uint8_t dyn_model; /* Dynamic platform model. See ubx_dyn_model */
292 uint8_t fix_mode; /* Position fixing mode. See ubx_fix_mode */
293 int32_t fixed_alt; /* Fixed altitude for 2D fix mode. Meters */
294 uint32_t fixed_alt_var; /* Variance for Fixed altitude in 2D mode. Sq. meters */
295 int8_t min_elev; /* Minimum Elevation to use a GNSS satellite in Navigation. Degrees */
296 uint8_t dr_limit; /* Reserved */
297 uint16_t p_dop; /* Position DOP mask */
298 uint16_t t_dop; /* Time DOP mask */
299 uint16_t p_acc; /* Position accuracy mask. Meters */
300 uint16_t t_acc; /* Time accuracy mask. Meters */
301 uint8_t static_hold_thresh; /* Static hold threshold. cm/s */
302 uint8_t dgnss_timeout; /* DGNSS timeout. Seconds */
303 uint8_t cno_thresh_num_svs; /* Number of satellites required above cno_thresh */
304 uint8_t cno_thresh; /* C/N0 threshold for GNSS signals. dbHz */
306 uint16_t static_hold_max_dist; /* Static hold distance threshold. Meters */
307 uint8_t utc_standard; /* UTC standard to be used. See ubx_utc_standard */
309} __packed;
310
316
323
329
338
344
349
351 uint8_t ver; /* See ubx_cfg_val_ver */
354} __packed;
355
361
367
373
395
403
409
411 char sw_ver[30];
412 char hw_ver[10];
413};
414
415static inline uint16_t ubx_calc_checksum(const struct ubx_frame *frame, size_t len)
416{
417 uint8_t ck_a = 0;
418 uint8_t ck_b = 0;
419 const uint8_t *data = (const uint8_t *)frame;
420
422 if (len != UBX_FRAME_SZ(frame->payload_size)) {
423 return 0xFFFF;
424 }
425
426 for (int i = UBX_FRAME_MSG_CLASS_IDX ; i < (UBX_FRAME_SZ(frame->payload_size) - 2) ; i++) {
427 ck_a = ck_a + data[i];
428 ck_b = ck_b + ck_a;
429 }
430
431 return ((ck_a & 0xFF) | ((ck_b & 0xFF) << 8));
432}
433
434static inline int ubx_frame_encode(uint8_t class, uint8_t id,
435 const uint8_t *payload, size_t payload_len,
436 uint8_t *buf, size_t buf_len)
437{
438 if (buf_len < UBX_FRAME_SZ(payload_len)) {
439 return -EINVAL;
440 }
441
442 struct ubx_frame *frame = (struct ubx_frame *)buf;
443
446 frame->class = class;
447 frame->id = id;
448 frame->payload_size = payload_len;
449 memcpy(frame->payload_and_checksum, payload, payload_len);
450
451 uint16_t checksum = ubx_calc_checksum(frame, UBX_FRAME_SZ(payload_len));
452
453 frame->payload_and_checksum[payload_len] = checksum & 0xFF;
454 frame->payload_and_checksum[payload_len + 1] = (checksum >> 8) & 0xFF;
455
456 return UBX_FRAME_SZ(payload_len);
457}
458
459#define UBX_FRAME_DEFINE(_name, _frame) \
460 const static struct ubx_frame _name = _frame
461
462#define UBX_FRAME_ARRAY_DEFINE(_name, ...) \
463 const struct ubx_frame *_name[] = {__VA_ARGS__};
464
465#define UBX_FRAME_ACK_INITIALIZER(_class_id, _msg_id) \
466 UBX_FRAME_INITIALIZER_PAYLOAD(UBX_CLASS_ID_ACK, UBX_MSG_ID_ACK, _class_id, _msg_id)
467
468#define UBX_FRAME_NAK_INITIALIZER(_class_id, _msg_id) \
469 UBX_FRAME_INITIALIZER_PAYLOAD(UBX_CLASS_ID_ACK, UBX_MSG_ID_NAK, _class_id, _msg_id)
470
471#define UBX_FRAME_CFG_RST_INITIALIZER(_start_mode, _reset_mode) \
472 UBX_FRAME_INITIALIZER_PAYLOAD(UBX_CLASS_ID_CFG, UBX_MSG_ID_CFG_RST, \
473 (_start_mode & 0xFF), ((_start_mode >> 8) & 0xFF), \
474 _reset_mode, 0)
475
476#define UBX_FRAME_CFG_RATE_INITIALIZER(_meas_rate_ms, _nav_rate, _time_ref) \
477 UBX_FRAME_INITIALIZER_PAYLOAD(UBX_CLASS_ID_CFG, UBX_MSG_ID_CFG_RATE, \
478 (_meas_rate_ms & 0xFF), ((_meas_rate_ms >> 8) & 0xFF), \
479 (_nav_rate & 0xFF), ((_nav_rate >> 8) & 0xFF), \
480 (_time_ref & 0xFF), ((_time_ref >> 8) & 0xFF))
481
482#define UBX_FRAME_CFG_MSG_RATE_INITIALIZER(_class_id, _msg_id, _rate) \
483 UBX_FRAME_INITIALIZER_PAYLOAD(UBX_CLASS_ID_CFG, UBX_MSG_ID_CFG_MSG, \
484 _class_id, _msg_id, _rate)
485
486#define UBX_FRAME_CFG_VAL_SET_U8_INITIALIZER(_key, _value) \
487 UBX_FRAME_INITIALIZER_PAYLOAD(UBX_CLASS_ID_CFG, UBX_MSG_ID_CFG_VAL_SET, \
488 0x00, 0x01, 0x00, 0x00, \
489 ((_key) & 0xFF), (((_key) >> 8) & 0xFF), \
490 (((_key) >> 16) & 0xFF), (((_key) >> 24) & 0xFF), \
491 ((_value) & 0xFF))
492
493#define UBX_FRAME_CFG_VAL_SET_U16_INITIALIZER(_key, _value) \
494 UBX_FRAME_INITIALIZER_PAYLOAD(UBX_CLASS_ID_CFG, UBX_MSG_ID_CFG_VAL_SET, \
495 0x00, 0x01, 0x00, 0x00, \
496 ((_key) & 0xFF), (((_key) >> 8) & 0xFF), \
497 (((_key) >> 16) & 0xFF), (((_key) >> 24) & 0xFF), \
498 ((_value) & 0xFF), (((_value) >> 8) & 0xFF))
499
500#define UBX_FRAME_CFG_VAL_SET_U32_INITIALIZER(_key, _value) \
501 UBX_FRAME_INITIALIZER_PAYLOAD(UBX_CLASS_ID_CFG, UBX_MSG_ID_CFG_VAL_SET, \
502 0x00, 0x01, 0x00, 0x00, \
503 ((_key) & 0xFF), (((_key) >> 8) & 0xFF), \
504 (((_key) >> 16) & 0xFF), (((_key) >> 24) & 0xFF), \
505 ((_value) & 0xFF), (((_value) >> 8) & 0xFF), \
506 (((_value) >> 16) & 0xFF), (((_value) >> 24) & 0xFF))
507
508#define UBX_FRAME_CFG_VAL_GET_INITIALIZER(_key) \
509 UBX_FRAME_INITIALIZER_PAYLOAD(UBX_CLASS_ID_CFG, UBX_MSG_ID_CFG_VAL_GET, \
510 0x00, 0x00, 0x00, 0x00, \
511 ((_key) & 0xFF), (((_key) >> 8) & 0xFF), \
512 (((_key) >> 16) & 0xFF), (((_key) >> 24) & 0xFF))
513
514#define UBX_FRAME_INITIALIZER_PAYLOAD(_class_id, _msg_id, ...) \
515 _UBX_FRAME_INITIALIZER_PAYLOAD(_class_id, _msg_id, __VA_ARGS__)
516
517#define _UBX_FRAME_INITIALIZER_PAYLOAD(_class_id, _msg_id, ...) \
518 { \
519 .preamble_sync_char_1 = UBX_PREAMBLE_SYNC_CHAR_1, \
520 .preamble_sync_char_2 = UBX_PREAMBLE_SYNC_CHAR_2, \
521 .class = _class_id, \
522 .id = _msg_id, \
523 .payload_size = (NUM_VA_ARGS(__VA_ARGS__)) & 0xFFFF, \
524 .payload_and_checksum = { \
525 __VA_ARGS__, \
526 UBX_CSUM(_class_id, _msg_id, \
527 ((NUM_VA_ARGS(__VA_ARGS__)) & 0xFF), \
528 (((NUM_VA_ARGS(__VA_ARGS__)) >> 8) & 0xFF), \
529 __VA_ARGS__), \
530 }, \
531 }
532
533#define UBX_FRAME_GET_INITIALIZER(_class_id, _msg_id) \
534 { \
535 .preamble_sync_char_1 = UBX_PREAMBLE_SYNC_CHAR_1, \
536 .preamble_sync_char_2 = UBX_PREAMBLE_SYNC_CHAR_2, \
537 .class = _class_id, \
538 .id = _msg_id, \
539 .payload_size = 0, \
540 .payload_and_checksum = { \
541 UBX_CSUM(_class_id, _msg_id, 0, 0), \
542 }, \
543 }
544
545#endif /* ZEPHYR_MODEM_UBX_PROTOCOL_ */
#define EINVAL
Invalid argument.
Definition errno.h:60
time_t time(time_t *tloc)
ubx_msg_id_mon
Definition protocol.h:186
@ UBX_MSG_ID_MON_VER
Definition protocol.h:187
@ UBX_MSG_ID_MON_GNSS
Definition protocol.h:188
#define UBX_PREAMBLE_SYNC_CHAR_1
Definition protocol.h:19
ubx_nav_fix_type
Definition protocol.h:68
@ UBX_NAV_FIX_TYPE_3D
Definition protocol.h:72
@ UBX_NAV_FIX_TYPE_TIME_ONLY
Definition protocol.h:74
@ UBX_NAV_FIX_TYPE_GNSS_DR_COMBINED
Definition protocol.h:73
@ UBX_NAV_FIX_TYPE_NO_FIX
Definition protocol.h:69
@ UBX_NAV_FIX_TYPE_DR
Definition protocol.h:70
@ UBX_NAV_FIX_TYPE_2D
Definition protocol.h:71
ubx_msg_id_ack
Definition protocol.h:171
@ UBX_MSG_ID_ACK
Definition protocol.h:172
@ UBX_MSG_ID_NAK
Definition protocol.h:173
#define UBX_FRAME_MSG_CLASS_IDX
Definition protocol.h:24
ubx_cfg_parity
Definition protocol.h:226
@ UBX_CFG_PRT_PORT_MODE_PARITY_EVEN
Definition protocol.h:227
@ UBX_CFG_PRT_PORT_MODE_PARITY_NONE
Definition protocol.h:229
@ UBX_CFG_PRT_PORT_MODE_PARITY_ODD
Definition protocol.h:228
ubx_nav_hp_dgnss_mode
Definition protocol.h:77
@ UBX_NAV_HP_DGNSS_MODE_RTK_FIXED
Definition protocol.h:79
@ UBX_NAV_HP_DGNSS_MODE_RTK_FLOAT
Definition protocol.h:78
ubx_fix_mode
Definition protocol.h:272
@ UBX_FIX_MODE_AUTO
Definition protocol.h:275
@ UBX_FIX_MODE_2D_ONLY
Definition protocol.h:273
@ UBX_FIX_MODE_3D_ONLY
Definition protocol.h:274
ubx_utc_standard
Definition protocol.h:278
@ UBX_UTC_STANDARD_GPS
Definition protocol.h:280
@ UBX_UTC_STANDARD_GALILEO
Definition protocol.h:281
@ UBX_UTC_STANDARD_AUTOMATIC
Definition protocol.h:279
@ UBX_UTC_STANDARD_BEIDOU
Definition protocol.h:283
@ UBX_UTC_STANDARD_GLONASS
Definition protocol.h:282
ubx_msg_id_cfg
Definition protocol.h:176
@ UBX_MSG_ID_CFG_NAV5
Definition protocol.h:181
@ UBX_MSG_ID_CFG_VAL_SET
Definition protocol.h:182
@ UBX_MSG_ID_CFG_PRT
Definition protocol.h:177
@ UBX_MSG_ID_CFG_RATE
Definition protocol.h:180
@ UBX_MSG_ID_CFG_VAL_GET
Definition protocol.h:183
@ UBX_MSG_ID_CFG_MSG
Definition protocol.h:178
@ UBX_MSG_ID_CFG_RST
Definition protocol.h:179
ubx_cfg_rst_start_mode
Definition protocol.h:311
@ UBX_CFG_RST_WARM_START
Definition protocol.h:313
@ UBX_CFG_RST_HOT_START
Definition protocol.h:312
@ UBX_CFG_RST_COLD_START
Definition protocol.h:314
static uint16_t ubx_calc_checksum(const struct ubx_frame *frame, size_t len)
Definition protocol.h:415
#define UBX_FRAME_SZ(payload_size)
Definition protocol.h:17
ubx_msg_id_nmea_pubx
Definition protocol.h:396
@ UBX_MSG_ID_NMEA_PUBX_CONFIG
Definition protocol.h:397
@ UBX_MSG_ID_NMEA_PUBX_POSITION
Definition protocol.h:398
@ UBX_MSG_ID_NMEA_PUBX_SVSTATUS
Definition protocol.h:400
@ UBX_MSG_ID_NMEA_PUBX_TIME
Definition protocol.h:401
@ UBX_MSG_ID_NMEA_PUBX_RATE
Definition protocol.h:399
ubx_cfg_rst_mode
Definition protocol.h:317
@ UBX_CFG_RST_MODE_GNSS_STOP
Definition protocol.h:320
@ UBX_CFG_RST_MODE_SW
Definition protocol.h:319
@ UBX_CFG_RST_MODE_HW
Definition protocol.h:318
@ UBX_CFG_RST_MODE_GNSS_START
Definition protocol.h:321
ubx_cfg_rate_time_ref
Definition protocol.h:330
@ UBX_CFG_RATE_TIME_REF_BEIDOU
Definition protocol.h:334
@ UBX_CFG_RATE_TIME_REF_GLONASS
Definition protocol.h:333
@ UBX_CFG_RATE_TIME_REF_NAVIC
Definition protocol.h:336
@ UBX_CFG_RATE_TIME_REF_GPS
Definition protocol.h:332
@ UBX_CFG_RATE_TIME_REF_GALILEO
Definition protocol.h:335
@ UBX_CFG_RATE_TIME_REF_UTC
Definition protocol.h:331
ubx_gnss_id
Definition protocol.h:143
@ UBX_GNSS_ID_QZSS
Definition protocol.h:148
@ UBX_GNSS_ID_SBAS
Definition protocol.h:145
@ UBX_GNSS_ID_GLONASS
Definition protocol.h:149
@ UBX_GNSS_ID_GALILEO
Definition protocol.h:146
@ UBX_GNSS_ID_BEIDOU
Definition protocol.h:147
@ UBX_GNSS_ID_GPS
Definition protocol.h:144
ubx_cfg_char_len
Definition protocol.h:219
@ UBX_CFG_PRT_PORT_MODE_CHAR_LEN_5
Definition protocol.h:220
@ UBX_CFG_PRT_PORT_MODE_CHAR_LEN_8
Definition protocol.h:223
@ UBX_CFG_PRT_PORT_MODE_CHAR_LEN_7
Definition protocol.h:222
@ UBX_CFG_PRT_PORT_MODE_CHAR_LEN_6
Definition protocol.h:221
ubx_msg_id_nav
Definition protocol.h:63
@ UBX_MSG_ID_NAV_PVT
Definition protocol.h:64
@ UBX_MSG_ID_NAV_SAT
Definition protocol.h:65
ubx_cfg_stop_bits
Definition protocol.h:232
@ UBX_CFG_PRT_PORT_MODE_STOP_BITS_1_5
Definition protocol.h:234
@ UBX_CFG_PRT_PORT_MODE_STOP_BITS_0_5
Definition protocol.h:236
@ UBX_CFG_PRT_PORT_MODE_STOP_BITS_2
Definition protocol.h:235
@ UBX_CFG_PRT_PORT_MODE_STOP_BITS_1
Definition protocol.h:233
ubx_dyn_model
Definition protocol.h:259
@ UBX_DYN_MODEL_WRIST
Definition protocol.h:268
@ UBX_DYN_MODEL_AIRBORNE_2G
Definition protocol.h:266
@ UBX_DYN_MODEL_STATIONARY
Definition protocol.h:261
@ UBX_DYN_MODEL_PORTABLE
Definition protocol.h:260
@ UBX_DYN_MODEL_SEA
Definition protocol.h:264
@ UBX_DYN_MODEL_AUTOMOTIVE
Definition protocol.h:263
@ UBX_DYN_MODEL_PEDESTRIAN
Definition protocol.h:262
@ UBX_DYN_MODEL_AIRBORNE_1G
Definition protocol.h:265
@ UBX_DYN_MODEL_BIKE
Definition protocol.h:269
@ UBX_DYN_MODEL_AIRBORNE_4G
Definition protocol.h:267
ubx_msg_id_nmea_std
Definition protocol.h:374
@ UBX_MSG_ID_NMEA_STD_GGA
Definition protocol.h:378
@ UBX_MSG_ID_NMEA_STD_GLQ
Definition protocol.h:380
@ UBX_MSG_ID_NMEA_STD_GSV
Definition protocol.h:387
@ UBX_MSG_ID_NMEA_STD_GPQ
Definition protocol.h:383
@ UBX_MSG_ID_NMEA_STD_GBQ
Definition protocol.h:376
@ UBX_MSG_ID_NMEA_STD_VLW
Definition protocol.h:391
@ UBX_MSG_ID_NMEA_STD_VTG
Definition protocol.h:392
@ UBX_MSG_ID_NMEA_STD_GLL
Definition protocol.h:379
@ UBX_MSG_ID_NMEA_STD_GRS
Definition protocol.h:384
@ UBX_MSG_ID_NMEA_STD_RMC
Definition protocol.h:388
@ UBX_MSG_ID_NMEA_STD_THS
Definition protocol.h:389
@ UBX_MSG_ID_NMEA_STD_GST
Definition protocol.h:386
@ UBX_MSG_ID_NMEA_STD_GNQ
Definition protocol.h:381
@ UBX_MSG_ID_NMEA_STD_DTM
Definition protocol.h:375
@ UBX_MSG_ID_NMEA_STD_TXT
Definition protocol.h:390
@ UBX_MSG_ID_NMEA_STD_GSA
Definition protocol.h:385
@ UBX_MSG_ID_NMEA_STD_ZDA
Definition protocol.h:393
@ UBX_MSG_ID_NMEA_STD_GBS
Definition protocol.h:377
@ UBX_MSG_ID_NMEA_STD_GNS
Definition protocol.h:382
static int ubx_frame_encode(uint8_t class, uint8_t id, const uint8_t *payload, size_t payload_len, uint8_t *buf, size_t buf_len)
Definition protocol.h:434
ubx_class_id
Definition protocol.h:47
@ UBX_CLASS_ID_NMEA_PUBX
Definition protocol.h:60
@ UBX_CLASS_ID_LOG
Definition protocol.h:57
@ UBX_CLASS_ID_MGA
Definition protocol.h:56
@ UBX_CLASS_ID_RXM
Definition protocol.h:49
@ UBX_CLASS_ID_SEC
Definition protocol.h:58
@ UBX_CLASS_ID_NMEA_STD
Definition protocol.h:59
@ UBX_CLASS_ID_INF
Definition protocol.h:50
@ UBX_CLASS_ID_TIM
Definition protocol.h:55
@ UBX_CLASS_ID_NAV
Definition protocol.h:48
@ UBX_CLASS_ID_UPD
Definition protocol.h:53
@ UBX_CLASS_ID_MON
Definition protocol.h:54
@ UBX_CLASS_ID_ACK
Definition protocol.h:51
@ UBX_CLASS_ID_CFG
Definition protocol.h:52
ubx_cfg_val_ver
Definition protocol.h:345
@ UBX_CFG_VAL_VER_SIMPLE
Definition protocol.h:346
@ UBX_CFG_VAL_VER_TRANSACTION
Definition protocol.h:347
#define UBX_PREAMBLE_SYNC_CHAR_2
Definition protocol.h:20
ubx_cfg_port_id
Definition protocol.h:212
@ UBX_CFG_PORT_ID_USB
Definition protocol.h:215
@ UBX_CFG_PORT_ID_DDC
Definition protocol.h:213
@ UBX_CFG_PORT_ID_SPI
Definition protocol.h:216
@ UBX_CFG_PORT_ID_UART
Definition protocol.h:214
ubx_nav_sat_health
Definition protocol.h:137
@ UBX_NAV_SAT_HEALTH_UNKNOWN
Definition protocol.h:138
@ UBX_NAV_SAT_HEALTH_HEALTHY
Definition protocol.h:139
@ UBX_NAV_SAT_HEALTH_UNHEALTHY
Definition protocol.h:140
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__INT32_TYPE__ int32_t
Definition stdint.h:74
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT8_TYPE__ int8_t
Definition stdint.h:72
__INT16_TYPE__ int16_t
Definition stdint.h:73
void * memcpy(void *ZRESTRICT d, const void *ZRESTRICT s, size_t n)
Definition protocol.h:191
uint8_t id
Definition protocol.h:193
Definition protocol.h:404
uint8_t rate
Definition protocol.h:407
uint8_t id
Definition protocol.h:406
Definition protocol.h:289
uint16_t p_acc
Definition protocol.h:299
int8_t min_elev
Definition protocol.h:295
uint8_t dgnss_timeout
Definition protocol.h:302
uint16_t t_dop
Definition protocol.h:298
uint16_t apply
Definition protocol.h:290
uint8_t static_hold_thresh
Definition protocol.h:301
uint16_t static_hold_max_dist
Definition protocol.h:306
uint8_t cno_thresh_num_svs
Definition protocol.h:303
uint8_t dyn_model
Definition protocol.h:291
uint16_t p_dop
Definition protocol.h:297
uint8_t fix_mode
Definition protocol.h:292
uint8_t reserved1[2]
Definition protocol.h:305
uint32_t fixed_alt_var
Definition protocol.h:294
uint8_t cno_thresh
Definition protocol.h:304
uint8_t reserved2[5]
Definition protocol.h:308
uint8_t dr_limit
Definition protocol.h:296
uint16_t t_acc
Definition protocol.h:300
uint8_t utc_standard
Definition protocol.h:307
int32_t fixed_alt
Definition protocol.h:293
Definition protocol.h:247
uint16_t rx_ready_pin
Definition protocol.h:250
uint16_t out_proto_mask
Definition protocol.h:254
uint32_t mode
Definition protocol.h:251
uint16_t flags
Definition protocol.h:255
uint16_t in_proto_mask
Definition protocol.h:253
uint8_t reserved1
Definition protocol.h:249
uint32_t baudrate
Definition protocol.h:252
uint16_t reserved2
Definition protocol.h:256
uint8_t port_id
Definition protocol.h:248
Definition protocol.h:339
uint16_t time_ref
Definition protocol.h:342
uint16_t nav_rate
Definition protocol.h:341
uint16_t meas_rate_ms
Definition protocol.h:340
Definition protocol.h:324
uint8_t reset_mode
Definition protocol.h:326
uint16_t nav_bbr_mask
Definition protocol.h:325
uint8_t reserved
Definition protocol.h:327
Definition protocol.h:350
uint8_t ver
Definition protocol.h:351
uint16_t position
Definition protocol.h:353
uint8_t layer
Definition protocol.h:352
Definition protocol.h:362
struct ubx_cfg_val_hdr hdr
Definition protocol.h:363
uint16_t value
Definition protocol.h:365
uint32_t key
Definition protocol.h:364
Definition protocol.h:368
uint32_t value
Definition protocol.h:371
uint32_t key
Definition protocol.h:370
struct ubx_cfg_val_hdr hdr
Definition protocol.h:369
Definition protocol.h:356
uint32_t key
Definition protocol.h:358
uint8_t value
Definition protocol.h:359
struct ubx_cfg_val_hdr hdr
Definition protocol.h:357
Definition protocol.h:38
uint16_t len
Definition protocol.h:43
struct ubx_frame_match::@352213364356211272240131006112257113241046164202 payload
uint8_t id
Definition protocol.h:40
uint8_t * buf
Definition protocol.h:42
Definition protocol.h:29
uint8_t class
Definition protocol.h:32
uint8_t id
Definition protocol.h:33
uint8_t payload_and_checksum[]
Definition protocol.h:35
uint16_t payload_size
Definition protocol.h:34
uint8_t preamble_sync_char_2
Definition protocol.h:31
uint8_t preamble_sync_char_1
Definition protocol.h:30
Definition protocol.h:201
uint8_t reserved1[3]
Definition protocol.h:209
uint8_t default_enabled
Definition protocol.h:205
uint8_t simultaneous
Definition protocol.h:208
uint8_t supported
Definition protocol.h:204
uint8_t enabled
Definition protocol.h:206
struct ubx_mon_gnss::@224205002314270241172347203256350144274361054317 selection
uint8_t ver
Definition protocol.h:202
Definition protocol.h:410
char hw_ver[10]
Definition protocol.h:412
char sw_ver[30]
Definition protocol.h:411
Definition protocol.h:93
uint8_t second
Definition protocol.h:101
uint32_t tacc
Definition protocol.h:103
int32_t vel_east
Definition protocol.h:118
uint8_t minute
Definition protocol.h:100
uint8_t flags
See ubx_nav_fix_type.
Definition protocol.h:107
int32_t nano
Definition protocol.h:104
int32_t vel_north
Definition protocol.h:117
uint8_t flags2
Definition protocol.h:108
int32_t latitude
Definition protocol.h:112
int32_t ground_speed
Definition protocol.h:120
uint16_t flags3
Definition protocol.h:127
uint8_t fix_type
Definition protocol.h:106
uint32_t itow
Definition protocol.h:95
uint8_t valid
Definition protocol.h:102
int32_t vel_down
Definition protocol.h:119
int16_t mag_decl
Definition protocol.h:132
uint16_t pdop
Heading accuracy estimate (both motion and vehicle).
Definition protocol.h:126
uint32_t reserved
Definition protocol.h:128
uint16_t year
Definition protocol.h:96
int32_t head_vehicle
Definition protocol.h:129
uint32_t speed_acc
Definition protocol.h:122
uint32_t head_acc
Definition protocol.h:123
struct ubx_nav_pvt::@124110107202070056152323072100221212357171026061 nav
int32_t height
Definition protocol.h:113
int32_t head_motion
Definition protocol.h:121
uint16_t magacc
Definition protocol.h:133
uint32_t horiz_acc
Definition protocol.h:115
uint8_t month
Definition protocol.h:97
int32_t longitude
Definition protocol.h:111
int32_t hmsl
Definition protocol.h:114
uint8_t num_sv
Definition protocol.h:110
uint8_t day
Definition protocol.h:98
uint8_t hour
Definition protocol.h:99
uint32_t vert_acc
Definition protocol.h:116
Definition protocol.h:160
uint8_t gnss_id
Definition protocol.h:161
int16_t azimuth
Definition protocol.h:165
int16_t pseu_res
Definition protocol.h:166
uint8_t cno
Definition protocol.h:163
int8_t elevation
Definition protocol.h:164
uint8_t sv_id
Definition protocol.h:162
uint32_t flags
Definition protocol.h:167
Definition protocol.h:155
uint16_t reserved1
Definition protocol.h:159
uint8_t version
Definition protocol.h:157
uint32_t itow
Definition protocol.h:156
struct ubx_nav_sat::ubx_nav_sat_info sat[]
uint8_t num_sv
Definition protocol.h:158