summaryrefslogtreecommitdiff
path: root/gpsd_json.c
diff options
context:
space:
mode:
authorMichael Brown <mbrown@fensystems.co.uk>2016-02-03 22:40:23 +0000
committerEric S. Raymond <esr@thyrsus.com>2016-02-09 16:04:52 -0500
commit6a94e2254d02bc4d9e1d7d4015204c32855e8316 (patch)
tree4fd74d260c2abf9e58709e769a937e32ffad8778 /gpsd_json.c
parentd019151fc5ce02cbaf4ae56556614d320eb80347 (diff)
downloadgpsd-6a94e2254d02bc4d9e1d7d4015204c32855e8316.tar.gz
Add concept of a GPS-disciplined oscillator
Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
Diffstat (limited to 'gpsd_json.c')
-rw-r--r--gpsd_json.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gpsd_json.c b/gpsd_json.c
index aca3955a..44b2c0e7 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -3366,6 +3366,21 @@ void json_att_dump(const struct gps_data_t *gpsdata,
}
#endif /* COMPASS_ENABLE */
+#ifdef OSCILLATOR_ENABLE
+void json_oscillator_dump(const struct gps_data_t *datap,
+ char *reply, size_t replylen)
+/* dump the contents of an oscillator_t structure as JSON */
+{
+ (void)snprintf(reply, replylen,
+ "{\"class\":\"OSC\",\"device\":\"%s\",\"running\":%s,\"reference\":%s,\"disciplined\":%s,\"delta\":%d}\r\n",
+ datap->dev.path,
+ JSON_BOOL(datap->osc.running),
+ JSON_BOOL(datap->osc.reference),
+ JSON_BOOL(datap->osc.disciplined),
+ datap->osc.delta);
+}
+#endif /* OSCILLATOR_ENABLE */
+
void json_data_report(const gps_mask_t changed,
const struct gps_device_t *session,
const struct policy_t *policy,
@@ -3418,6 +3433,12 @@ void json_data_report(const gps_mask_t changed,
buf+strlen(buf), buflen-strlen(buf));
}
#endif /* AIVDM_ENABLE */
+
+#ifdef OSCILLATOR_ENABLE
+ if ((changed & OSCILLATOR_SET) != 0) {
+ json_oscillator_dump(datap, buf+strlen(buf), buflen-strlen(buf));
+ }
+#endif /* OSCILLATOR_ENABLE */
}
#undef JSON_BOOL