diff options
-rw-r--r-- | driver_evermore.c | 1 | ||||
-rw-r--r-- | driver_garmin.c | 2 | ||||
-rw-r--r-- | driver_italk.c | 1 | ||||
-rw-r--r-- | driver_navcom.c | 1 | ||||
-rw-r--r-- | driver_sirf.c | 1 | ||||
-rw-r--r-- | driver_superstar2.c | 2 | ||||
-rw-r--r-- | driver_tsip.c | 1 | ||||
-rw-r--r-- | driver_ubx.c | 1 | ||||
-rw-r--r-- | driver_zodiac.c | 1 | ||||
-rw-r--r-- | drivers.c | 10 | ||||
-rw-r--r-- | gps.h | 2 | ||||
-rw-r--r-- | gpsd.c | 8 | ||||
-rw-r--r-- | gpsd.h-tail | 2 | ||||
-rw-r--r-- | libgpsd_core.c | 6 | ||||
-rw-r--r-- | www/writing-a-driver.xml | 20 |
15 files changed, 23 insertions, 36 deletions
diff --git a/driver_evermore.c b/driver_evermore.c index 67ae672c..bcdb27bf 100644 --- a/driver_evermore.c +++ b/driver_evermore.c @@ -536,6 +536,5 @@ const struct gps_type_t evermore_binary = .revert = evermore_revert, /* reversion code */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* wrapup method */ - .cycle = 1, /* updates every second */ }; #endif /* defined(EVERMORE_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_garmin.c b/driver_garmin.c index 44fe1e2d..b968c13b 100644 --- a/driver_garmin.c +++ b/driver_garmin.c @@ -1213,7 +1213,6 @@ const struct gps_type_t garmin_usb_binary = .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = garmin_close, /* close hook */ - .cycle = 1, /* updates every second */ }; const struct gps_type_t garmin_ser_binary = @@ -1240,7 +1239,6 @@ const struct gps_type_t garmin_ser_binary = .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* close hook */ - .cycle = 1, /* updates every second */ }; #endif /* GARMIN_ENABLE */ diff --git a/driver_italk.c b/driver_italk.c index 4a51e384..22ed5e3d 100644 --- a/driver_italk.c +++ b/driver_italk.c @@ -388,7 +388,6 @@ const struct gps_type_t italk_binary = .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no close hook */ - .cycle = 1, /* updates every second */ }; #endif /* defined(ITRAX_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_navcom.c b/driver_navcom.c index 0e21669a..40c0ea7e 100644 --- a/driver_navcom.c +++ b/driver_navcom.c @@ -1272,7 +1272,6 @@ const struct gps_type_t navcom_binary = .revert = NULL, /* no reversion code */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* ignore, no wrapup */ - .cycle = 1, /* updates every second */ }; #endif /* defined(NAVCOM_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_sirf.c b/driver_sirf.c index 03ee12eb..31639a8e 100644 --- a/driver_sirf.c +++ b/driver_sirf.c @@ -1001,6 +1001,5 @@ const struct gps_type_t sirf_binary = .revert = sirfbin_revert, /* no reversion code */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no close hook */ - .cycle = 1, /* updates every second */ }; #endif /* defined(SIRF_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_superstar2.c b/driver_superstar2.c index c6aba5c5..ee2b1393 100644 --- a/driver_superstar2.c +++ b/driver_superstar2.c @@ -566,7 +566,5 @@ const struct gps_type_t superstar2_binary = { #endif /* ALLOW_RECONFIGURE */ /* Puts device back to original settings */ .wrapup = NULL, - /* Number of updates per second */ - .cycle = 1 }; #endif /* defined(SUPERSTAR2_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_tsip.c b/driver_tsip.c index 4f73aad3..52c97873 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -857,7 +857,6 @@ const struct gps_type_t tsip_binary = .revert = NULL, /* FIXME: revert sentence mix */ #endif /* ALLOW_RECONFIGURE */ .wrapup = tsip_wrapup, /* restore comms parameters */ - .cycle = 1, /* updates every second */ }; #endif /* TSIP_ENABLE */ diff --git a/driver_ubx.c b/driver_ubx.c index dd0b1507..f8699587 100644 --- a/driver_ubx.c +++ b/driver_ubx.c @@ -707,6 +707,5 @@ const struct gps_type_t ubx_binary = { .revert = ubx_revert, /* Undo the actions of .configurator */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* Puts device back to original settings */ - .cycle = 1 /* Number of updates per second */ }; #endif /* defined(UBX_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_zodiac.c b/driver_zodiac.c index d65bf98d..2104bd73 100644 --- a/driver_zodiac.c +++ b/driver_zodiac.c @@ -486,7 +486,6 @@ const struct gps_type_t zodiac_binary = .revert = NULL, /* no reversion hook */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* caller might supply a close hook */ - .cycle = 1, /* updates every second */ }; #endif /* ZODIAC_ENABLE */ @@ -262,7 +262,6 @@ const struct gps_type_t nmea = { .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ - .cycle = 1, /* updates every second */ }; #if defined(GARMIN_ENABLE) && defined(NMEA_ENABLE) @@ -352,7 +351,6 @@ const struct gps_type_t garmin = { .revert = NULL, /* no setting-reversion method */ #endif /*ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ - .cycle = 1, /* updates every second */ }; #endif /* GARMIN_ENABLE && NMEA_ENABLE */ @@ -415,7 +413,6 @@ const struct gps_type_t ashtech = { .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ - .cycle = 1, /* updates every second */ }; #endif /* ASHTECH_ENABLE */ @@ -462,7 +459,6 @@ const struct gps_type_t fv18 = { .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ - .cycle = 1, /* updates every second */ }; #endif /* FV18_ENABLE */ @@ -512,7 +508,6 @@ const struct gps_type_t gpsclock = { .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ - .cycle = 1, /* updates every second */ }; #endif /* GPSCLOCK_ENABLE */ @@ -570,7 +565,6 @@ static const struct gps_type_t tripmate = { .revert = NULL, /* no reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ - .cycle = 1, /* updates every second */ }; #endif /* TRIPMATE_ENABLE */ @@ -618,7 +612,6 @@ static const struct gps_type_t earthmate = { .revert = NULL, /* no reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup code */ - .cycle = 1, /* updates every second */ }; /*@ -redef @*/ #endif /* EARTHMATE_ENABLE */ @@ -911,7 +904,6 @@ static const struct gps_type_t rtcm104v2 = { .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup code */ - .cycle = 1, /* updates every second */ }; #endif /* RTCM104V2_ENABLE */ #ifdef RTCM104V3_ENABLE @@ -955,7 +947,6 @@ static const struct gps_type_t rtcm104v3 = { .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup code */ - .cycle = 1, /* updates every second */ }; #endif /* RTCM104V3_ENABLE */ @@ -1091,7 +1082,6 @@ const struct gps_type_t mkt3301 = { .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ - .cycle = 1, /* updates every second */ }; #endif /* MKT3301_ENABLE */ @@ -580,6 +580,8 @@ struct gps_data_t { double emit_time; /* emission time (-> E2) */ double c_recv_time; /* client receipt time (-> T2) */ double c_decode_time; /* client end-of-decode time (-> D2) */ + + /* reporting cycle time and minimum */ double cycle, mincycle; /* refresh cycle time in seconds */ /* these members are private */ @@ -805,14 +805,14 @@ static int handle_gpsd_request(struct subscriber_t* sub, char *buf, int buflen) if (cycle >= mincycle) if (dev->rate_switcher != NULL) if (dev->rate_switcher(sub->device, cycle)) - sub->device->cycle = cycle; + sub->device->gpsdata.cycle = cycle; } if (dev->rate_switcher == NULL) (void)snprintf(phrase, sizeof(phrase), - ",C=%.2f", sub->device->cycle); + ",C=%.2f", sub->device->gpsdata.cycle); else - (void)snprintf(phrase, sizeof(phrase), - ",C=%.2f %.2f", sub->device->cycle, mincycle); + (void)snprintf(phrase, sizeof(phrase), ",C=%.2f %.2f", + sub->device->gpsdata.cycle, mincycle); } break; #endif /* ALLOW_RECONFIGURE */ diff --git a/gpsd.h-tail b/gpsd.h-tail index c1bab8b9..2c2c9946 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -207,7 +207,6 @@ struct gps_type_t { /*@null@*/void (*revert)(struct gps_device_t *session); #endif /* ALLOW_RECONFIGURE */ /*@null@*/void (*wrapup)(struct gps_device_t *session); - double cycle; }; struct gps_device_t { @@ -222,7 +221,6 @@ struct gps_device_t { struct termios ttyset, ttyset_old; unsigned int baudindex; int saved_baud; - double cycle; struct gps_packet_t packet; char subtype[64]; /* firmware version or subtype ID */ double poll_times[FD_SETSIZE]; /* last daemon poll time */ diff --git a/libgpsd_core.c b/libgpsd_core.c index a0f88473..4cbae854 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -47,8 +47,6 @@ int gpsd_switch_driver(struct gps_device_t *session, char* type_name) gpsd_report(LOG_PROG, "selecting %s driver...\n", (*dp)->type_name); gpsd_assert_sync(session); /*@i@*/session->device_type = *dp; - if (session->cycle <= 0) - session->cycle = (*dp)->cycle; if (!session->context->readonly && session->device_type->probe_subtype != NULL) session->device_type->probe_subtype(session, session->packet.counter = 0); #ifdef ALLOW_RECONFIGURE @@ -89,6 +87,7 @@ void gpsd_init(struct gps_device_t *session, struct gps_context_t *context, char session->gpsdata.gdop = NAN; session->gpsdata.epe = NAN; session->mag_var = NAN; + session->gpsdata.cycle = session->gpsdata.mincycle = 1; /* tty-level initialization */ gpsd_tty_init(session); @@ -778,7 +777,8 @@ gps_mask_t gpsd_poll(struct gps_device_t *session) session->gpsdata.online = 0; return 0; } else if (newlen == 0) { /* no new data */ - if (session->device_type != NULL && timestamp()>session->gpsdata.online+session->device_type->cycle+1){ + if (session->device_type != NULL && timestamp()>session->gpsdata.online+session->gpsdata. +cycle+1){ gpsd_report(LOG_INF, "GPS on %s is offline (%lf sec since data)\n", session->gpsdata.gps_device, timestamp() - session->gpsdata.online); diff --git a/www/writing-a-driver.xml b/www/writing-a-driver.xml index 035cb5ee..6b6c673b 100644 --- a/www/writing-a-driver.xml +++ b/www/writing-a-driver.xml @@ -16,6 +16,14 @@ <revhistory> <revision> + <revnumber>1.6</revnumber> + <date>1 Mar 2009</date> + <authorinitials>er</authorinitials> + <revremark> + Updated by esr to reflect removal of the cycle member. + </revremark> + </revision> + <revision> <revnumber>1.5</revnumber> <date>1 Mar 2009</date> <authorinitials>er</authorinitials> @@ -623,7 +631,6 @@ binary mode (1).</para> to change the maximum number of fixes your device can generate in 1 second.</para> -<!-- added by ESR, 2009 --> <para><structfield>.control_send</structfield> points to a block of code that can take a buffer full of message payload, wrap iit in appropriate headers and trailers and checksumming, and ship it to the @@ -660,22 +667,23 @@ which is run unconditionally each time the device is to be closed. also where you should undo any port parameter changes you made in <structfield>.probe_detect</structfield>above.</para> -<para><structfield>.cycle</structfield> is a number giving the number of +<!-- deleted by ESR, 2009 --> +<!-- <para><structfield>.cycle</structfield> is a number giving the number of fixes per second you can get. Gets updated if you can rate-switch -and user gives a <application>gpsd</application> 'C' command.</para> +and user gives a <application>gpsd</application> 'C' command.</para> --> +<!-- modified by ESR, 2009 --> <para>The connection between some of the above was confirmed with Eric Raymond as follows.</para> <para>The inter-relationship between <structfield>.speed_switcher</structfield>, <structfield>.rate_switcher</structfield>, -<structfield>.cycle_chars</structfield> and -<structfield>.cycle</structfield> is:-</para> <para>If we can change +<structfield>.cycle_chars</structfield> is:-</para> <para>If we can change baud rate (<structfield>.speed_switcher</structfield>) and we can alter the rate at which fixes are delivered (<structfield>.rate_switcher</structfield>), then we need to know the number of characters in a fix string (<structfield>.cycle_chars</structfield>) so that we can compute the -number of fixes/second (<structfield>.cycle</structfield>) we can ask +minimum reporting cycle time we can ask for.</para> </sect1> |