summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-09 23:24:38 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-11-09 23:24:38 -0500
commit038f7c549642d361443e133a0cbcdd89c7c3f24d (patch)
tree263e96797b6e354781149bf3f44f6353e33ef86b
parente030575a5248f6ad125af9e05fa0bc63ad811618 (diff)
downloadgpsd-038f7c549642d361443e133a0cbcdd89c7c3f24d.tar.gz
PPS events now show in gpsmon runb through the daemon.
-rw-r--r--gps.h1
-rw-r--r--gpsd.c12
-rw-r--r--gpsd_json.c5
-rw-r--r--gpsd_json.xml8
-rw-r--r--gpsmon.c12
-rw-r--r--gpsmon.xml3
-rw-r--r--libgps_core.c3
-rw-r--r--shared_json.c1
8 files changed, 33 insertions, 12 deletions
diff --git a/gps.h b/gps.h
index 272b4c8e..817627ec 100644
--- a/gps.h
+++ b/gps.h
@@ -1882,6 +1882,7 @@ struct policy_t {
bool scaled; /* requesting report scaling? */
bool timing; /* requesting timing info */
bool split24; /* requesting split AIS Type 24s */
+ bool ppsbar; /* requesting PPS bar display */
int loglevel; /* requested log level of messages */
char devpath[GPS_PATH_MAX]; /* specific device to watch */
char remote[GPS_PATH_MAX]; /* ...if this was passthrough */
diff --git a/gpsd.c b/gpsd.c
index ceb3da27..338857d9 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1674,6 +1674,17 @@ static void ship_pps_drift_message(struct gps_device_t *session,
/* on PPS interrupt, ship a drift message to all clients */
{
#ifdef SOCKET_EXPORT_ENABLE
+#ifdef PPS_ENABLE
+#define PPSBAR "#----------------------------------- PPS -----------------------------------#\n"
+ struct subscriber_t *sub;
+
+ for (sub = subscribers; sub < subscribers + MAXSUBSCRIBERS; sub++) {
+ if (sub->active != 0 && subscribed(sub, session) && sub->policy.ppsbar){
+ (void)throttled_write(sub, PPSBAR, strlen(PPSBAR));
+ }
+ }
+#endif /* PPS_ENABLE */
+#undef PPSBAR
/*@-type@*//* splint is confused about struct timespec */
/*
* Yes, real_nsec is constant 0 because our "real time" is top of GPS
@@ -1684,6 +1695,7 @@ static void ship_pps_drift_message(struct gps_device_t *session,
td->real.tv_sec, td->real.tv_nsec,
td->clock.tv_sec, td->clock.tv_nsec);
/*@+type@*/
+ return;
#endif /* SOCKET_EXPORT_ENABLE */
}
#endif /* PPS_ENABLE */
diff --git a/gpsd_json.c b/gpsd_json.c
index 0b4d76a1..23109a03 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -422,14 +422,15 @@ void json_watch_dump(const struct policy_t *ccp,
{
/*@-compdef@*/
(void)snprintf(reply, replylen,
- "{\"class\":\"WATCH\",\"enable\":%s,\"json\":%s,\"nmea\":%s,\"raw\":%d,\"scaled\":%s,\"timing\":%s,\"split24\":%s,",
+ "{\"class\":\"WATCH\",\"enable\":%s,\"json\":%s,\"nmea\":%s,\"raw\":%d,\"scaled\":%s,\"timing\":%s,\"split24\":%s,\"ppsbar\":%s,",
ccp->watcher ? "true" : "false",
ccp->json ? "true" : "false",
ccp->nmea ? "true" : "false",
ccp->raw,
ccp->scaled ? "true" : "false",
ccp->timing ? "true" : "false",
- ccp->split24 ? "true" : "false");
+ ccp->split24 ? "true" : "false",
+ ccp->ppsbar ? "true" : "false");
if (ccp->devpath[0] != '\0')
(void)snprintf(reply + strlen(reply), replylen - strlen(reply),
"\"device\":\"%s\",", ccp->devpath);
diff --git a/gpsd_json.xml b/gpsd_json.xml
index 3ffd9987..92542dc7 100644
--- a/gpsd_json.xml
+++ b/gpsd_json.xml
@@ -1011,6 +1011,14 @@ object.</para>
false. Applies only to AIS reports.</entry>
</row>
<row>
+ <entry>ppsbar</entry>
+ <entry>No</entry>
+ <entry>boolean</entry>
+ <entry>If true, emit a PPS bar when the device issues 1PPS.
+ Intended to be used with the nmea and raw modes.
+ Default is false.</entry>
+</row>
+<row>
<entry>device</entry>
<entry>No</entry>
<entry>string</entry>
diff --git a/gpsmon.c b/gpsmon.c
index f6e035fb..8174c8ae 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -854,9 +854,9 @@ static /*@observer@*/ char *pps_report(struct gps_device_t *session UNUSED,
/*@-type@*/ /* splint is confused about struct timespec */
timedelta = timespec_diff_ns(td->real, td->clock) * 1e-9;
/*@+type@*/
- packet_log("-------------------------------------"
+ packet_log("#------------------------------------"
" PPS "
- "-------------------------------------\n");
+ "------------------------------------#\n");
return "gpsmon";
}
#endif /* PPS_ENABLE */
@@ -868,10 +868,10 @@ static void onsig(int sig UNUSED)
longjmp(assertbuf, 1);
}
-#define WATCHRAW "?WATCH={\"raw\":2}\r\n"
-#define WATCHRAWDEVICE "?WATCH={\"raw\":2,\"device\":\"%s\"}\r\n"
-#define WATCHNMEA "?WATCH={\"nmea\":true}\r\n"
-#define WATCHNMEADEVICE "?WATCH={\"nmea\":true,\"device\":\"%s\"}\r\n"
+#define WATCHRAW "?WATCH={\"raw\":2,\"ppsbar\":true}\r\n"
+#define WATCHRAWDEVICE "?WATCH={\"raw\":2,\"ppsbar\":true,\"device\":\"%s\"}\r\n"
+#define WATCHNMEA "?WATCH={\"nmea\":true,\"ppsbar\":true}\r\n"
+#define WATCHNMEADEVICE "?WATCH={\"nmea\":true,\"ppsbar\":true,\"device\":\"%s\"}\r\n"
int main(int argc, char **argv)
{
diff --git a/gpsmon.xml b/gpsmon.xml
index 9532e0f8..3bf3976e 100644
--- a/gpsmon.xml
+++ b/gpsmon.xml
@@ -338,9 +338,6 @@ usual. There are no per-type special commands.</para>
</refsect1>
<refsect1 id='bugs'><title>BUGS AND LIMITATIONS</title>
-<para>PPS events show in the packet window only when gpsmon is
-directly connected, not in client mode.</para>
-
<para>If you run <application>gpsmon</application> in client mode,
and kill the daemon while <application>gpsmon</application> is
still running, <application>gpsmon</application> will hang.
diff --git a/libgps_core.c b/libgps_core.c
index 567cf254..9d6b21a9 100644
--- a/libgps_core.c
+++ b/libgps_core.c
@@ -321,13 +321,14 @@ void libgps_dump_state(struct gps_data_t *collect)
collect->version.proto_minor);
if (collect->set & POLICY_SET)
(void)fprintf(debugfp,
- "POLICY: watcher=%s nmea=%s raw=%d scaled=%s timing=%s, split24=%s devpath=%s\n",
+ "POLICY: watcher=%s nmea=%s raw=%d scaled=%s timing=%s, split24=%s ppsbar=%s, devpath=%s\n",
collect->policy.watcher ? "true" : "false",
collect->policy.nmea ? "true" : "false",
collect->policy.raw,
collect->policy.scaled ? "true" : "false",
collect->policy.timing ? "true" : "false",
collect->policy.split24 ? "true" : "false",
+ collect->policy.ppsbar ? "true" : "false",
collect->policy.devpath);
if (collect->set & SATELLITE_SET) {
int i;
diff --git a/shared_json.c b/shared_json.c
index 7c87c3e6..9c8320db 100644
--- a/shared_json.c
+++ b/shared_json.c
@@ -97,6 +97,7 @@ int json_watch_read(const char *buf,
{"scaled", t_boolean, .addr.boolean = &ccp->scaled},
{"timing", t_boolean, .addr.boolean = &ccp->timing},
{"split24", t_boolean, .addr.boolean = &ccp->split24},
+ {"ppsbar", t_boolean, .addr.boolean = &ccp->ppsbar},
{"device", t_string, .addr.string = ccp->devpath,
.len = sizeof(ccp->devpath)},
{"remote", t_string, .addr.string = ccp->remote,