summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-11-12 13:33:12 -0800
committerGary E. Miller <gem@rellim.com>2018-11-12 13:33:12 -0800
commitb3f9c362febdb328191eec4aaeaf5ebad2cba57f (patch)
treeede672a91440d9a0438a78d49b748cd8fbb45de9
parent60eb6d238f4c4c77d6945efbfada3272ad161111 (diff)
downloadgpsd-b3f9c362febdb328191eec4aaeaf5ebad2cba57f.tar.gz
RAW: Add c2c and l2c measurements.
Those are C/A L2 pseudo-range and carrierphase.
-rw-r--r--driver_greis.c74
-rw-r--r--gps.h8
-rw-r--r--gpsd_json.c32
-rw-r--r--libgps_json.c4
4 files changed, 107 insertions, 11 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},
diff --git a/gps.h b/gps.h
index 87d09c9d..006a0f8a 100644
--- a/gps.h
+++ b/gps.h
@@ -1944,13 +1944,15 @@ struct rawdata_t {
* S: L9A, L9B, L9C, L9X
*/
double codephase; /* meters */
- double carrierphase; /* meters */
- double pseudorange; /* meters */
- double deltarange; /* meters/sec */
+ double carrierphase; /* L1 C/A meters, RINEX L1C */
+ double pseudorange; /* L1 C/A meters, RINEX C1C */
+ double deltarange; /* L1 C/A meters/sec, RINEX D1C */
double doppler; /* Hz */
#define LOCKMAX 64500 /* locktime capped at 64500 */
unsigned locktime; /* Carrier Phase Locktime in ms.
* max 64,500 ms */
+ double l2c; /* L2 C/A carrier phase meters, RINEX L2C */
+ double c2c; /* L2 C/A pseudo-range meters, RINEX C2C */
unsigned satstat; /* tracking status */
#define SAT_ACQUIRED 0x01 /* satellite acquired */
#define SAT_CODE_TRACK 0x02 /* code-tracking loop acquired */
diff --git a/gpsd_json.c b/gpsd_json.c
index b38a3668..07f1ecd3 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -754,17 +754,19 @@ void json_raw_dump(const struct gps_data_t *gpsdata,
gpsdata->raw.meas[i].locktime);
comma = true;
- if (0 != isfinite(gpsdata->raw.meas[i].carrierphase)) {
- str_appendf(reply, replylen, ",\"carrierphase\":%f",
- gpsdata->raw.meas[i].carrierphase);
- comma = true;
- }
- if (0 != isfinite(gpsdata->raw.meas[i].pseudorange)) {
+ if (0 != isfinite(gpsdata->raw.meas[i].pseudorange) &&
+ 1.0 < gpsdata->raw.meas[i].pseudorange) {
if (comma)
(void)strlcat(reply, ",", replylen);
str_appendf(reply, replylen, "\"pseudorange\":%f",
gpsdata->raw.meas[i].pseudorange);
comma = true;
+
+ if (0 != isfinite(gpsdata->raw.meas[i].carrierphase)) {
+ str_appendf(reply, replylen, ",\"carrierphase\":%f",
+ gpsdata->raw.meas[i].carrierphase);
+ comma = true;
+ }
}
if (0 != isfinite(gpsdata->raw.meas[i].doppler)) {
if (comma)
@@ -774,6 +776,24 @@ void json_raw_dump(const struct gps_data_t *gpsdata,
comma = true;
}
+ /* L2 C/A pseudo range, RINEX C2C */
+ if (0 != isfinite(gpsdata->raw.meas[i].c2c) &&
+ 1.0 < gpsdata->raw.meas[i].c2c) {
+ if (comma)
+ (void)strlcat(reply, ",", replylen);
+ str_appendf(reply, replylen, "\"c2c\":%f",
+ gpsdata->raw.meas[i].c2c);
+ comma = true;
+
+ /* L2 C/A carrier phase, RINEX L2C */
+ if (0 != isfinite(gpsdata->raw.meas[i].l2c)) {
+ if (comma)
+ (void)strlcat(reply, ",", replylen);
+ str_appendf(reply, replylen, "\"l2c\":%f",
+ gpsdata->raw.meas[i].l2c);
+ comma = true;
+ }
+ }
(void)strlcat(reply, "},", replylen);
}
str_rstrip_char(reply, ',');
diff --git a/libgps_json.c b/libgps_json.c
index 4e783bda..cdc15740 100644
--- a/libgps_json.c
+++ b/libgps_json.c
@@ -155,6 +155,10 @@ static int json_raw_read(const char *buf, struct gps_data_t *gpsdata,
.dflt.real = NAN},
{"doppler", t_real, STRUCTOBJECT(struct meas_t, doppler),
.dflt.real = NAN},
+ {"c2c", t_real, STRUCTOBJECT(struct meas_t, c2c),
+ .dflt.real = NAN},
+ {"l2c", t_real, STRUCTOBJECT(struct meas_t, l2c),
+ .dflt.real = NAN},
/* *INDENT-ON* */
{NULL},
};