diff options
author | Gary E. Miller <gem@rellim.com> | 2019-04-12 19:38:35 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2019-04-12 19:38:35 -0700 |
commit | 59d0330b70e0364b7ffb1bc37df8b341cdda75e5 (patch) | |
tree | cdcfa0435787e1060130474f5b80552d52bc1bf4 | |
parent | 9c6c514fd751cfc35ca0fad388748d3e9fde7765 (diff) | |
download | gpsd-59d0330b70e0364b7ffb1bc37df8b341cdda75e5.tar.gz |
driver_ubx: Add ubx.protver, and more, to gps_device_t.
The protocol version will be needed for future configuration
operations. The cycle enders will be used soon.
-rw-r--r-- | driver_ubx.c | 18 | ||||
-rw-r--r-- | gpsd.h | 4 |
2 files changed, 18 insertions, 4 deletions
diff --git a/driver_ubx.c b/driver_ubx.c index a6bac450..b9f424d4 100644 --- a/driver_ubx.c +++ b/driver_ubx.c @@ -19,13 +19,15 @@ * */ -#include <stdio.h> -#include <stdbool.h> #include <assert.h> -#include <string.h> #include <math.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <unistd.h> + #include "gpsd.h" #if defined(UBLOX_ENABLE) && defined(BINARY_ENABLE) #include "driver_ubx.h" @@ -102,6 +104,7 @@ ubx_msg_mon_ver(struct gps_device_t *session, unsigned char *buf, { size_t n = 0; /* extended info counter */ char obuf[128]; /* temp version string buffer */ + char *cptr; if (40 > data_len) { gpsd_log(&session->context->errout, LOG_WARN, @@ -109,7 +112,6 @@ ubx_msg_mon_ver(struct gps_device_t *session, unsigned char *buf, return; } - /* save SW and HW Version as subtype */ (void)snprintf(obuf, sizeof(obuf), "SW %.30s,HW %.10s", @@ -130,6 +132,14 @@ ubx_msg_mon_ver(struct gps_device_t *session, unsigned char *buf, } /* save what we can */ (void)strlcpy(session->subtype, obuf, sizeof(session->subtype)); + /* find PROTVER= */ + cptr = strstr(session->subtype, "PROTVER="); + if (NULL != cptr) { + int protver = atoi(cptr + 8); + if (9 < protver) { + session->driver.ubx.protver = protver; + } + } /* output SW and HW Version at LOG_INFO */ gpsd_log(&session->context->errout, LOG_INF, @@ -58,6 +58,7 @@ extern "C" { * Add cfg_stage and cfg_step, for initialization * Add oldfix2 for better oldfix * Make subtype longer + * Add ubx.protver, ubx.end_class, ubx.end_id to gps_device_t */ /* Keep in sync with api_major_version and api_minor gps/__init__.py */ #define GPSD_PROTO_MAJOR_VERSION 3 /* bump on incompatible changes */ @@ -699,6 +700,9 @@ struct gps_device_t { struct { unsigned char port_id; unsigned char sbas_in_use; + unsigned char protver; /* u-blox protocol version */ + unsigned char end_class; /* cycle ender class */ + unsigned char end_id; /* cycle ender ID */ } ubx; #endif /* UBLOX_ENABLE */ #ifdef NAVCOM_ENABLE |