summaryrefslogtreecommitdiff
path: root/rtcm2_json.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-03-15 12:02:31 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-03-15 12:02:31 -0400
commite044a01f410342d3ce23adbbecaf463eb2891524 (patch)
tree04a12c0c151c897d201b787f0c28b38570668e4e /rtcm2_json.c
parentb226eaeab6661983e6342c944c86d30754b0f841 (diff)
downloadgpsd-e044a01f410342d3ce23adbbecaf463eb2891524.tar.gz
Dump contents of of RTCM2.3 type 31 as a JSON object rather than hex words.
Fix required in order to check the RTCM2 driver logic against the ASCII dump from Andre Naujoks. Remarkably, the check passes - though it appears that in his dump the constant 40 is added to all GLONASS satellite IDs. doubtless so they won't collide with GPS satellite IDs. The naujoks-ntrip.log test had to be rebuilt. All other regression tests pass.
Diffstat (limited to 'rtcm2_json.c')
-rw-r--r--rtcm2_json.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/rtcm2_json.c b/rtcm2_json.c
index 68b98533..549a59c4 100644
--- a/rtcm2_json.c
+++ b/rtcm2_json.c
@@ -174,6 +174,24 @@ int json_rtcm2_read(const char *buf,
{NULL},
};
+ const struct json_attr_t rtcm31_satellite[] = {
+ {"ident", t_uinteger, STRUCTOBJECT(struct glonass_rangesat_t, ident)},
+ {"udre", t_uinteger, STRUCTOBJECT(struct glonass_rangesat_t, udre)},
+ {"change", t_boolean, STRUCTOBJECT(struct glonass_rangesat_t, change)},
+ {"tod", t_uinteger, STRUCTOBJECT(struct glonass_rangesat_t, tod)},
+ {"prc", t_real, STRUCTOBJECT(struct glonass_rangesat_t, prc)},
+ {"rrc", t_real, STRUCTOBJECT(struct glonass_rangesat_t, rrc)},
+ {NULL},
+ };
+ /*@-type@*//* STRUCTARRAY confuses splint */
+ const struct json_attr_t json_rtcm31[] = {
+ RTCM2_HEADER
+ {"satellites", t_array, STRUCTARRAY(rtcm2->glonass_ranges.sat,
+ rtcm31_satellite, &satcount)},
+ {NULL},
+ };
+ /*@+type@*/
+
/*@-type@*//* complex union array initislizations confuses splint */
const struct json_attr_t json_rtcm2_fallback[] = {
RTCM2_HEADER
@@ -226,6 +244,10 @@ int json_rtcm2_read(const char *buf,
status = json_read_object(buf, json_rtcm14, endptr);
} else if (strstr(buf, "\"type\":16,") != NULL) {
status = json_read_object(buf, json_rtcm16, endptr);
+ } else if (strstr(buf, "\"type\":31,") != NULL) {
+ status = json_read_object(buf, json_rtcm31, endptr);
+ if (status == 0)
+ rtcm2->glonass_ranges.nentries = (unsigned)satcount;
} else {
int n;
status = json_read_object(buf, json_rtcm2_fallback, endptr);