diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-04-10 22:19:51 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-04-10 22:19:51 -0400 |
commit | 4fda87b5d4dc3dd8200e5f74d6fefc2a32616d6a (patch) | |
tree | 96fa92dc591ac358b39e52537e17d5635e5884e4 /gpsd_json.c | |
parent | 090692924a259d90db1374e35463adb19245b3d2 (diff) | |
download | gpsd-4fda87b5d4dc3dd8200e5f74d6fefc2a32616d6a.tar.gz |
RTCM3 decoding, more progress.
Diffstat (limited to 'gpsd_json.c')
-rw-r--r-- | gpsd_json.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/gpsd_json.c b/gpsd_json.c index 78cc3f1f..5dd1bddf 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -1038,7 +1038,6 @@ void json_rtcm3_dump(const struct rtcm3_t *rtcm, break; case 1005: - case 1006: (void)snprintf(buf + strlen(buf), buflen - strlen(buf), "\"station_id\":%u,\"system\":[", rtcm->rtcmtypes.rtcm3_1005.station_id); @@ -1058,10 +1057,31 @@ void json_rtcm3_dump(const struct rtcm3_t *rtcm, rtcm->rtcmtypes.rtcm3_1005.ecef_x, rtcm->rtcmtypes.rtcm3_1005.ecef_y, rtcm->rtcmtypes.rtcm3_1005.ecef_z); - if (rtcm->type == 1006) - (void)snprintf(buf + strlen(buf), buflen - strlen(buf), - "\"h\":%.4f,", - rtcm->rtcmtypes.rtcm3_1006.height); + break; + + case 1006: + (void)snprintf(buf + strlen(buf), buflen - strlen(buf), + "\"station_id\":%u,\"system\":[", + rtcm->rtcmtypes.rtcm3_1006.station_id); + if ((rtcm->rtcmtypes.rtcm3_1006.system & 0x04)!=0) + (void)strlcat(buf, "\"GPS\",", buflen - strlen(buf)); + if ((rtcm->rtcmtypes.rtcm3_1006.system & 0x02)!=0) + (void)strlcat(buf, "\"GLONASS\",", buflen - strlen(buf)); + if ((rtcm->rtcmtypes.rtcm3_1006.system & 0x01)!=0) + (void)strlcat(buf, "\"GALILEO\",", buflen - strlen(buf)); + if (buf[strlen(buf)-1] == ',') + buf[strlen(buf)-1] = '\0'; + (void)snprintf(buf + strlen(buf), buflen - strlen(buf), + "],\"refstation\":%s,\"sro\":%s," + "\"x\":%.4f,\"y\":%.4f,\"z\":%.4f,", + JSON_BOOL(rtcm->rtcmtypes.rtcm3_1006.reference_station), + JSON_BOOL(rtcm->rtcmtypes.rtcm3_1006.single_receiver), + rtcm->rtcmtypes.rtcm3_1006.ecef_x, + rtcm->rtcmtypes.rtcm3_1006.ecef_y, + rtcm->rtcmtypes.rtcm3_1006.ecef_z); + (void)snprintf(buf + strlen(buf), buflen - strlen(buf), + "\"h\":%.4f,", + rtcm->rtcmtypes.rtcm3_1006.height); break; case 1007: |