summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-03-23 04:03:32 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-03-23 05:39:31 -0400
commit4fa8352ec5e1e1f54ecf0551374f53c450063eff (patch)
tree9028bf9a258c1e6c8f4b558a4ddfb06f74329dc9 /libgpsd_core.c
parent6463f084db851a8fe706aee4ae2a6250be384fc5 (diff)
downloadgpsd-4fa8352ec5e1e1f54ecf0551374f53c450063eff.tar.gz
Drop the application of error modeling to the device level, too.
Relies on the previous commit. Perform the error-modeling computations right after a full packet is received. Makes it happen a little sooner and (the important change) inside gpsd_poll(), improving the separation between libgpsd_core.c and the dispatcher layer in gpsd.c. All regression tests pass.
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 0a7992cc..056352e2 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -442,6 +442,7 @@ char /*@observer@*/ *gpsd_id(/*@in@*/struct gps_device_t *session)
}
return(buf);
}
+
void gpsd_error_model(struct gps_device_t *session,
struct gps_fix_t *fix, struct gps_fix_t *oldfix)
/* compute errors and derived quantities */
@@ -692,6 +693,22 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
}
session->gpsdata.set = ONLINE_SET | dopmask | received;
+ /* copy/merge device data into staging buffers */
+ /*@-nullderef -nullpass@*/
+ if ((session->gpsdata.set & CLEAR_SET)!=0)
+ gps_clear_fix(&session->fixbuffer);
+ /* don't downgrade mode if holding previous fix */
+ if (session->fixbuffer.mode > session->gpsdata.fix.mode)
+ session->gpsdata.set &=~ MODE_SET;
+ //gpsd_report(LOG_PROG,
+ // "transfer mask on %s: %02x\n", session->gpsdata.tag, session->gpsdata.set);
+ gps_merge_fix(&session->fixbuffer,
+ session->gpsdata.set,
+ &session->gpsdata.fix);
+ gpsd_error_model(session,
+ &session->fixbuffer, &session->oldfix);
+ /*@+nullderef -nullpass@*/
+
/*
* Count good fixes. We used to check
* session->gpsdata.status > STATUS_NO_FIX