From 995976ab06a8f688343b8fec87e1305e2d5ee80e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 27 Aug 2014 16:42:04 -0400 Subject: The big leap. Most instances of gpsd_report are replaced... ...with calls to gps_notify(), which indirects to its output method through a slot in an errout structure. Usually the errout structure lives inside the session context, but because struct errout_t is its own thing this does not have to be the case. One large clique of gpsd_notify() calls, in packet.c and isgps.c, looks at a struct errout_t copy in a lexer control block This change is not complete. Remnant gpsd_report calls need to be changed, and gpsmon needs to be tweaked so that the struct_error_t in its context is a non-defaukt hook updating the cuses display rather than simply dumping to stderr. Also the report label functionality needs to be added. All regression tests pass. --- driver_zodiac.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'driver_zodiac.c') diff --git a/driver_zodiac.c b/driver_zodiac.c index f3680051..0af1eccf 100644 --- a/driver_zodiac.c +++ b/driver_zodiac.c @@ -85,7 +85,7 @@ static ssize_t zodiac_spew(struct gps_device_t *session, unsigned short type, if (end_write(session->gpsdata.gps_fd, &h, hlen) != (ssize_t) hlen || end_write(session->gpsdata.gps_fd, dat, datlen) != (ssize_t) datlen) { - gpsd_report(session->context->errout.debug, LOG_RAW, + gpsd_notify(&session->context->errout, LOG_RAW, "Reconfigure write failed\n"); return -1; } @@ -98,7 +98,7 @@ static ssize_t zodiac_spew(struct gps_device_t *session, unsigned short type, (void)snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %04x", dat[i]); - gpsd_report(session->context->errout.debug, LOG_RAW, + gpsd_notify(&session->context->errout, LOG_RAW, "Sent Zodiac packet: %s\n", buf); return 0; @@ -203,7 +203,7 @@ static gps_mask_t handle1000(struct gps_device_t *session) mask = TIME_SET | PPSTIME_IS | LATLON_SET | ALTITUDE_SET | CLIMB_SET | SPEED_SET | TRACK_SET | STATUS_SET | MODE_SET; - gpsd_report(session->context->errout.debug, LOG_DATA, + gpsd_notify(&session->context->errout, LOG_DATA, "1000: time=%.2f lat=%.2f lon=%.2f alt=%.2f track=%.2f speed=%.2f climb=%.2f mode=%d status=%d\n", session->newdata.time, session->newdata.latitude, session->newdata.longitude, session->newdata.altitude, @@ -249,7 +249,7 @@ static gps_mask_t handle1002(struct gps_device_t *session) session->gpsdata.skyview_time = gpsd_gpstime_resolve(session, (unsigned short)gps_week, (double)gps_seconds); - gpsd_report(session->context->errout.debug, LOG_DATA, + gpsd_notify(&session->context->errout, LOG_DATA, "1002: visible=%d used=%d mask={SATELLITE|USED}\n", session->gpsdata.satellites_visible, session->gpsdata.satellites_used); @@ -295,7 +295,7 @@ static gps_mask_t handle1003(struct gps_device_t *session) } } session->gpsdata.skyview_time = NAN; - gpsd_report(session->context->errout.debug, LOG_DATA, + gpsd_notify(&session->context->errout, LOG_DATA, "NAVDOP: visible=%d gdop=%.2f pdop=%.2f " "hdop=%.2f vdop=%.2f tdop=%.2f mask={SATELLITE|DOP}\n", session->gpsdata.satellites_visible, @@ -330,7 +330,7 @@ static gps_mask_t handle1011(struct gps_device_t *session) * The Zodiac is supposed to send one of these messages on startup. */ getstringz(session->subtype, session->lexer.outbuffer, 19, 28); /* software version field */ - gpsd_report(session->context->errout.debug, LOG_DATA, + gpsd_notify(&session->context->errout, LOG_DATA, "1011: subtype=%s mask={DEVICEID}\n", session->subtype); return DEVICEID_SET; @@ -355,7 +355,7 @@ static gps_mask_t zodiac_analyze(struct gps_device_t *session) unsigned int id = (unsigned int)((session->lexer.outbuffer[3] << 8) | session->lexer.outbuffer[2]); - gpsd_report(session->context->errout.debug, LOG_RAW, + gpsd_notify(&session->context->errout, LOG_RAW, "Raw Zodiac packet type %d length %zd: %s\n", id, session->lexer.outbuflen, gpsd_prettydump(session)); -- cgit v1.2.1