diff options
-rw-r--r-- | gps.h | 1 | ||||
-rw-r--r-- | gpsd.c | 12 | ||||
-rw-r--r-- | gpsd_json.c | 5 | ||||
-rw-r--r-- | gpsd_json.xml | 8 | ||||
-rw-r--r-- | gpsmon.c | 12 | ||||
-rw-r--r-- | gpsmon.xml | 3 | ||||
-rw-r--r-- | libgps_core.c | 3 | ||||
-rw-r--r-- | shared_json.c | 1 |
8 files changed, 33 insertions, 12 deletions
@@ -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 */ @@ -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> @@ -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) { @@ -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, |