summaryrefslogtreecommitdiff
path: root/driver_rtcm2.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-08-28 14:49:14 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-08-28 14:49:14 +0000
commit2094619ca3b2e9973a8623d4507990a412f8cbfd (patch)
tree7f2faba3698d3f2e29d0a7c87e9a46694d8f0f5c /driver_rtcm2.c
parentb2ac538726a4ea27b47e105e9c1f2654e5d1d69d (diff)
downloadgpsd-2094619ca3b2e9973a8623d4507990a412f8cbfd.tar.gz
RTCM2 JSON decoiding is verified and has a full regression test.
Diffstat (limited to 'driver_rtcm2.c')
-rw-r--r--driver_rtcm2.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/driver_rtcm2.c b/driver_rtcm2.c
index 7f4d566d..8b26b9c8 100644
--- a/driver_rtcm2.c
+++ b/driver_rtcm2.c
@@ -618,20 +618,22 @@ void rtcm2_json_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
break;
case 5:
+#define SHOWBOOL(x) ((x)?"true":"false")
(void)strlcat(buf, "\"satellites\":[", buflen);
for (n = 0; n < rtcm->conhealth.nentries; n++) {
struct consat_t *csp = &rtcm->conhealth.sat[n];
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "{\"ident\":%2u,\"iodl\":%1u,\"health\":%1u,\"snr\":%2d,\"health_en\":%1u,\"new_data\":%1u,\"los_warning\":%1u,\"tou\":%2u},",
+ "{\"ident\":%u,\"iodl\":%s,\"health\":%1u,\"snr\":%d,\"health_en\":%s,\"new_data\":%s,\"los_warning\":%s,\"tou\":%u},",
csp->ident,
- (unsigned)csp->iodl,
+ SHOWBOOL(csp->iodl),
(unsigned)csp->health,
csp->snr,
- (unsigned)csp->health_en,
- (unsigned)csp->new_data,
- (unsigned)csp->los_warning,
+ SHOWBOOL(csp->health_en),
+ SHOWBOOL(csp->new_data),
+ SHOWBOOL(csp->los_warning),
csp->tou);
}
+#undef SHOWBOOL
if (buf[strlen(buf)-1] == ',')
buf[strlen(buf)-1] = '\0';
(void)strlcat(buf, "]", buflen);