summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-06-15 13:54:21 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-06-15 13:54:21 +0000
commitd7aa3db02d43fc7c123a2d3300116611ca835aa3 (patch)
tree9eb26f03c9aab6a6ddc05ac995c0109a368109b4
parent004619b26fc0a6617279d02ef53d10b7e26053d4 (diff)
downloadgpsd-d7aa3db02d43fc7c123a2d3300116611ca835aa3.tar.gz
First cut at implementing the CYCLE_START_SET flag.
-rw-r--r--HACKING4
-rw-r--r--garmin.c2
-rw-r--r--gps.h1
-rw-r--r--nmea_parse.c28
-rw-r--r--sirf.c2
-rw-r--r--zodiac.c2
6 files changed, 27 insertions, 12 deletions
diff --git a/HACKING b/HACKING
index a0be8c8d..9d6f090f 100644
--- a/HACKING
+++ b/HACKING
@@ -415,6 +415,10 @@ publish. Also, you must ensure that gpsdata.fix.mode is set properly to
indicate fix validity after each message; the framework code relies on
this.
+The CYCLE_START_SET flag is special. Set this when the driver returns
+the first timestamped message containing fix data in in an update cycle.
+(This excludes satellite-picture messages and GPS status indications.)
+
Your packet parser is also responsible for setting the tag field
in the gps_data_t structure. This is the string that will be emitted
as the first field of each $ record for profiling. The packet getter
diff --git a/garmin.c b/garmin.c
index a261cfc6..1ea5174e 100644
--- a/garmin.c
+++ b/garmin.c
@@ -364,7 +364,7 @@ static gps_mask_t PrintPacket(struct gps_device_t *session, Packet_t *pkt)
, pvt->leap_sec
, pvt->grmn_days);
- mask |= TIME_SET | LATLON_SET | ALTITUDE_SET | STATUS_SET | MODE_SET | SPEED_SET | TRACK_SET | CLIMB_SET | HERR_SET | VERR_SET | PERR_SET;
+ mask |= TIME_SET | LATLON_SET | ALTITUDE_SET | STATUS_SET | MODE_SET | SPEED_SET | TRACK_SET | CLIMB_SET | HERR_SET | VERR_SET | PERR_SET | CYCLE_START_SET;
break;
case GARMIN_PKTID_SAT_DATA:
gpsd_report(3, "Appl, SAT Data Sz: %d\n", pkt->mDataSize);
diff --git a/gps.h b/gps.h
index 83ef4736..1fd2affd 100644
--- a/gps.h
+++ b/gps.h
@@ -92,6 +92,7 @@ struct gps_data_t {
#define DEVICELIST_SET 0x00200000u
#define DEVICEID_SET 0x00400000u
#define ERROR_SET 0x00800000u
+#define CYCLE_START_SET 0x01000000u
double online; /* NZ if GPS is on line, 0 if not.
*
* Note: gpsd clears this flag when sentences
diff --git a/nmea_parse.c b/nmea_parse.c
index 651a788f..411c9aef 100644
--- a/nmea_parse.c
+++ b/nmea_parse.c
@@ -60,8 +60,8 @@ static void do_lat_lon(char *field[], struct gps_data_t *out)
* separate fields for day/month/year, with a 4-digit year. This
* means that for RMC we must supply a century and for GGA and GLL we
* must supply a century, year, and day. We get the missing data from
- * a previous RMC or ZDA; century in RMC is supplied by the host
- * machine's clock time if there has been no previous RMC.
+ * a previous RMC or ZDA; century in RMC is supplied by a constant if
+ * there has been no previous RMC.
*
**************************************************************************/
@@ -117,7 +117,7 @@ static gps_mask_t processGPRMC(int count, char *field[], struct gps_data_t *out)
* SiRF chipsets don't return either Mode Indicator or magnetic variation.
*/
- gps_mask_t mask = ERROR_SET;
+ gps_mask_t mask = 0;
if (strcmp(field[2], "V")==0) {
/* copes with Magellan EC-10X, see below */
@@ -133,9 +133,12 @@ static gps_mask_t processGPRMC(int count, char *field[], struct gps_data_t *out)
if (count > 9) {
merge_ddmmyy(field[9], out);
merge_hhmmss(field[1], out);
- out->fix.time = out->sentence_time = (double)mkgmtime(&out->nmea_date) + out->subseconds;
+ mask |= TIME_SET;
+ out->fix.time = (double)mkgmtime(&out->nmea_date)+out->subseconds;
+ if (out->sentence_time != out->fix.time)
+ mask |= CYCLE_START_SET;
+ out->sentence_time = out->fix.time;
}
- mask = TIME_SET;
do_lat_lon(&field[3], out);
mask |= LATLON_SET;
out->fix.speed = atof(field[7]) * KNOTS_TO_MPS;
@@ -195,8 +198,11 @@ static gps_mask_t processGPGLL(int count, char *field[], struct gps_data_t *out)
mask = 0;
merge_hhmmss(field[5], out);
if (out->nmea_date.tm_year != 0) {
- out->fix.time = out->sentence_time = (double)mkgmtime(&out->nmea_date) + out->subseconds;
mask = TIME_SET;
+ out->fix.time = (double)mkgmtime(&out->nmea_date)+out->subseconds;
+ if (out->sentence_time != out->fix.time)
+ mask |= CYCLE_START_SET;
+ out->sentence_time = out->fix.time;
}
do_lat_lon(&field[1], out);
mask |= LATLON_SET;
@@ -240,8 +246,8 @@ static gps_mask_t processGPGGA(int c UNUSED, char *field[], struct gps_data_t *o
merge_hhmmss(field[1], out);
if (out->nmea_date.tm_year != 0) {
- out->fix.time = out->sentence_time = (double)mkgmtime(&out->nmea_date) + out->subseconds;
mask |= TIME_SET;
+ out->fix.time = (double)mkgmtime(&out->nmea_date)+out->subseconds;
}
do_lat_lon(&field[2], out);
mask |= LATLON_SET;
@@ -420,6 +426,7 @@ static gps_mask_t processPGRME(int c UNUSED, char *field[], struct gps_data_t *o
static gps_mask_t processGPZDA(int c UNUSED, char *field[], struct gps_data_t *out)
/* Time & Date */
{
+ gps_mask_t mask = TIME_SET;
/*
$GPZDA,160012.71,11,03,2004,-1,00*7D
1) UTC time (hours, minutes, seconds, may have fractional subsecond)
@@ -434,8 +441,11 @@ static gps_mask_t processGPZDA(int c UNUSED, char *field[], struct gps_data_t *o
out->nmea_date.tm_year = atoi(field[4]) - 1900;
out->nmea_date.tm_mon = atoi(field[3]);
out->nmea_date.tm_mday = atoi(field[2]);
- out->fix.time = out->sentence_time = (double)mkgmtime(&out->nmea_date) + out->subseconds;
- return TIME_SET;
+ out->fix.time = (double)mkgmtime(&out->nmea_date)+out->subseconds;
+ if (out->sentence_time != out->fix.time)
+ mask |= CYCLE_START_SET;
+ out->sentence_time = out->fix.time;
+ return mask;
}
#ifdef __UNUSED__
diff --git a/sirf.c b/sirf.c
index bd1485c5..680eb515 100644
--- a/sirf.c
+++ b/sirf.c
@@ -209,7 +209,7 @@ gps_mask_t sirf_parse(struct gps_device_t *session, unsigned char *buf, size_t l
session->gpsdata.pdop = session->gpsdata.vdop = 0.0;
if (session->gpsdata.satellites > 0)
dop(session->gpsdata.satellites_used, &session->gpsdata);
- mask |= TIME_SET | LATLON_SET | TRACK_SET | SPEED_SET | STATUS_SET | MODE_SET | HDOP_SET;
+ mask |= TIME_SET | LATLON_SET | TRACK_SET | SPEED_SET | STATUS_SET | MODE_SET | HDOP_SET | CYCLE_START_SET;
}
return mask;
diff --git a/zodiac.c b/zodiac.c
index 44573d59..19c66ed1 100644
--- a/zodiac.c
+++ b/zodiac.c
@@ -213,7 +213,7 @@ static gps_mask_t handle1000(struct gps_device_t *session)
#endif
session->gpsdata.sentence_length = 55;
- return TIME_SET|LATLON_SET|ALTITUDE_SET|CLIMB_SET|SPEED_SET|TRACK_SET|STATUS_SET|MODE_SET|HERR_SET|VERR_SET|SPEEDERR_SET;
+ return TIME_SET|LATLON_SET|ALTITUDE_SET|CLIMB_SET|SPEED_SET|TRACK_SET|STATUS_SET|MODE_SET|HERR_SET|VERR_SET|SPEEDERR_SET|CYCLE_START_SET;
}
static gps_mask_t handle1002(struct gps_device_t *session)