diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-06-22 04:35:53 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-06-22 04:35:53 -0400 |
commit | 6d0f4732061cad5522fade68f35c95331b7aec1e (patch) | |
tree | 7dbd9b2f936671dc54d7d312a6b3ae2ba2ee05de /drivers.c | |
parent | c62cf06bb2b9031a7d5072ee5a20eccbfbaf021d (diff) | |
download | gpsd-6d0f4732061cad5522fade68f35c95331b7aec1e.tar.gz |
Mark VERSION and WATCH with a remote attribute when passed from slaves.
Diffstat (limited to 'drivers.c')
-rw-r--r-- | drivers.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -1229,11 +1229,26 @@ static void path_rewrite(struct gps_device_t *session, char *prefix) static gps_mask_t json_pass_packet(struct gps_device_t *session UNUSED) { - /* FIX-ME: only tags the first of multiple devices on remote gpsd */ gpsd_report(LOG_IO, "<= GPS: %s\n", (char *)session->packet.outbuffer); + + /* devices and paths need to be edited to */ if (strstr((char *)session->packet.outbuffer, "DEVICE") != NULL) path_rewrite(session, "\"path\":\""); path_rewrite(session, "\"device\":\""); + + /* mark certain responses without a path or device attribute */ + if (strstr((char *)session->packet.outbuffer, "VERSION") != NULL + || strstr((char *)session->packet.outbuffer, "WATCH") != NULL) { + session->packet.outbuffer[session->packet.outbuflen] = '\0'; + (void)strlcat((char *)session->packet.outbuffer, ",\"remote\":\"", + sizeof(session->packet.outbuffer)); + (void)strlcat((char *)session->packet.outbuffer, + session->gpsdata.dev.path, + sizeof(session->packet.outbuffer)); + (void)strlcat((char *)session->packet.outbuffer, "\"}", + sizeof(session->packet.outbuffer)); + } + gpsd_report (LOG_PROG, "JSON, passing through %s\n", (char *)session->packet.outbuffer); |