summaryrefslogtreecommitdiff
path: root/driver_italk.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-08-27 16:42:04 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-08-27 16:42:04 -0400
commit995976ab06a8f688343b8fec87e1305e2d5ee80e (patch)
tree104bf6b57b68676529409f4374cc5881b07b1e7b /driver_italk.c
parent6203e5b8fcac9d78ea54b7b3c53cb8d084e8a219 (diff)
downloadgpsd-995976ab06a8f688343b8fec87e1305e2d5ee80e.tar.gz
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.
Diffstat (limited to 'driver_italk.c')
-rw-r--r--driver_italk.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/driver_italk.c b/driver_italk.c
index 59a95ee9..ea7f7195 100644
--- a/driver_italk.c
+++ b/driver_italk.c
@@ -41,7 +41,7 @@ static gps_mask_t decode_itk_navfix(struct gps_device_t *session,
double epx, epy, epz, evx, evy, evz, eph;
if (len != 296) {
- gpsd_report(session->context->errout.debug, LOG_PROG,
+ gpsd_notify(&session->context->errout, LOG_PROG,
"ITALK: bad NAV_FIX (len %zu, should be 296)\n",
len);
return -1;
@@ -106,7 +106,7 @@ static gps_mask_t decode_itk_navfix(struct gps_device_t *session,
session->gpsdata.status = STATUS_FIX;
}
- gpsd_report(session->context->errout.debug, LOG_DATA,
+ gpsd_notify(&session->context->errout, LOG_DATA,
"NAV_FIX: time=%.2f, lat=%.2f lon=%.2f alt=%.f speed=%.2f track=%.2f climb=%.2f mode=%d status=%d gdop=%.2f pdop=%.2f hdop=%.2f vdop=%.2f tdop=%.2f\n",
session->newdata.time, session->newdata.latitude,
session->newdata.longitude, session->newdata.altitude,
@@ -124,7 +124,7 @@ static gps_mask_t decode_itk_prnstatus(struct gps_device_t *session,
gps_mask_t mask;
if (len < 62) {
- gpsd_report(session->context->errout.debug, LOG_PROG, "ITALK: runt PRN_STATUS (len=%zu)\n", len);
+ gpsd_notify(&session->context->errout, LOG_PROG, "ITALK: runt PRN_STATUS (len=%zu)\n", len);
mask = 0;
} else {
unsigned int i, nsv, nchan, st;
@@ -156,7 +156,7 @@ static gps_mask_t decode_itk_prnstatus(struct gps_device_t *session,
session->gpsdata.satellites_used = (int)nsv;
mask = USED_IS | SATELLITE_SET;;
- gpsd_report(session->context->errout.debug, LOG_DATA,
+ gpsd_notify(&session->context->errout, LOG_DATA,
"PRN_STATUS: time=%.2f visible=%d used=%d mask={USED|SATELLITE}\n",
session->newdata.time,
session->gpsdata.satellites_visible,
@@ -173,7 +173,7 @@ static gps_mask_t decode_itk_utcionomodel(struct gps_device_t *session,
unsigned short flags;
if (len != 64) {
- gpsd_report(session->context->errout.debug, LOG_PROG,
+ gpsd_notify(&session->context->errout, LOG_PROG,
"ITALK: bad UTC_IONO_MODEL (len %zu, should be 64)\n",
len);
return 0;
@@ -190,7 +190,7 @@ static gps_mask_t decode_itk_utcionomodel(struct gps_device_t *session,
session->newdata.time = gpsd_gpstime_resolve(session,
(unsigned short) getleu16(buf, 7 + 36),
(unsigned int)getleu32(buf, 7 + 38) / 1000.0);
- gpsd_report(session->context->errout.debug, LOG_DATA,
+ gpsd_notify(&session->context->errout, LOG_DATA,
"UTC_IONO_MODEL: time=%.2f mask={TIME}\n",
session->newdata.time);
return TIME_SET | PPSTIME_IS;
@@ -204,7 +204,7 @@ static gps_mask_t decode_itk_subframe(struct gps_device_t *session,
uint32_t words[10];
if (len != 64) {
- gpsd_report(session->context->errout.debug, LOG_PROG,
+ gpsd_notify(&session->context->errout, LOG_PROG,
"ITALK: bad SUBFRAME (len %zu, should be 64)\n", len);
return 0;
}
@@ -212,7 +212,7 @@ static gps_mask_t decode_itk_subframe(struct gps_device_t *session,
flags = (unsigned short) getleu16(buf, 7 + 4);
prn = (unsigned short) getleu16(buf, 7 + 6);
sf = (unsigned short) getleu16(buf, 7 + 8);
- gpsd_report(session->context->errout.debug, LOG_PROG,
+ gpsd_notify(&session->context->errout, LOG_PROG,
"iTalk 50B SUBFRAME prn %u sf %u - decode %s %s\n",
prn, sf,
flags & SUBFRAME_WORD_FLAG_MASK ? "error" : "ok",
@@ -237,17 +237,17 @@ static gps_mask_t decode_itk_pseudo(struct gps_device_t *session,
n = (unsigned short) getleu16(buf, 7 + 4);
if ((n < 1) || (n > MAXCHANNELS)){
- gpsd_report(session->context->errout.debug, LOG_INF,
+ gpsd_notify(&session->context->errout, LOG_INF,
"ITALK: bad PSEUDO channel count\n");
return 0;
}
if (len != (size_t)((n+1)*36)) {
- gpsd_report(session->context->errout.debug, LOG_PROG,
+ gpsd_notify(&session->context->errout, LOG_PROG,
"ITALK: bad PSEUDO len %zu\n", len);
}
- gpsd_report(session->context->errout.debug, LOG_PROG, "iTalk PSEUDO [%u]\n", n);
+ gpsd_notify(&session->context->errout, LOG_PROG, "iTalk PSEUDO [%u]\n", n);
flags = (unsigned short)getleu16(buf, 7 + 6);
if ((flags & 0x3) != 0x3)
return 0; // bail if measurement time not valid.
@@ -285,54 +285,54 @@ static gps_mask_t italk_parse(struct gps_device_t *session,
type = (uint) getub(buf, 4);
/* we may need to dump the raw packet */
- gpsd_report(session->context->errout.debug, LOG_RAW,
+ gpsd_notify(&session->context->errout, LOG_RAW,
"raw italk packet type 0x%02x\n", type);
session->cycle_end_reliable = true;
switch (type) {
case ITALK_NAV_FIX:
- gpsd_report(session->context->errout.debug, LOG_DATA,
+ gpsd_notify(&session->context->errout, LOG_DATA,
"iTalk NAV_FIX len %zu\n", len);
mask = decode_itk_navfix(session, buf, len) | (CLEAR_IS | REPORT_IS);
break;
case ITALK_PRN_STATUS:
- gpsd_report(session->context->errout.debug, LOG_DATA,
+ gpsd_notify(&session->context->errout, LOG_DATA,
"iTalk PRN_STATUS len %zu\n", len);
mask = decode_itk_prnstatus(session, buf, len);
break;
case ITALK_UTC_IONO_MODEL:
- gpsd_report(session->context->errout.debug, LOG_DATA,
+ gpsd_notify(&session->context->errout, LOG_DATA,
"iTalk UTC_IONO_MODEL len %zu\n", len);
mask = decode_itk_utcionomodel(session, buf, len);
break;
case ITALK_ACQ_DATA:
- gpsd_report(session->context->errout.debug, LOG_DATA,
+ gpsd_notify(&session->context->errout, LOG_DATA,
"iTalk ACQ_DATA len %zu\n", len);
break;
case ITALK_TRACK:
- gpsd_report(session->context->errout.debug, LOG_DATA,
+ gpsd_notify(&session->context->errout, LOG_DATA,
"iTalk TRACK len %zu\n", len);
break;
case ITALK_PSEUDO:
- gpsd_report(session->context->errout.debug,
+ gpsd_notify(&session->context->errout,
LOG_DATA, "iTalk PSEUDO len %zu\n", len);
mask = decode_itk_pseudo(session, buf, len);
break;
case ITALK_RAW_ALMANAC:
- gpsd_report(session->context->errout.debug,
+ gpsd_notify(&session->context->errout,
LOG_DATA, "iTalk RAW_ALMANAC len %zu\n", len);
break;
case ITALK_RAW_EPHEMERIS:
- gpsd_report(session->context->errout.debug,
+ gpsd_notify(&session->context->errout,
LOG_DATA, "iTalk RAW_EPHEMERIS len %zu\n", len);
break;
case ITALK_SUBFRAME:
mask = decode_itk_subframe(session, buf, len);
break;
case ITALK_BIT_STREAM:
- gpsd_report(session->context->errout.debug, LOG_DATA,
+ gpsd_notify(&session->context->errout, LOG_DATA,
"iTalk BIT_STREAM len %zu\n", len);
break;
@@ -367,12 +367,12 @@ static gps_mask_t italk_parse(struct gps_device_t *session,
case ITALK_PULL_FIX:
case ITALK_MEMCTRL:
case ITALK_STOP_TASK:
- gpsd_report(session->context->errout.debug, LOG_DATA,
+ gpsd_notify(&session->context->errout, LOG_DATA,
"iTalk not processing packet: id 0x%02x length %zu\n",
type, len);
break;
default:
- gpsd_report(session->context->errout.debug, LOG_DATA,
+ gpsd_notify(&session->context->errout, LOG_DATA,
"iTalk unknown packet: id 0x%02x length %zu\n",
type, len);
}