summaryrefslogtreecommitdiff
path: root/net_dgpsip.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 /net_dgpsip.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 'net_dgpsip.c')
-rw-r--r--net_dgpsip.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net_dgpsip.c b/net_dgpsip.c
index 39c5cf42..14662bc3 100644
--- a/net_dgpsip.c
+++ b/net_dgpsip.c
@@ -37,7 +37,7 @@ int dgpsip_open(struct gps_device_t *device, const char *dgpsserver)
// cppcheck-suppress pointerPositive
if (device->gpsdata.gps_fd >= 0) {
char hn[256], buf[BUFSIZ];
- gpsd_report(device->context->errout.debug, LOG_PROG,
+ gpsd_notify(&device->context->errout, LOG_PROG,
"connection to DGPS server %s established.\n",
dgpsserver);
(void)gethostname(hn, sizeof(hn));
@@ -45,11 +45,11 @@ int dgpsip_open(struct gps_device_t *device, const char *dgpsserver)
(void)snprintf(buf, sizeof(buf), "HELO %s gpsd %s\r\nR\r\n", hn,
VERSION);
if (write(device->gpsdata.gps_fd, buf, strlen(buf)) != (ssize_t) strlen(buf))
- gpsd_report(device->context->errout.debug, LOG_ERROR,
+ gpsd_notify(&device->context->errout, LOG_ERROR,
"hello to DGPS server %s failed\n",
dgpsserver);
} else
- gpsd_report(device->context->errout.debug, LOG_ERROR,
+ gpsd_notify(&device->context->errout, LOG_ERROR,
"can't connect to DGPS server %s, netlib error %d.\n",
dgpsserver, device->gpsdata.gps_fd);
opts = fcntl(device->gpsdata.gps_fd, F_GETFL);
@@ -81,9 +81,9 @@ void dgpsip_report(struct gps_context_t *context,
gps->gpsdata.fix.altitude);
if (write(dgpsip->gpsdata.gps_fd, buf, strlen(buf)) ==
(ssize_t) strlen(buf))
- gpsd_report(context->errout.debug, LOG_IO, "=> dgps %s\n", buf);
+ gpsd_notify(&context->errout, LOG_IO, "=> dgps %s\n", buf);
else
- gpsd_report(context->errout.debug, LOG_IO, "write to dgps FAILED\n");
+ gpsd_notify(&context->errout, LOG_IO, "write to dgps FAILED\n");
}
}
}