diff options
author | Gary E. Miller <gem@rellim.com> | 2018-11-12 13:33:12 -0800 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2018-11-12 13:33:12 -0800 |
commit | b3f9c362febdb328191eec4aaeaf5ebad2cba57f (patch) | |
tree | ede672a91440d9a0438a78d49b748cd8fbb45de9 /driver_greis.c | |
parent | 60eb6d238f4c4c77d6945efbfada3272ad161111 (diff) | |
download | gpsd-b3f9c362febdb328191eec4aaeaf5ebad2cba57f.tar.gz |
RAW: Add c2c and l2c measurements.
Those are C/A L2 pseudo-range and carrierphase.
Diffstat (limited to 'driver_greis.c')
-rw-r--r-- | driver_greis.c | 74 |
1 files changed, 72 insertions, 2 deletions
diff --git a/driver_greis.c b/driver_greis.c index df540572..b70e73e1 100644 --- a/driver_greis.c +++ b/driver_greis.c @@ -579,7 +579,40 @@ static gps_mask_t greis_msg_EC(struct gps_device_t *session, /** - * Handle the message [PC] Carrier Phases (CA/L1) + * Handle the message [P3] CA/L2 Carrier Phases, RINEX L2C + */ +static gps_mask_t greis_msg_P3(struct gps_device_t *session, + unsigned char *buf, size_t len) +{ + int i; + size_t len_needed = (session->gpsdata.satellites_visible * 8) + 1; + + if (!session->driver.greis.seen_si) { + gpsd_log(&session->context->errout, LOG_WARN, + "GREIS: can't use P3 until after SI provides indices\n"); + return 0; + } + + /* check against number of satellites + checksum */ + if (len < len_needed) { + gpsd_log(&session->context->errout, LOG_WARN, + "GREIS: P3 bad len %zu, needed at least %zu\n", len, + len_needed); + return 0; + } + + for (i = 0; i < session->gpsdata.satellites_visible; i++) { + session->gpsdata.raw.meas[i].l2c = getled64((char *)buf, i * 8); + } + + session->driver.greis.seen_raw = true; + gpsd_log(&session->context->errout, LOG_DATA, "GREIS: P3\n"); + + return 0; +} + +/** + * Handle the message [PC] CA/L1 Carrier Phases, RINEX L1C */ static gps_mask_t greis_msg_PC(struct gps_device_t *session, unsigned char *buf, size_t len) @@ -613,7 +646,42 @@ static gps_mask_t greis_msg_PC(struct gps_device_t *session, } /** - * Handle the message [RC] Pseudo-range CA/L1 + * Handle the message [R3] CA/L2 Pseudo-range, RINEX C2C + */ +static gps_mask_t greis_msg_R3(struct gps_device_t *session, + unsigned char *buf, size_t len) +{ + int i; + size_t len_needed = (session->gpsdata.satellites_visible * 8) + 1; + + if (!session->driver.greis.seen_si) { + gpsd_log(&session->context->errout, LOG_WARN, + "GREIS: can't use R3 until after SI provides indices\n"); + return 0; + } + + /* check against number of satellites + checksum */ + if (len < len_needed) { + gpsd_log(&session->context->errout, LOG_WARN, + "GREIS: R3 bad len %zu, needed at least %zu\n", len, + len_needed); + return 0; + } + + for (i = 0; i < session->gpsdata.satellites_visible; i++) { + /* get, and convert to meters */ + session->gpsdata.raw.meas[i].c2c = \ + getled64((char *)buf, i * 8) * CLIGHT; + } + + session->driver.greis.seen_raw = true; + gpsd_log(&session->context->errout, LOG_DATA, "GREIS: R3\n"); + + return 0; +} + +/** + * Handle the message [RC] Pseudo-range CA/L1, RINEX C1C */ static gps_mask_t greis_msg_RC(struct gps_device_t *session, unsigned char *buf, size_t len) @@ -794,7 +862,9 @@ static struct dispatch_table_entry dispatch_table[] = { {'E', 'R', greis_msg_ER}, {'E', 'L', greis_msg_EL}, {'G', 'T', greis_msg_GT}, + {'R', '3', greis_msg_R3}, {'R', 'C', greis_msg_RC}, + {'P', '3', greis_msg_P3}, {'P', 'C', greis_msg_PC}, {'P', 'V', greis_msg_PV}, {'R', 'E', greis_msg_RE}, |