summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-08-18 15:47:03 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-08-18 15:47:03 +0000
commitaca62d992732297cabffeb6cf1d58ebb906e7117 (patch)
treef10909db57d94a9e6bf40577d8796b05356b8047
parent6885b22471926d3387be8fc491ea016c78917c13 (diff)
downloadgpsd-aca62d992732297cabffeb6cf1d58ebb906e7117.tar.gz
Make the two different kinds of DEVICE notation conformable.
-rw-r--r--gpsd.c2
-rw-r--r--gpsd.h-tail2
-rw-r--r--gpsd.xml6
-rw-r--r--gpsd_json.c2
4 files changed, 10 insertions, 2 deletions
diff --git a/gpsd.c b/gpsd.c
index 555b6e10..ab6bbcd7 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -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 */
diff --git a/gpsd.xml b/gpsd.xml
index 6543c504..8d5005ba 100644
--- a/gpsd.xml
+++ b/gpsd.xml
@@ -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++)