diff options
Diffstat (limited to 'driver_proto.c')
-rw-r--r-- | driver_proto.c | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/driver_proto.c b/driver_proto.c index f10b8690..9b4ca583 100644 --- a/driver_proto.c +++ b/driver_proto.c @@ -89,14 +89,14 @@ _proto__msg_navsol(struct gps_device_t *session, unsigned char *buf, size_t data if ((flags & _PROTO__SOLUTION_VALID) == 0) return 0; - mask = ONLINE_SET; + mask = ONLINE_IS; /* extract ECEF navigation solution here */ /* or extract the local tangential plane (ENU) solution */ [Px, Py, Pz, Vx, Vy, Vz] = GET_ECEF_FIX(); ecef_to_wgs84fix(&session->newdata, &session->separation, Px, Py, Pz, Vx, Vy, Vz); - mask |= LATLON_SET | ALTITUDE_SET | SPEED_SET | TRACK_SET | CLIMB_SET ; + mask |= LATLON_IS | ALTITUDE_IS | SPEED_IS | TRACK_IS | CLIMB_IS ; session->newdata.epx = GET_LONGITUDE_ERROR(); session->newdata.epy = GET_LATITUDE_ERROR(); @@ -106,17 +106,17 @@ _proto__msg_navsol(struct gps_device_t *session, unsigned char *buf, size_t data session->gpsdata.dop.hdop = GET_HDOP(); session->gpsdata.dop.vdop = GET_VDOP(); /* other DOP if available */ - mask |= DOP_SET; + mask |= DOP_IS; session->newdata.mode = GET_FIX_MODE(); session->gpsdata.status = GET_FIX_STATUS(); /* - * Mix in CLEAR_SET to clue the daemon in about when to clear fix - * information. Mix in REPORT_SET when the sentence is reliably + * Mix in CLEAR_IS to clue the daemon in about when to clear fix + * information. Mix in REPORT_IS when the sentence is reliably * the last in a reporting cycle. */ - mask |= MODE_SET | STATUS_SET | REPORT_SET; + mask |= MODE_IS | STATUS_IS | REPORT_IS; /* * At the end of each packet-cracking function, report at LOG_DATA level @@ -159,7 +159,7 @@ _proto__msg_utctime(struct gps_device_t *session, unsigned char *buf, size_t dat t = gpstime_to_unix(gps_week, tow/1000.0) - session->context->leap_seconds; session->newdata.time = t; - return TIME_SET | ONLINE_SET; + return TIME_IS | ONLINE_IS; } /** @@ -213,7 +213,7 @@ _proto__msg_svinfo(struct gps_device_t *session, unsigned char *buf, size_t data "SVINFO: visible=%d used=%d mask={SATELLITE|USED}\n", session->gpsdata.satellites_visible, session->gpsdata.satellites_used); - return SATELLITE_SET | USED_SET; + return SATELLITE_IS | USED_IS; } /** @@ -235,9 +235,9 @@ gps_mask_t _proto__dispatch(struct gps_device_t *session, unsigned char *buf, si */ session->cycle_end_reliable = true; if (msgid == MY_START_OF_CYCLE) - retmask |= CLEAR_SET; + retmask |= CLEAR_IS; else if (msgid == MY_END_OF_CYCLE) - retmask |= REPORT_SET; + retmask |= REPORT_IS; type = GET_MESSAGE_TYPE(); @@ -424,6 +424,23 @@ static void _proto__set_mode(struct gps_device_t *session, int mode) } #endif /* ALLOW_RECONFIGURE */ +#ifdef NTPSHM_ENABLE +static double _proto_ntp_offset(struct gps_device_t *session) +{ + /* + * If NTP notification is enabled, the GPS will occasionally NTP + * its notion of the time. This will lag behind actual time by + * some amount which has to be determined by observation vs. (say + * WWVB radio broadcasts) and, furthermore, may differ by baud + * rate. This method is for computing the NTP fudge factor. If + * it's absent, an offset of 0.0 will be assumed, effectively + * falling back on what's in ntp.conf. When it returns NAN, + * nothing will be sent to NTP. + */ + return MAGIC_CONSTANT; +} +#endif /* NTPSHM_ENABLE */ + static void _proto__wrapup(struct gps_device_t *session) { } @@ -443,6 +460,7 @@ static void _proto__wrapup(struct gps_device_t *session) /* any driver must use to compile. */ /* This is everything we export */ +/* *INDENT-OFF* */ const struct gps_type_t _proto__binary = { /* Full name of type */ .type_name = "_proto_ binary", @@ -476,6 +494,10 @@ const struct gps_type_t _proto__binary = { /* Control string sender - should provide checksum and headers/trailer */ .control_send = _proto__control_send, #endif /* ALLOW_CONTROLSEND */ +#ifdef NTPSHM_ENABLE + .ntp_offset = _proto_ntp_offset, +#endif /* NTPSHM_ENABLE */ +/* *INDENT-ON* */ }; #endif /* defined(_PROTO__ENABLE) && defined(BINARY_ENABLE) */ |