summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorThomas Sprinkmeier <thomas.sprinkmeier@cohdawireless.com>2011-02-01 13:34:55 -0500
committerEric S. Raymond <esr@thyrsus.com>2011-02-01 13:34:55 -0500
commit786d419a427e5e0a2a2622d33da001a45506ffd5 (patch)
treeac2a3f22a6123f9df7f210896768e69abd88121d /gpsd.c
parenta96df0cffdfe0eed07468e4c63a0bec135f79335 (diff)
downloadgpsd-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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gpsd.c b/gpsd.c
index 39fa02b7..e63fad35 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -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));