diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-05-02 12:43:57 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-05-02 12:43:57 -0400 |
commit | 374ed0f355d5b897dc22a85e444497f9a56a6de2 (patch) | |
tree | e9d51f614423ea284766d6922f0a562b6f768038 /rtcm3_json.c | |
parent | f719fbf8cf20f9d709472cea3e10e142f5ca4ee7 (diff) | |
download | gpsd-374ed0f355d5b897dc22a85e444497f9a56a6de2.tar.gz |
Implement RTCM3 R1010 JSON unpacking.
Diffstat (limited to 'rtcm3_json.c')
-rw-r--r-- | rtcm3_json.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/rtcm3_json.c b/rtcm3_json.c index fd6ea0c0..81cd256a 100644 --- a/rtcm3_json.c +++ b/rtcm3_json.c @@ -61,7 +61,7 @@ int json_rtcm3_read(const char *buf, {"lockt", t_uinteger, STRUCTOBJECT(struct rtcm3_1002_t, L1.locktime)}, {"amb", t_uinteger, STRUCTOBJECT(struct rtcm3_1002_t, L1.ambiguity)}, - {"CNR", t_real, STRUCTOBJECT(struct rtcm3_1002_t, L1.CNR)}, + {"CNR", t_real, STRUCTOBJECT(struct rtcm3_1002_t, L1.CNR)}, {NULL}, }; @@ -76,6 +76,19 @@ int json_rtcm3_read(const char *buf, {NULL}, }; + const struct json_attr_t rtcm1010_satellite[] = { + {"ident", t_uinteger, STRUCTOBJECT(struct rtcm3_1010_t, ident)}, + {"ind", t_uinteger, STRUCTOBJECT(struct rtcm3_1010_t, L1.indicator)}, + {"channel", t_uinteger, STRUCTOBJECT(struct rtcm3_1010_t, L1.channel)}, + {"prange", t_real, STRUCTOBJECT(struct rtcm3_1010_t, L1.pseudorange)}, + {"delta", t_real, STRUCTOBJECT(struct rtcm3_1010_t, L1.rangediff)}, + + {"lockt", t_uinteger, STRUCTOBJECT(struct rtcm3_1010_t, L1.locktime)}, + {"amb", t_uinteger, STRUCTOBJECT(struct rtcm3_1010_t, L1.ambiguity)}, + {"CNR", t_real, STRUCTOBJECT(struct rtcm3_1010_t, L1.CNR)}, + {NULL}, + }; + /*@-type@*//* STRUCTARRAY confuses splint */ #define R1001 &rtcm3->rtcmtypes.rtcm3_1001.header const struct json_attr_t json_rtcm1001[] = { @@ -149,7 +162,23 @@ int json_rtcm3_read(const char *buf, rtcm1009_satellite, &satcount)}, {NULL}, }; -#undef R1009 +#undef R1010 + /*@+type@*/ + + /*@-type@*//* STRUCTARRAY confuses splint */ +#define R1010 &rtcm3->rtcmtypes.rtcm3_1010.header + const struct json_attr_t json_rtcm1010[] = { + RTCM3_HEADER + {"station_id", t_uinteger, .addr.uinteger = R1010.station_id}, + {"tow", t_uinteger, .addr.uinteger = (unsigned int *)R1010.tow}, + {"sync", t_boolean, .addr.boolean = R1010.sync}, + {"smoothing", t_boolean, .addr.boolean = R1010.smoothing}, + {"interval", t_uinteger, .addr.uinteger = R1010.interval}, + {"satellites", t_array, STRUCTARRAY(rtcm3->rtcmtypes.rtcm3_1010.rtk_data, + rtcm1010_satellite, &satcount)}, + {NULL}, + }; +#undef R1010 /*@+type@*/ /*@-type@*//* complex union array initislizations confuses splint */ @@ -185,6 +214,8 @@ int json_rtcm3_read(const char *buf, status = json_read_object(buf, json_rtcm1008, endptr); } else if (strstr(buf, "\"type\":1009,") != NULL) { status = json_read_object(buf, json_rtcm1009, endptr); + } else if (strstr(buf, "\"type\":1010,") != NULL) { + status = json_read_object(buf, json_rtcm1010, endptr); } else { int n; status = json_read_object(buf, json_rtcm3_fallback, endptr); |