Tue 03 Feb 2015 11:08:48 PM UTC, original submission:
Below are diffs of three minor bug fixes, which fix json encoding of aivdm sentences. Hope you get the point.
diff --git a/gpsd_json.c b/gpsd_json.c
index 721ff89..d17e595 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -2799,7 +2799,7 @@ void json_aivdm_dump(const struct ais_t *ais,
"\"speed_q\":%s,"
"\"course_q\":%s,"
"\"heading_q\":%s}\r\n",
- ais->type8.dac200fid10.vin,
+ json_stringify(buf1, sizeof(buf1), ais->type8.dac200fid10.vin),
ais->type8.dac200fid10.length,
ais->type8.dac200fid10.beam,
ais->type8.dac200fid10.shiptype,
@@ -2861,7 +2861,7 @@ void json_aivdm_dump(const struct ais_t *ais,
ais->type8.dac200fid24.country);
for (i = 0; i < ais->type8.dac200fid24.ngauges; i++) {
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "{\"id\":%u,\"level\":%d}",
+ "{\"id\":%u,\"level\":%d},",
ais->type8.dac200fid24.gauges[i].id,
ais->type8.dac200fid24.gauges[i].level);
}
@@ -3312,7 +3312,7 @@ void json_aivdm_dump(const struct ais_t *ais,
ais->type24.callsign));
if (AIS_AUXILIARY_MMSI(ais->mmsi)) {
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "\"mothership_mmsi\":%u}\r\n",
+ "\"mothership_mmsi\":%u,",
ais->type24.mothership_mmsi);
} else {
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
|