diff options
author | Thomas Sprinkmeier <thomas.sprinkmeier@cohdawireless.com> | 2011-02-01 13:34:55 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-02-01 13:34:55 -0500 |
commit | 786d419a427e5e0a2a2622d33da001a45506ffd5 (patch) | |
tree | ac2a3f22a6123f9df7f210896768e69abd88121d /gpsd.c | |
parent | a96df0cffdfe0eed07468e4c63a0bec135f79335 (diff) | |
download | gpsd-786d419a427e5e0a2a2622d33da001a45506ffd5.tar.gz |
Process GPGST into noise statistics. All regression tests pass.
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -1181,6 +1181,20 @@ static void handle_request(struct subscriber_t *sub, } if (reply[strlen(reply) - 1] == ',') reply[strlen(reply) - 1] = '\0'; /* trim trailing comma */ + (void)strlcat(reply, "],\"noise_stats\":[", replylen); + for (devp = devices; devp < devices + MAXDEVICES; devp++) { + if (allocated_device(devp) && subscribed(sub, devp)) { + if ((devp->observed & GPS_TYPEMASK) != 0) { + json_noise_dump(&devp->gpsdata, + reply + strlen(reply), + replylen - strlen(reply)); + rstrip(reply); + (void)strlcat(reply, ",", replylen); + } + } + } + if (reply[strlen(reply) - 1] == ',') + reply[strlen(reply) - 1] = '\0'; /* trim trailing comma */ (void)strlcat(reply, "],\"skyviews\":[", replylen); for (devp = devices; devp < devices + MAXDEVICES; devp++) { if (allocated_device(devp) && subscribed(sub, devp)) { @@ -1302,6 +1316,12 @@ static void json_report(struct subscriber_t *sub, (void)throttled_write(sub, buf, strlen(buf)); } + if ((changed & NOISE_IS) != 0) { + json_noise_dump(&device->gpsdata, + buf, sizeof(buf)); + (void)throttled_write(sub, buf, strlen(buf)); + } + if ((changed & SATELLITE_IS) != 0) { json_sky_dump(&device->gpsdata, buf, sizeof(buf)); |