diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-03-07 15:32:23 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-03-07 15:32:23 +0000 |
commit | 0f3dfccad575ac35ef0c41beb3c6340c1b2d1939 (patch) | |
tree | 3ffde35783e7d84a842f61597bca19992a551038 | |
parent | 964fa5d02a151ed772a7eb36df0543fa98b9ab39 (diff) | |
download | gpsd-0f3dfccad575ac35ef0c41beb3c6340c1b2d1939.tar.gz |
.cycle_chars is gone, replaced by min_cycle.
-rw-r--r-- | driver_evermore.c | 2 | ||||
-rw-r--r-- | driver_garmin.c | 7 | ||||
-rw-r--r-- | driver_italk.c | 31 | ||||
-rw-r--r-- | driver_navcom.c | 6 | ||||
-rw-r--r-- | driver_proto.c | 6 | ||||
-rw-r--r-- | driver_sirf.c | 2 | ||||
-rw-r--r-- | driver_superstar2.c | 4 | ||||
-rw-r--r-- | driver_tsip.c | 2 | ||||
-rw-r--r-- | driver_ubx.c | 4 | ||||
-rw-r--r-- | driver_zodiac.c | 2 | ||||
-rw-r--r-- | drivers.c | 32 | ||||
-rw-r--r-- | gpsd.c | 10 | ||||
-rw-r--r-- | gpsd.xml | 37 | ||||
-rw-r--r-- | libgpsd_core.c | 1 | ||||
-rw-r--r-- | www/hacking.html | 35 | ||||
-rw-r--r-- | www/writing-a-driver.xml | 32 |
16 files changed, 94 insertions, 119 deletions
diff --git a/driver_evermore.c b/driver_evermore.c index bcdb27bf..40a8a10b 100644 --- a/driver_evermore.c +++ b/driver_evermore.c @@ -532,7 +532,7 @@ const struct gps_type_t evermore_binary = .speed_switcher = evermore_speed, /* we can change baud rates */ .mode_switcher = evermore_mode, /* there is a mode switcher */ .rate_switcher = evermore_rate_switcher, /* change sample rate */ - .cycle_chars = -1, /* ignore, no rate switch */ + .min_cycle = 1, /* ignore, no rate switch */ .revert = evermore_revert, /* reversion code */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* wrapup method */ diff --git a/driver_garmin.c b/driver_garmin.c index b968c13b..df0bc898 100644 --- a/driver_garmin.c +++ b/driver_garmin.c @@ -1181,11 +1181,10 @@ const struct gps_type_t garmin_usb_binary_old = .speed_switcher = NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = garmin_close, /* close hook */ - .cycle = 1, /* updates every second */ }; #endif /* __UNUSED__ */ @@ -1209,7 +1208,7 @@ const struct gps_type_t garmin_usb_binary = .speed_switcher = NULL, /* no speed switcher */ .mode_switcher = garmin_switcher, /* how to change modes */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = garmin_close, /* close hook */ @@ -1235,7 +1234,7 @@ const struct gps_type_t garmin_ser_binary = .speed_switcher = NULL, /* no speed switcher */ .mode_switcher = garmin_switcher, /* how to change modes */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* close hook */ diff --git a/driver_italk.c b/driver_italk.c index 22ed5e3d..13cab290 100644 --- a/driver_italk.c +++ b/driver_italk.c @@ -384,7 +384,7 @@ const struct gps_type_t italk_binary = .speed_switcher = italk_speed, /* we can change baud rates */ .mode_switcher = italk_mode, /* there is a mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no close hook */ @@ -492,29 +492,28 @@ static void itrax_wrap(struct gps_device_t *session) /*@ -redef @*/ const static struct gps_type_t itrax = { - .type_name = "iTrax", /* full name of type */ + .type_name = "iTrax", /* full name of type */ .packet_type = NMEA_PACKET; /* associated lexer packet type */ - .trigger = "$PFST,OK", /* tells us to switch to Itrax */ - .channels = 12, /* consumer-grade GPS */ - .probe_wakeup = NULL, /* no wakeup to be done before hunt */ - .probe_detect = NULL, /* no probe */ - .probe_subtype = itrax_probe_subtype, /* initialize */ - .get_packet = generic_get, /* how to get a packet */ - .parse_packet = nmea_parse_input, /* how to interpret a packet */ - .rtcm_writer = NULL, /* iTrax doesn't support DGPS/WAAS/EGNOS */ + .trigger = "$PFST,OK", /* tells us to switch to Itrax */ + .channels = 12, /* consumer-grade GPS */ + .probe_wakeup = NULL, /* no wakeup to be done before hunt */ + .probe_detect = NULL, /* no probe */ + .probe_subtype = itrax_probe_subtype, /* initialize */ + .get_packet = generic_get, /* how to get a packet */ + .parse_packet = nmea_parse_input, /* how to interpret a packet */ + .rtcm_writer = NULL, /* iTrax doesn't support DGPS/WAAS/EGNOS */ #ifdef ALLOW_CONTROLSEND .control_send = garmin_control_send, /* send raw bytes */ #endif /* ALLOW_CONTROLSEND */ #ifdef ALLOW_RECONFIGURE - .configurator = itrax_configurator,/* set synchronous mode */ - .speed_switcher= itrax_speed, /* how to change speeds */ - .mode_switcher = NULL, /* no mode switcher */ - .rate_switcher = itrax_rate, /* there's a sample-rate switcher */ - .cycle_chars = 438, /* change cycle time */ + .configurator = itrax_configurator,/* set synchronous mode */ + .speed_switcher = itrax_speed, /* how to change speeds */ + .mode_switcher = NULL, /* no mode switcher */ + .rate_switcher = itrax_rate, /* there's a sample-rate switcher */ + .min_cycle = 0, /* no hard limit */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = itrax_wrap, /* sleep the receiver */ - .cycle = 1, /* updates every second */ }; /*@ -redef @*/ #endif /* ITRAX_ENABLE */ diff --git a/driver_navcom.c b/driver_navcom.c index 40c0ea7e..af05cf22 100644 --- a/driver_navcom.c +++ b/driver_navcom.c @@ -1268,10 +1268,10 @@ const struct gps_type_t navcom_binary = .speed_switcher = navcom_speed, /* we do change baud rates */ .mode_switcher = NULL, /* there is not a mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* ignore, no rate switch */ - .revert = NULL, /* no reversion code */ + .min_cycle = 1, /* ignore, no rate switch */ + .revert = NULL, /* no reversion code */ #endif /* ALLOW_RECONFIGURE */ - .wrapup = NULL, /* ignore, no wrapup */ + .wrapup = NULL, /* ignore, no wrapup */ }; #endif /* defined(NAVCOM_ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_proto.c b/driver_proto.c index 9aaacee5..6211d198 100644 --- a/driver_proto.c +++ b/driver_proto.c @@ -421,15 +421,13 @@ const struct gps_type_t _proto__binary = { .mode_switcher = _proto__set_mode, /* Message delivery rate switcher (not active) */ .rate_switcher = NULL, - /* Number of chars per report cycle (not active) */ - .cycle_chars = -1, + /* Minimum cycle time of the device */ + .min_cycle = 1, /* Undo the actions of .configurator */ .revert = _proto__revert, #endif /* ALLOW_RECONFIGURE */ /* Puts device back to original settings */ .wrapup = _proto__wrapup, - /* Number of updates per second */ - .cycle = 1 }; #endif /* defined(_PROTO__ENABLE) && defined(BINARY_ENABLE) */ diff --git a/driver_sirf.c b/driver_sirf.c index 31639a8e..607ce162 100644 --- a/driver_sirf.c +++ b/driver_sirf.c @@ -997,7 +997,7 @@ const struct gps_type_t sirf_binary = .speed_switcher = sirfbin_speed, /* we can change baud rate */ .mode_switcher = sirfbin_mode, /* there's a mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = sirfbin_revert, /* no reversion code */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no close hook */ diff --git a/driver_superstar2.c b/driver_superstar2.c index ee2b1393..6f87cba0 100644 --- a/driver_superstar2.c +++ b/driver_superstar2.c @@ -559,8 +559,8 @@ const struct gps_type_t superstar2_binary = { .mode_switcher = superstar2_set_mode, /* Message delivery rate switcher (not active) */ .rate_switcher = NULL, - /* Number of chars per report cycle (not active) */ - .cycle_chars = -1, + /* Minimum cycle time (not used) */ + .min_cycle = 1, /* Undo the actions of .configurator */ .revert = NULL, #endif /* ALLOW_RECONFIGURE */ diff --git a/driver_tsip.c b/driver_tsip.c index 52c97873..158857ae 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -853,7 +853,7 @@ const struct gps_type_t tsip_binary = .speed_switcher = tsip_speed_switch,/* change baud rate */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switcher */ + .min_cycle = 1, /* not relevant, no rate switcher */ .revert = NULL, /* FIXME: revert sentence mix */ #endif /* ALLOW_RECONFIGURE */ .wrapup = tsip_wrapup, /* restore comms parameters */ diff --git a/driver_ubx.c b/driver_ubx.c index f8699587..6ae128bf 100644 --- a/driver_ubx.c +++ b/driver_ubx.c @@ -702,8 +702,8 @@ const struct gps_type_t ubx_binary = { .configurator = ubx_configure, /* Enable what reports we need */ .speed_switcher = ubx_speed, /* Speed (baudrate) switch */ .mode_switcher = ubx_nmea_mode, /* Switch to NMEA mode */ - .rate_switcher = ubx_rate, /* Message delivery rate switcher */ - .cycle_chars = -1, /* Number of chars per report cycle */ + .rate_switcher = ubx_rate, /* Message delivery rate switcher */ + .min_cycle = 0.25, /* Maximum 4Hz sample rate */ .revert = ubx_revert, /* Undo the actions of .configurator */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* Puts device back to original settings */ diff --git a/driver_zodiac.c b/driver_zodiac.c index 2104bd73..a77a2f00 100644 --- a/driver_zodiac.c +++ b/driver_zodiac.c @@ -482,7 +482,7 @@ const struct gps_type_t zodiac_binary = .speed_switcher = zodiac_speed_switch,/* we can change baud rate */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no reversion hook */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* caller might supply a close hook */ @@ -258,7 +258,7 @@ const struct gps_type_t nmea = { .speed_switcher = NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ @@ -347,7 +347,7 @@ const struct gps_type_t garmin = { .speed_switcher = NULL, /* no speed switcher */ .mode_switcher = garmin_mode_switch, /* mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /*ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ @@ -409,7 +409,7 @@ const struct gps_type_t ashtech = { .speed_switcher = NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ @@ -455,7 +455,7 @@ const struct gps_type_t fv18 = { .speed_switcher = NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ @@ -504,7 +504,7 @@ const struct gps_type_t gpsclock = { .speed_switcher = NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* sample rate is fixed */ - .cycle_chars = -1, /* sample rate is fixed */ + .min_cycle = 1, /* sample rate is fixed */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ @@ -561,7 +561,7 @@ static const struct gps_type_t tripmate = { .speed_switcher= NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* no rate switch */ + .min_cycle = 1, /* no rate switch */ .revert = NULL, /* no reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ @@ -608,7 +608,7 @@ static const struct gps_type_t earthmate = { .speed_switcher= NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* no rate switch */ + .min_cycle = 1, /* no rate switch */ .revert = NULL, /* no reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup code */ @@ -757,8 +757,9 @@ static bool tnt_probe(struct gps_device_t *session) { gpsd_report(LOG_PROG, "hunting at speed %d\n", *ip); gpsd_set_speed(session, *ip, 'N',1); - if (tnt_packet_sniff(session) != BAD_PACKET) + if (tnt_packet_sniff(session) != BAD_PACKET) { return true; + } } return false; } @@ -782,11 +783,10 @@ static const struct gps_type_t trueNorth = { .speed_switcher = NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no wrapup */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 0.5, /* fixed at 20 samples per second */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ - .cycle = 20, /* updates per second */ }; #endif @@ -856,11 +856,10 @@ static const struct gps_type_t oceanServer = { .speed_switcher = NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no wrapup */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ - .cycle = 20, /* updates per second */ }; #endif @@ -900,7 +899,7 @@ static const struct gps_type_t rtcm104v2 = { .speed_switcher= NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup code */ @@ -943,7 +942,7 @@ static const struct gps_type_t rtcm104v3 = { .speed_switcher= NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup code */ @@ -983,11 +982,10 @@ static const struct gps_type_t garmintxt = { .speed_switcher= NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup code */ - .cycle = 1, /* updates every second */ }; #endif /* GARMINTXT_ENABLE */ @@ -1078,7 +1076,7 @@ const struct gps_type_t mkt3301 = { .speed_switcher = NULL, /* no speed switcher */ .mode_switcher = NULL, /* no mode switcher */ .rate_switcher = NULL, /* no sample-rate switcher */ - .cycle_chars = -1, /* not relevant, no rate switch */ + .min_cycle = 1, /* not relevant, no rate switch */ .revert = NULL, /* no setting-reversion method */ #endif /* ALLOW_RECONFIGURE */ .wrapup = NULL, /* no wrapup */ @@ -799,20 +799,18 @@ static int handle_gpsd_request(struct subscriber_t* sub, char *buf, int buflen) (void)strlcpy(phrase, ",C=?", BUFSIZ); else { const struct gps_type_t *dev = sub->device->device_type; - double mincycle = (dev->cycle_chars * 10.0) / sub->device->gpsdata.baudrate; if (*p == '=' && privileged_user(sub)) { double cycle = strtod(++p, &p); - if (cycle >= mincycle) - if (dev->rate_switcher != NULL) - if (dev->rate_switcher(sub->device, cycle)) - sub->device->gpsdata.cycle = cycle; + if (dev->rate_switcher != NULL && cycle >= dev->min_cycle) + if (dev->rate_switcher(sub->device, cycle)) + sub->device->gpsdata.cycle = cycle; } if (dev->rate_switcher == NULL) (void)snprintf(phrase, sizeof(phrase), ",C=%.2f", sub->device->gpsdata.cycle); else (void)snprintf(phrase, sizeof(phrase), ",C=%.2f %.2f", - sub->device->gpsdata.cycle, mincycle); + sub->device->gpsdata.cycle, sub->device->gpsdata.cycle); } break; #endif /* ALLOW_RECONFIGURE */ @@ -291,9 +291,9 @@ channel.</para> <para>If the driver has the capability to change sampling rate, this command always returns "C=%f %f" giving the current cycle time in -seconds and the minimum possible cycle time at the current baud rate. -If the driver does not have the capability to change sampling rate, -this returns, as "C=%f", the cycle time in seconds only.</para> +seconds and the minimum possible cycle time. If the driver does not +have the capability to change sampling rate, this returns, as "C=%f", +the cycle time in seconds only.</para> <para>Either number may be fractional, indicating a GPS cycle shorter than a second; however, if >1 the cycle time must be a whole number. Also @@ -305,7 +305,36 @@ this works.</para> first full packet has been received from the GPS, because the GPS type is not yet known. To set up conditions for a real answer, issue it after some command that reads position/velocity/time information from the -device.</para></listitem> +device.</para> + +<!-- +<para>The second field of the C return may be 0, indicating no hard +lower limit on the cycle time. On an NMEA device of this kind it is +possible to try to push more characters through per cycle than the +time to transmit will allow. You must set the time high enough to let +all sentences come through. Here are the maxima to use for +computation:</para> + +<table frame='all'> +<tgroup cols='2'> +<tbody> +<row><entry>ZDA </entry><entry>36</entry></row> +<row><entry>GLL </entry><entry>47</entry></row> +<row><entry>GGA </entry><entry>82</entry></row> +<row><entry>VTG </entry><entry>46</entry></row> +<row><entry>RMC </entry><entry>77</entry></row> +<row><entry>GSA </entry><entry>67</entry></row> +<row><entry>GSV </entry><entry>60 (per line, thus 180 for a set of 3)</entry> </row> +</tbody> +</tgroup> +</table> + +<para>The transmit time for a cycle (which must be less than 1 second) +is the total character count multiplied by 10 and divided by the baud +rate. A typical budget is GGA, RMC, GSA, 3*GSV = 82+75+67+(3*60) = +404.</para> +--> +</listitem> </varlistentry> diff --git a/libgpsd_core.c b/libgpsd_core.c index 4cbae854..8905702e 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -47,6 +47,7 @@ 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; + session->gpsdata.mincycle = session->device_type->min_cycle; if (!session->context->readonly && session->device_type->probe_subtype != NULL) session->device_type->probe_subtype(session, session->packet.counter = 0); #ifdef ALLOW_RECONFIGURE diff --git a/www/hacking.html b/www/hacking.html index ffac068e..9ee7f89b 100644 --- a/www/hacking.html +++ b/www/hacking.html @@ -105,7 +105,6 @@ file in the source distribution.</p> <li><a href="#reports">Where to put the data you get from the GPS</a></li> <li><a href="#confidence">Report errors with a 95% confidence interval</a></li> <li><a href="#logfiles">Log files for regression testing</a></li> -<li><a href="#throughput">Throughput computation for baud rate changes</a></li> </ol> <li><a href="#buffering">The buffering problem</a></li> <ol> @@ -995,7 +994,7 @@ the null-terminated array in drivers.c.</p> it should live in its own C source file named after the driver type. Add it to the libgps_c_sources name list in Makefile.am</p> -<p>The easiest way write a driver is probably to copy the driver_proto.c +<p>The easiest way to write a driver is probably to copy the driver_proto.c file in the source distribution, change names appropriately, and write the guts of the analyzer and writer functions. Look in gpsutils.c before you do; driver helper functions live there. Also read some @@ -1005,7 +1004,7 @@ existing drivers for clues.</p> On Writing A GPSD Driver.</a></para> <p>There's a second kind of driver architecture for -<code>gpsmon</code>, the real-timr packet monitor and diagnostic tool. +<code>gpsmon</code>, the real-time packet monitor and diagnostic tool. It works from monitor-object definitions that include a pointer to the device driver for the GPS type you want to monitor. See monitor_proto.c for a prototype and technical details.</p> @@ -1151,36 +1150,6 @@ logfile format.</p> portion during which the GPS has no fix, a portion during which it has a fix but is stationary, and a portion during which it is moving.</p> -<h3 id="throughput">Throughput computation for baud rate changes</h3> - -<p>At low baud rates it is possible to try to push more characters of -NMEA through per cycle than the time to transmit will allow. Here -are the maxima to use for computation:</p> - -<div> </div> - -<table border='1'> -<tr><td>ZDA </td><td>36</td></tr> -<tr><td>GLL </td><td>47</td></tr> -<tr><td>GGA </td><td>82</td></tr> -<tr><td>VTG </td><td>46</td></tr> -<tr><td>RMC </td><td>77</td></tr> -<tr><td>GSA </td><td>67</td></tr> -<tr><td>GSV </td><td>60 (per line, thus 180 for a set of 3)</td></tr> -</table> - -<p>The transmit time for a cycle (which must be less than 1 second) -is the total character count multiplied by 10 and divided by the -baud rate.</p> - -<p>A typical budget is GGA, RMC, GSA, 3*GSV = 82+75+67+(3*60) = 404.</p> - -<p>When you write a driver that includes the capability to change -sampling rates, you must fill in the cycle_chars member with -a maximum character length so the daemon framework code will -be able to compute when a sample-rate change will work. If -you have to estimate this number, err on the high side.</p> - <h1 id="buffering">The buffering problem</h1> <p>Considered in the abstract, the cleanest thing for a diff --git a/www/writing-a-driver.xml b/www/writing-a-driver.xml index 6b6c673b..13834893 100644 --- a/www/writing-a-driver.xml +++ b/www/writing-a-driver.xml @@ -616,10 +616,9 @@ write of the data, which is provided by the default routine <function>pass_rtcm</function>. If the device does not accept differential data, the value is NULL.</para> -<!-- modified by ESR, 2009 --> <para><structfield>.speed_switcher</structfield> points to a block of code to change baud rate, parity, and stop bits (if supported). If -your ddevice can support some speed/parity/stopbits combinations but +your device can support some speed/parity/stopbits combinations but not others, it should return false on a mode-change request it can't handle.</para> @@ -629,7 +628,10 @@ binary mode (1).</para> <para><structfield>.rate_switcher</structfield> points to a block of code to change the maximum number of fixes your device can generate -in 1 second.</para> +in 1 second. If this method is present, you should also fill in +<structfield>.min_cycle</structfield> tio indicate the device's +minimum cycle time in seconds; a 0 value indicates that it is limited +only by yjr data throughput of the reporting channel.</para> <para><structfield>.control_send</structfield> points to a block of code that can take a buffer full of message payload, wrap iit in @@ -643,11 +645,12 @@ possible, assemble your packet in <structfield>session->msgbuflen</structfield>; this will allow gpsmon to display the control messages it sends for you.</para> -<para><structfield>.cycle_chars</structfield> is explained in +<!-- deleted by ESR, 2009 --> +<!-- <para><structfield>.cycle_chars</structfield> is explained in <quote>Throughput computation for baud rate changes</quote> in the <quote>Hacker's Guide to GPSD</quote> in the general documentation. It's only necessary to fill this in if you have -<structfield>.rate_switcher</structfield> capability</para> +<structfield>.rate_switcher</structfield> capability</para> --> <para><structfield>.revert</structfield> points to a block of code that is conditionally run each time the device is closed if @@ -666,25 +669,6 @@ which is run unconditionally each time the device is to be closed. <quote><option>-n</option> </quote> switch is not active.) This is also where you should undo any port parameter changes you made in <structfield>.probe_detect</structfield>above.</para> - -<!-- 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> --> - -<!-- 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> 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 -minimum reporting cycle time we can ask -for.</para> </sect1> <sect1><title>Details of the driver parser</title> |