summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-10-13 14:46:15 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-10-13 14:46:15 -0400
commit5ae819b8e4b9df0da24953355d6d05b9001a82a9 (patch)
tree785cbf67a50ffdfe7ca5ce3ee31ba19ab0c2bb62
parent60b874d966ce88bea269879b1ac86cc7b6ae39cc (diff)
downloadgpsd-5ae819b8e4b9df0da24953355d6d05b9001a82a9.tar.gz
Second step in the visualization code.
-rw-r--r--driver_sirf.c14
-rw-r--r--gpsd.h-tail2
2 files changed, 15 insertions, 1 deletions
diff --git a/driver_sirf.c b/driver_sirf.c
index 9b457129..96d60fba 100644
--- a/driver_sirf.c
+++ b/driver_sirf.c
@@ -264,6 +264,16 @@ static ssize_t sirf_control_send(struct gps_device_t *session, char *msg,
}
#endif /* CONTROLSEND_ENABLE */
+#ifdef VISUALIZE_ENABLE
+static ssize_t sirfbin_visualize(struct gps_device_t *session,
+ char *buf,
+ size_t len)
+{
+ (void)snprintf(buf, len, "MID%d:", (int)buf[4]);
+ gpsd_packetdump(buf + strlen(buf), len - strlen(buf));
+}
+#endif /* VISUALIZE_ENABLE */
+
#ifdef RECONFIGURE_ENABLE
static bool sirfbin_speed(struct gps_device_t *session, speed_t speed, char parity, int stopbits)
/* change speed in binary mode */
@@ -1360,6 +1370,8 @@ static void sirfbin_event_hook(struct gps_device_t *session, event_t event)
}
}
+
+
/* this is everything we export */
/* *INDENT-OFF* */
const struct gps_type_t sirf_binary =
@@ -1384,7 +1396,7 @@ const struct gps_type_t sirf_binary =
.control_send = sirf_control_send,/* how to send a control string */
#endif /* CONTROLSEND_ENABLE */
#ifdef VISUALIZE_ENABLE
- .visualize = NULL, /* no visualization method */
+ .visualize = sirfbin_visualize, /* no visualization method */
#endif /* VISUALIZE_ENABLE */
#ifdef NTPSHM_ENABLE
.ntp_offset = sirf_ntp_offset,
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 5adf4e4e..998f1b46 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -318,7 +318,9 @@ struct gps_type_t {
#endif /* RECONFIGURE_ENABLE */
#ifdef CONTROLSEND_ENABLE
/*@null@*/ssize_t (*control_send)(struct gps_device_t *session, char *buf, size_t buflen);
+#ifdef VISUALIZE_ENABLE
/*@null@*/ssize_t (*visualize)(struct gps_device_t *session, char *buf, size_t buflen);
+#endif /* VISUALIZE_ENABLE */
#endif /* CONTROLSEND_ENABLE */
#ifdef NTPSHM_ENABLE
/*@null@*/double (*ntp_offset)(struct gps_device_t *session);