summaryrefslogtreecommitdiff
path: root/driver_ubx.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2015-03-19 11:26:36 -0700
committerGary E. Miller <gem@rellim.com>2015-03-19 11:26:36 -0700
commit1a774a903f556a8c842820f64a0e916acb6f8027 (patch)
tree0f33acc2043282060497cc0bfccb688f4ae7285e /driver_ubx.c
parente42501774eb120d5b8c9f5bf97188c91b32383ad (diff)
downloadgpsd-1a774a903f556a8c842820f64a0e916acb6f8027.tar.gz
Break off UBX-MON-VER into separate function.
Diffstat (limited to 'driver_ubx.c')
-rw-r--r--driver_ubx.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/driver_ubx.c b/driver_ubx.c
index 1815f1df..f7e2905d 100644
--- a/driver_ubx.c
+++ b/driver_ubx.c
@@ -61,23 +61,45 @@
static gps_mask_t ubx_parse(struct gps_device_t *session, unsigned char *buf,
size_t len);
+static gps_mask_t ubx_msg_nav_dop(struct gps_device_t *session,
+ unsigned char *buf, size_t data_len);
+static void ubx_msg_inf(struct gps_device_t *session, unsigned char *buf, size_t data_len);
static gps_mask_t ubx_msg_nav_pvt(struct gps_device_t *session,
unsigned char *buf, size_t data_len);
+static void ubx_msg_sbas(struct gps_device_t *session, unsigned char *buf);
static gps_mask_t ubx_msg_nav_sol(struct gps_device_t *session,
unsigned char *buf, size_t data_len);
-static gps_mask_t ubx_msg_nav_dop(struct gps_device_t *session,
- unsigned char *buf, size_t data_len);
-static gps_mask_t ubx_msg_nav_timegps(struct gps_device_t *session,
- unsigned char *buf, size_t data_len);
static gps_mask_t ubx_msg_nav_svinfo(struct gps_device_t *session,
unsigned char *buf, size_t data_len);
-static void ubx_msg_sbas(struct gps_device_t *session, unsigned char *buf);
-static void ubx_msg_inf(struct gps_device_t *session, unsigned char *buf, size_t data_len);
+static gps_mask_t ubx_msg_nav_timegps(struct gps_device_t *session,
+ unsigned char *buf, size_t data_len);
+static void ubx_msg_mon_ver(struct gps_device_t *session,
+ unsigned char *buf, size_t data_len);
#ifdef RECONFIGURE_ENABLE
static void ubx_mode(struct gps_device_t *session, int mode);
#endif /* RECONFIGURE_ENABLE */
/**
+ * Receiver/Software Version
+ */
+static void
+ubx_msg_mon_ver(struct gps_device_t *session, unsigned char *buf,
+ size_t data_len)
+{
+
+ /* save SW and HW Version as subtype */
+ (void)snprintf(session->subtype, sizeof(session->subtype),
+ "SW: %.30s, HW: %.10s",
+ (char *)&buf[UBX_MESSAGE_DATA_OFFSET + 0],
+ (char *)&buf[UBX_MESSAGE_DATA_OFFSET + 30]);
+ /* output SW and HW Version at LOG_INFO */
+ gpsd_log(&session->context->errout, LOG_INF,
+ "UBX_MON_VER: %.40s, %d\n",
+ session->subtype, (int)(data_len -UBX_MESSAGE_DATA_OFFSET));
+
+}
+
+/**
* Navigation Position Velocity Time solution message
*/
static gps_mask_t
@@ -513,13 +535,7 @@ gps_mask_t ubx_parse(struct gps_device_t * session, unsigned char *buf,
break;
case UBX_MON_VER:
gpsd_log(&session->context->errout, LOG_DATA, "UBX_MON_VER\n");
- (void)strlcpy(session->subtype,
- (char *)&buf[UBX_MESSAGE_DATA_OFFSET + 0], 30);
- /* output SW and HW Version at LOG_INFO */
- gpsd_log(&session->context->errout, LOG_INF,
- "UBX_MON_VER: SW Ver: %.31s, HW Ver: %.11s\n",
- session->subtype,
- (char *)&buf[UBX_MESSAGE_DATA_OFFSET + 30]);
+ ubx_msg_mon_ver(session, buf, data_len);
break;
case UBX_MON_EXCEPT:
gpsd_log(&session->context->errout, LOG_DATA, "UBX_MON_EXCEPT\n");