summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gpsd.c5
-rw-r--r--gpsd.h-tail3
-rw-r--r--gpsd_json.c12
-rw-r--r--gpsdecode.c4
-rw-r--r--rtcm-104.xml3
5 files changed, 17 insertions, 10 deletions
diff --git a/gpsd.c b/gpsd.c
index 12fb97ce..108c29bb 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1358,8 +1358,9 @@ static void json_report(struct subscriber_t *sub,
#endif /* COMPASS_ENABLE */
#ifdef RTCM104V2_ENABLE
if ((changed & RTCM2_IS) != 0) {
- json_rtcm2_dump(&device->gpsdata.rtcm2, buf,
- sizeof(buf));
+ json_rtcm2_dump(&device->gpsdata.rtcm2,
+ device->gpsdata.dev.path,
+ buf, sizeof(buf));
(void)throttled_write(sub, buf, strlen(buf));
}
#endif /* RTCM104V2_ENABLE */
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 3a730ba1..11ae76c6 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -153,7 +153,8 @@ extern void isgps_output_magnavox(const isgps30bits_t *, unsigned int, FILE *);
extern enum isgpsstat_t rtcm2_decode(struct gps_packet_t *, unsigned int);
extern void rtcm2_sager_dump(const struct rtcm2_t *, /*@out@*/char[], size_t);
-extern void json_rtcm2_dump(const struct rtcm2_t *, /*@out@*/char[], size_t);
+extern void json_rtcm2_dump(const struct rtcm2_t *,
+ const char *, /*@out@*/char[], size_t);
extern int rtcm2_undump(/*@out@*/struct rtcm2_t *, char *);
extern void rtcm2_unpack(/*@out@*/struct rtcm2_t *, char *);
extern void rtcm3_unpack(/*@out@*/struct rtcm3_t *, char *);
diff --git a/gpsd_json.c b/gpsd_json.c
index abbf5178..fd8dbeb5 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -708,8 +708,8 @@ void json_subframe_dump(const struct gps_data_t *datap,
}
#if defined(RTCM104V2_ENABLE)
-void json_rtcm2_dump(const struct rtcm2_t *rtcm, /*@out@*/ char buf[],
- size_t buflen)
+void json_rtcm2_dump(const struct rtcm2_t *rtcm, const char *device,
+ /*@out@*/ char buf[], size_t buflen)
/* dump the contents of a parsed RTCM104 message as JSON */
{
/*@-mustfreefresh@*/
@@ -723,8 +723,12 @@ void json_rtcm2_dump(const struct rtcm2_t *rtcm, /*@out@*/ char buf[],
unsigned int n;
- (void)snprintf(buf, buflen,
- "{\"class\":\"RTCM2\",\"type\":%u,\"station_id\":%u,\"zcount\":%0.1f,\"seqnum\":%u,\"length\":%u,\"station_health\":%u,",
+ (void)snprintf(buf, buflen, "{\"class\":\"RTCM2\",");
+ if (device != NULL)
+ (void)snprintf(buf + strlen(buf), buflen - strlen(buf),
+ "\"device\":\"%s\",", device);
+ (void)snprintf(buf + strlen(buf), buflen - strlen(buf),
+ "\"type\":%u,\"station_id\":%u,\"zcount\":%0.1f,\"seqnum\":%u,\"length\":%u,\"station_health\":%u,",
rtcm->type, rtcm->refstaid, rtcm->zcount, rtcm->seqnum,
rtcm->length, rtcm->stathlth);
diff --git a/gpsdecode.c b/gpsdecode.c
index a3ab6fcf..8f1f2122 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -381,7 +381,7 @@ static void decode(FILE * fpin, FILE * fpout)
else if (lexer.type == RTCM2_PACKET) {
rtcm2_unpack(&rtcm2, (char *)lexer.isgps.buf);
if (json)
- json_rtcm2_dump(&rtcm2, buf, sizeof(buf));
+ json_rtcm2_dump(&rtcm2, NULL, buf, sizeof(buf));
else
rtcm2_sager_dump(&rtcm2, buf, sizeof(buf));
(void)fputs(buf, fpout);
@@ -438,7 +438,7 @@ static void encode(FILE * fpin, FILE * fpout)
if ((gpsdata.set & RTCM2_SET) != 0) {
/* this works */
char outbuf[BUFSIZ];
- json_rtcm2_dump(&gpsdata.rtcm2, outbuf, sizeof(outbuf));
+ json_rtcm2_dump(&gpsdata.rtcm2, NULL, outbuf, sizeof(outbuf));
(void)fputs(outbuf, fpout);
}
if ((gpsdata.set & AIS_SET) != 0) {
diff --git a/rtcm-104.xml b/rtcm-104.xml
index 43f6b4f2..2a1d4f06 100644
--- a/rtcm-104.xml
+++ b/rtcm-104.xml
@@ -465,7 +465,8 @@ serial data stream which is a word boundary.
described above, except that they are wrapped in a single JSON
object per message and appear as attributes of that object. Arrays of
satellite, station, and constellation statistics become arrays of
-JSON sub-objects.</para>
+JSON sub-objects. Each entence will also have a "device" field
+containing the pathname of the originating device.</para>
<para>(One exception: The zcount field included in the Sager-format
per-satellite reports in type 1 and 9 messages is omitted from the