summaryrefslogtreecommitdiff
path: root/ubx.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2007-06-30 16:23:59 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2007-06-30 16:23:59 +0000
commit0bbb6e1142ef569eb936ec4b0362a421e05e3872 (patch)
treec0f4afaea82cd90a3f491cc56e951bd730bbd111 /ubx.c
parent652a5c1a0a8cca4005c858eab7ad1a10f8737253 (diff)
downloadgpsd-0bbb6e1142ef569eb936ec4b0362a421e05e3872.tar.gz
parse the DOP message.
Diffstat (limited to 'ubx.c')
-rw-r--r--ubx.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/ubx.c b/ubx.c
index 31cca616..8535b674 100644
--- a/ubx.c
+++ b/ubx.c
@@ -23,6 +23,7 @@
static gps_mask_t ubx_parse(struct gps_device_t *session, unsigned char *buf, size_t len);
static gps_mask_t ubx_msg_nav_sol(struct gps_device_t *session, unsigned char *buf, size_t data_len);
+static gps_mask_t ubx_msg_nav_dop(struct gps_device_t *session, unsigned char *buf, size_t data_len);
static gps_mask_t ubx_msg_nav_timegps(struct gps_device_t *session, unsigned char *buf, size_t data_len);
static gps_mask_t ubx_msg_nav_svinfo(struct gps_device_t *session, unsigned char *buf, size_t data_len);
static void ubx_msg_inf(unsigned char *buf, size_t data_len);
@@ -100,6 +101,24 @@ ubx_msg_nav_sol(struct gps_device_t *session, unsigned char *buf, size_t data_le
}
/**
+ * Dilution of precision message
+ */
+static gps_mask_t
+ubx_msg_nav_dop(struct gps_device_t *session, unsigned char *buf, size_t data_len)
+{
+ if (data_len != 18)
+ return 0;
+
+ session->gpsdata.gdop = (double)(getuw(buf, 4)/100.0);
+ session->gpsdata.pdop = (double)(getuw(buf, 6)/100.0);
+ session->gpsdata.tdop = (double)(getuw(buf, 8)/100.0);
+ session->gpsdata.vdop = (double)(getuw(buf, 10)/100.0);
+ session->gpsdata.hdop = (double)(getuw(buf, 12)/100.0);
+
+ return DOP_SET;
+}
+
+/**
* GPS Leap Seconds
*/
static gps_mask_t
@@ -231,7 +250,7 @@ static gps_mask_t ubx_parse(struct gps_device_t *session, unsigned char *buf, si
gpsd_report(LOG_IO, "UBX_NAV_STATUS\n");
break;
case UBX_NAV_DOP:
- gpsd_report(LOG_IO, "UBX_NAV_DOP\n");
+ gpsd_report(LOG_PROG, "UBX_NAV_DOP\n");
break;
case UBX_NAV_SOL:
gpsd_report(LOG_PROG, "UBX_NAV_SOL\n");