diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-08-18 15:47:03 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-08-18 15:47:03 +0000 |
commit | aca62d992732297cabffeb6cf1d58ebb906e7117 (patch) | |
tree | f10909db57d94a9e6bf40577d8796b05356b8047 | |
parent | 6885b22471926d3387be8fc491ea016c78917c13 (diff) | |
download | gpsd-aca62d992732297cabffeb6cf1d58ebb906e7117.tar.gz |
Make the two different kinds of DEVICE notation conformable.
-rw-r--r-- | gpsd.c | 2 | ||||
-rw-r--r-- | gpsd.h-tail | 2 | ||||
-rw-r--r-- | gpsd.xml | 6 | ||||
-rw-r--r-- | gpsd_json.c | 2 |
4 files changed, 10 insertions, 2 deletions
@@ -841,7 +841,7 @@ static struct channel_t *assign_channel(struct subscriber_t *user, #endif /* OLDSTYLE_ENABLE */ #ifdef GPSDNG_ENABLE if (newstyle(user) && was_unassigned) - (void)snprintf(buf, sizeof(buf), "{\"class\":\"DEVICE\",\"device\":\"%s\",\"activated\"=%f}\r\n", + (void)snprintf(buf, sizeof(buf), "{\"class\":\"DEVICE\",\"device\":\"%s\",\"activated\":%2.2f}\r\n", channel->device->gpsdata.gps_device, timestamp()); #endif /* GPSDNG_ENABLE */ diff --git a/gpsd.h-tail b/gpsd.h-tail index ca36f45e..5be5a2e7 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -152,7 +152,7 @@ struct classmap_t { char *name; int mask; }; -#define CLASSMAP_NITEMS 5; +#define CLASSMAP_NITEMS 5 struct classmap_t classmap[CLASSMAP_NITEMS]; #define NTPSHMSEGS 4 /* number of NTP SHM segments */ @@ -900,6 +900,12 @@ following elements:</para> <entry>Name of the device</entry> </row> <row> + <entry>activated</entry> + <entry>At device activation and device close time.</entry> + <entry>numeric</entry> + <entry>Time the device last sent data.</entry> +</row> +<row> <entry>type</entry> <entry>No</entry> <entry>list of strings</entry> diff --git a/gpsd_json.c b/gpsd_json.c index 8797366f..a67fa79b 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -163,6 +163,8 @@ void json_device_dump(struct gps_device_t *device, (void)strlcpy(reply, "{\"class\":\"DEVICE\",\"name\":\"", replylen); (void)strlcat(reply, device->gpsdata.gps_device, replylen); (void)strlcat(reply, "\",", replylen); + (void)snprintf(reply+strlen(reply), replylen-strlen(reply), + "\"activated\":%2.2f", device->gpsdata.online); if (device->observed != 0) { (void)strlcat(reply, "\"type\":[", replylen); for (cmp = classmap; cmp < classmap+NITEMS(classmap); cmp++) |