diff options
-rw-r--r-- | driver_rtcm2.c | 40 | ||||
-rw-r--r-- | gps.h | 15 | ||||
-rw-r--r-- | gpsd_json.c | 4 | ||||
-rw-r--r-- | rtcm2_json.c | 14 |
4 files changed, 42 insertions, 31 deletions
diff --git a/driver_rtcm2.c b/driver_rtcm2.c index 5895aa15..af562161 100644 --- a/driver_rtcm2.c +++ b/driver_rtcm2.c @@ -117,7 +117,7 @@ struct rtcm2_msg_t { union { /* msg 1 - differential gps corrections */ struct rtcm2_msg1 { - struct b_correction_t { + struct gps_correction_t { struct { /* msg 1 word 3 */ uint parity:6; int pc1:16; @@ -349,9 +349,9 @@ struct rtcm2_msg_t { } w2; union { - /* msg 1 - differential gps corrections */ + /* msg 1 - differential GPS corrections */ struct rtcm2_msg1 { - struct b_correction_t { + struct gps_correction_t { struct { /* msg 1 word 3 */ uint _pad:2; uint scale1:1; @@ -584,38 +584,38 @@ void rtcm2_unpack( /*@out@*/ struct rtcm2_t *tp, char *buf) case 1: case 9: { - struct b_correction_t *m = &msg->msg_type.type1.corrections[0]; + struct gps_correction_t *m = &msg->msg_type.type1.corrections[0]; while (len >= 0) { if (len >= 2) { - tp->ranges.sat[n].ident = m->w3.satident1; - tp->ranges.sat[n].udre = m->w3.udre1; - tp->ranges.sat[n].issuedata = m->w4.issuedata1; - tp->ranges.sat[n].rangerr = m->w3.pc1 * + tp->gps_ranges.sat[n].ident = m->w3.satident1; + tp->gps_ranges.sat[n].udre = m->w3.udre1; + tp->gps_ranges.sat[n].issuedata = m->w4.issuedata1; + tp->gps_ranges.sat[n].rangerr = m->w3.pc1 * (m->w3.scale1 ? PCLARGE : PCSMALL); - tp->ranges.sat[n].rangerate = m->w4.rangerate1 * + tp->gps_ranges.sat[n].rangerate = m->w4.rangerate1 * (m->w3.scale1 ? RRLARGE : RRSMALL); n++; } if (len >= 4) { - tp->ranges.sat[n].ident = m->w4.satident2; - tp->ranges.sat[n].udre = m->w4.udre2; - tp->ranges.sat[n].issuedata = m->w6.issuedata2; - tp->ranges.sat[n].rangerr = m->w5.pc2 * + tp->gps_ranges.sat[n].ident = m->w4.satident2; + tp->gps_ranges.sat[n].udre = m->w4.udre2; + tp->gps_ranges.sat[n].issuedata = m->w6.issuedata2; + tp->gps_ranges.sat[n].rangerr = m->w5.pc2 * (m->w4.scale2 ? PCLARGE : PCSMALL); - tp->ranges.sat[n].rangerate = m->w5.rangerate2 * + tp->gps_ranges.sat[n].rangerate = m->w5.rangerate2 * (m->w4.scale2 ? RRLARGE : RRSMALL); n++; } if (len >= 5) { - tp->ranges.sat[n].ident = m->w6.satident3; - tp->ranges.sat[n].udre = m->w6.udre3; - tp->ranges.sat[n].issuedata = m->w7.issuedata3; + tp->gps_ranges.sat[n].ident = m->w6.satident3; + tp->gps_ranges.sat[n].udre = m->w6.udre3; + tp->gps_ranges.sat[n].issuedata = m->w7.issuedata3; /*@ -shiftimplementation @*/ - tp->ranges.sat[n].rangerr = + tp->gps_ranges.sat[n].rangerr = ((m->w6.pc3_h << 8) | (m->w7.pc3_l)) * (m->w6.scale3 ? PCLARGE : PCSMALL); - tp->ranges.sat[n].rangerate = + tp->gps_ranges.sat[n].rangerate = m->w7.rangerate3 * (m->w6.scale3 ? RRLARGE : RRSMALL); /*@ +shiftimplementation @*/ n++; @@ -623,7 +623,7 @@ void rtcm2_unpack( /*@out@*/ struct rtcm2_t *tp, char *buf) len -= 5; m++; } - tp->ranges.nentries = n; + tp->gps_ranges.nentries = n; } break; case 3: @@ -166,14 +166,14 @@ struct rtcm2_t { union { struct { unsigned int nentries; - struct rangesat_t { /* data from messages 1 & 9 */ + struct gps_rangesat_t { /* data from messages 1 & 9 */ unsigned ident; /* satellite ID */ unsigned udre; /* user diff. range error */ unsigned issuedata; /* issue of data */ double rangerr; /* range error */ double rangerate; /* range error rate */ } sat[MAXCORRECTIONS]; - } ranges; + } gps_ranges; struct { /* data for type 3 messages */ bool valid; /* is message well-formed? */ double x, y, z; @@ -228,6 +228,17 @@ struct rtcm2_t { unsigned int hour; /* Hour in week (0-167) */ unsigned int leapsecs; /* Leap seconds (0-63) */ } gpstime; + struct { + unsigned int nentries; + struct glonass_rangesat_t { /* data from message type 31 */ + unsigned ident; /* satellite ID */ + unsigned udre; /* user diff. range error */ + unsigned tod; /* issue of data */ + bool change; /* ephemeris change bit */ + double rangerr; /* range error */ + double rangerate; /* range error rate */ + } sat[MAXCORRECTIONS]; + } glonass_ranges; /* data from type 16 messages */ char message[(RTCM2_WORDS_MAX-2) * sizeof(isgps30bits_t)]; /* data from messages of unknown type */ diff --git a/gpsd_json.c b/gpsd_json.c index 5c5d5880..91fd29cf 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -744,8 +744,8 @@ void json_rtcm2_dump(const struct rtcm2_t *rtcm, case 1: case 9: (void)strlcat(buf, "\"satellites\":[", buflen); - for (n = 0; n < rtcm->ranges.nentries; n++) { - const struct rangesat_t *rsp = &rtcm->ranges.sat[n]; + for (n = 0; n < rtcm->gps_ranges.nentries; n++) { + const struct gps_rangesat_t *rsp = &rtcm->gps_ranges.sat[n]; (void)snprintf(buf + strlen(buf), buflen - strlen(buf), "{\"ident\":%u,\"udre\":%u,\"issuedata\":%u,\"rangerr\":%0.3f,\"rangerate\":%0.3f},", rsp->ident, diff --git a/rtcm2_json.c b/rtcm2_json.c index 14d8e3cb..2d85d74f 100644 --- a/rtcm2_json.c +++ b/rtcm2_json.c @@ -49,17 +49,17 @@ int json_rtcm2_read(const char *buf, /*@ -fullinitblock @*/ const struct json_attr_t rtcm1_satellite[] = { - {"ident", t_uinteger, STRUCTOBJECT(struct rangesat_t, ident)}, - {"udre", t_uinteger, STRUCTOBJECT(struct rangesat_t, udre)}, - {"issuedata", t_uinteger, STRUCTOBJECT(struct rangesat_t, issuedata)}, - {"rangerr", t_real, STRUCTOBJECT(struct rangesat_t, rangerr)}, - {"rangerate", t_real, STRUCTOBJECT(struct rangesat_t, rangerate)}, + {"ident", t_uinteger, STRUCTOBJECT(struct gps_rangesat_t, ident)}, + {"udre", t_uinteger, STRUCTOBJECT(struct gps_rangesat_t, udre)}, + {"issuedata", t_uinteger, STRUCTOBJECT(struct gps_rangesat_t, issuedata)}, + {"rangerr", t_real, STRUCTOBJECT(struct gps_rangesat_t, rangerr)}, + {"rangerate", t_real, STRUCTOBJECT(struct gps_rangesat_t, rangerate)}, {NULL}, }; /*@-type@*//* STRUCTARRAY confuses splint */ const struct json_attr_t json_rtcm1[] = { RTCM2_HEADER - {"satellites", t_array, STRUCTARRAY(rtcm2->ranges.sat, + {"satellites", t_array, STRUCTARRAY(rtcm2->gps_ranges.sat, rtcm1_satellite, &satcount)}, {NULL}, }; @@ -197,7 +197,7 @@ int json_rtcm2_read(const char *buf, || strstr(buf, "\"type\":9,") != NULL) { status = json_read_object(buf, json_rtcm1, endptr); if (status == 0) - rtcm2->ranges.nentries = (unsigned)satcount; + rtcm2->gps_ranges.nentries = (unsigned)satcount; } else if (strstr(buf, "\"type\":3,") != NULL) { status = json_read_object(buf, json_rtcm3, endptr); if (status == 0) { |