summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-10-30 20:15:20 -0700
committerGary E. Miller <gem@rellim.com>2018-10-30 20:15:20 -0700
commitb790812ef5c9e052c22725163e96e0f5ba674931 (patch)
treec42be31375397cc80b6cecbbb082465b987b65c4
parentf5b60f30f5bcd32b12314b1af8130f2c71690959 (diff)
downloadgpsd-b790812ef5c9e052c22725163e96e0f5ba674931.tar.gz
json: Fis encode/decode of rawdata_t.
-rw-r--r--gpsd_json.c6
-rw-r--r--libgps_json.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/gpsd_json.c b/gpsd_json.c
index 36a17331..2c6e87b2 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -751,21 +751,21 @@ void json_raw_dump(const struct gps_data_t *gpsdata,
comma = true;
if (0 != isfinite(gpsdata->raw.meas[i].carrierphase)) {
- str_appendf(reply, replylen, ",\"carrierphase\":\"%f\"",
+ str_appendf(reply, replylen, ",\"carrierphase\":%f",
gpsdata->raw.meas[i].carrierphase);
comma = true;
}
if (0 != isfinite(gpsdata->raw.meas[i].pseudorange)) {
if (comma)
(void)strlcat(reply, ",", replylen);
- str_appendf(reply, replylen, "\"pseudorange\":\"%f\"",
+ str_appendf(reply, replylen, "\"pseudorange\":%f",
gpsdata->raw.meas[i].pseudorange);
comma = true;
}
if (0 != isfinite(gpsdata->raw.meas[i].doppler)) {
if (comma)
(void)strlcat(reply, ",", replylen);
- str_appendf(reply, replylen, "\"doppler\":\"%f\"",
+ str_appendf(reply, replylen, "\"doppler\":%f",
gpsdata->raw.meas[i].doppler);
comma = true;
}
diff --git a/libgps_json.c b/libgps_json.c
index ae3f2dc0..8ad0b8ef 100644
--- a/libgps_json.c
+++ b/libgps_json.c
@@ -145,7 +145,8 @@ static int json_raw_read(const char *buf, struct gps_data_t *gpsdata,
{"svid", t_short, STRUCTOBJECT(struct meas_t, svid)},
{"snr", t_short, STRUCTOBJECT(struct meas_t, snr)},
{"freqid", t_short, STRUCTOBJECT(struct meas_t, freqid)},
- {"ops", t_string, STRUCTOBJECT(struct meas_t, obs_code)},
+ {"obs", t_string, STRUCTOBJECT(struct meas_t, obs_code),
+ .len = sizeof(gpsdata->raw.meas[0].obs_code)},
{"carrierphase", t_short, STRUCTOBJECT(struct meas_t, carrierphase)},
{"pseudorange", t_short, STRUCTOBJECT(struct meas_t, pseudorange)},
{"doppler", t_real, STRUCTOBJECT(struct meas_t, doppler)},
@@ -161,8 +162,7 @@ static int json_raw_read(const char *buf, struct gps_data_t *gpsdata,
.dflt.real = NAN},
{"nsec", t_real, .addr.real = &mtime_ns,
.dflt.real = NAN},
- {"meas", t_array,
- STRUCTARRAY(gpsdata->raw.meas,
+ {"rawdata", t_array, STRUCTARRAY(gpsdata->raw.meas,
json_attrs_meas, &measurements)},
{NULL},
/* *INDENT-ON* */