diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-06-29 16:28:48 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-06-29 16:28:48 +0000 |
commit | cba6b916920d78ef3e002061f1229d6c4debecac (patch) | |
tree | 68c377b24671f916d36d78e83d7738f7d633c517 | |
parent | 1391a44aa66d71f74fa2513c16c8ae61e6a4e2ee (diff) | |
download | gpsd-cba6b916920d78ef3e002061f1229d6c4debecac.tar.gz |
Clean up DGPSIP a bit more, some variables don't need to be per-session.
-rw-r--r-- | dgpsip.c | 8 | ||||
-rw-r--r-- | gpsd.c | 5 | ||||
-rw-r--r-- | gpsd.h | 8 | ||||
-rw-r--r-- | libgpsd_core.c | 2 |
4 files changed, 14 insertions, 9 deletions
@@ -71,8 +71,12 @@ void dgpsip_relay(struct gps_device_t *session) void dgpsip_report(struct gps_device_t *session) /* may be time to ship a usage report to the DGPSIP server */ { - if (session->fixcnt > 10 && !session->sentdgps) { - session->sentdgps = true; + /* + * 10 is an arbitrary number, the point is to have gotten several good + * fixes before reporting usage to our DGPSIP server. + */ + if (session->context->fixcnt > 10 && !session->context->sentdgps) { + session->context->sentdgps = true; if (session->context->dsock > -1) { char buf[BUFSIZ]; (void)snprintf(buf, sizeof(buf), "R %0.8f %0.8f %0.2f\r\n", @@ -59,8 +59,9 @@ static int debuglevel; static bool in_background = false; static jmp_buf restartbuf; /*@ -initallelements -nullassign -nullderef @*/ -static struct gps_context_t context = {0, LEAP_SECONDS, CENTURY_BASE, - 0, 0, {'\0'}, 0, +static struct gps_context_t context = {0, + false, 0, 0, 0, {'\0'}, 0, + LEAP_SECONDS, CENTURY_BASE, #ifdef NTPSHM_ENABLE {0}, {0}, @@ -32,12 +32,14 @@ struct gps_context_t { int valid; #define LEAP_SECOND_VALID 0x01 /* we have or don't need correction */ - int leap_seconds; - int century; /* for NMEA-only devices without ZDA */ + bool sentdgps; /* have we sent a DGPSIP R report? */ + int fixcnt; /* count of good fixes seen */ int dsock; /* socket to DGPS server */ ssize_t rtcmbytes; /* byte count of last RTCM104 report */ char rtcmbuf[40]; /* last RTCM104 report */ double rtcmtime; /* timestamp of last RTCM104 report */ + int leap_seconds; + int century; /* for NMEA-only devices without ZDA */ #ifdef NTPSHM_ENABLE /*@reldef@*/struct shmTime *shmTime[NTPSHMSEGS]; bool shmTimeInuse[NTPSHMSEGS]; @@ -86,8 +88,6 @@ struct gps_device_t { struct gps_data_t gpsdata; /*@relnull@*/struct gps_type_t *device_type; double rtcmtime; /* timestamp of last RTCM104 correction to GPS */ - bool sentdgps; /* have we sent a DGPSIP usage report? */ - int fixcnt; /* count of good fixes seen */ struct termios ttyset, ttyset_old; /* packet-getter internals */ int packet_type; diff --git a/libgpsd_core.c b/libgpsd_core.c index f9447c26..049b5874 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -436,7 +436,7 @@ gps_mask_t gpsd_poll(struct gps_device_t *session) /* count all packets and good fixes */ session->counter++; if (session->gpsdata.status > STATUS_NO_FIX) - session->fixcnt++; + session->context->fixcnt++; /* * Now we compute derived quantities. This is where the tricky error- |