diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-08-27 14:00:04 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-08-27 14:00:04 +0000 |
commit | 8c6a94d3122e3d58843f81ba8ad7c71b5abcd719 (patch) | |
tree | 0e3521a3bf5ebd534d971d46f0d2b3e588a1336c /rtcm2_json.c | |
parent | e5025d231a68d3f6ece0706a673ad0b6bcc16cef (diff) | |
download | gpsd-8c6a94d3122e3d58843f81ba8ad7c71b5abcd719.tar.gz |
Parse RTCM2 message type 7 JSON.
Diffstat (limited to 'rtcm2_json.c')
-rw-r--r-- | rtcm2_json.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/rtcm2_json.c b/rtcm2_json.c index 545cde43..e43d7802 100644 --- a/rtcm2_json.c +++ b/rtcm2_json.c @@ -52,7 +52,7 @@ int json_rtcm2_read(const char *buf, const struct json_attr_t json_rtcm1[] = { RTCM2_HEADER {"satellites", array, STRUCTARRAY(rtcm2->ranges.sat, - rtcm1_satellite, &satcount)}, + rtcm1_satellite, &satcount)}, {NULL}, }; @@ -97,7 +97,7 @@ int json_rtcm2_read(const char *buf, const struct json_attr_t json_rtcm5[] = { RTCM2_HEADER {"satellites", array, STRUCTARRAY(rtcm2->conhealth.sat, - rtcm5_satellite, &satcount)}, + rtcm5_satellite, &satcount)}, {NULL}, }; @@ -107,9 +107,20 @@ int json_rtcm2_read(const char *buf, {NULL}, }; + const struct json_attr_t rtcm7_satellite[] = { + {"latitude", real, STRUCTOBJECT(struct station_t, latitude)}, + {"longitude", real, STRUCTOBJECT(struct station_t, longitude)}, + {"range", uinteger, STRUCTOBJECT(struct station_t, range)}, + {"frequency", real, STRUCTOBJECT(struct station_t, frequency)}, + {"health", uinteger, STRUCTOBJECT(struct station_t, health)}, + {"station_id", uinteger, STRUCTOBJECT(struct station_t, station_id)}, + {"bitrate", uinteger, STRUCTOBJECT(struct station_t, bitrate)}, + {NULL}, + }; const struct json_attr_t json_rtcm7[] = { - // FIXME RTCM2_HEADER + {"satellites", array, STRUCTARRAY(rtcm2->almanac.station, + rtcm7_satellite, &satcount)}, {NULL}, }; @@ -148,6 +159,8 @@ int json_rtcm2_read(const char *buf, status = json_read_object(buf, json_rtcm6, endptr); else if (strstr(buf, "\"type\":7") != NULL) status = json_read_object(buf, json_rtcm7, endptr); + if (status == 0) + rtcm2->almanac.nentries = (unsigned)satcount; else if (strstr(buf, "\"type\":16") != NULL) status = json_read_object(buf, json_rtcm16, endptr); else |