summaryrefslogtreecommitdiff
path: root/driver_rtcm3.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2016-04-06 13:35:40 -0700
committerGary E. Miller <gem@rellim.com>2016-04-06 13:35:40 -0700
commitc2cdd535f7c6791c378b9c889842a0b38bacb133 (patch)
tree16c06f234bbe3dcbab2b0a28d31c3b4f0a27d3c9 /driver_rtcm3.c
parent03ccdb974dfb8f80851cb17648b4ca6658d91e22 (diff)
downloadgpsd-c2cdd535f7c6791c378b9c889842a0b38bacb133.tar.gz
Add comments to some known, and unknown but seen, RTCM 3.2
Diffstat (limited to 'driver_rtcm3.c')
-rw-r--r--driver_rtcm3.c172
1 files changed, 154 insertions, 18 deletions
diff --git a/driver_rtcm3.c b/driver_rtcm3.c
index a9e05903..b5722828 100644
--- a/driver_rtcm3.c
+++ b/driver_rtcm3.c
@@ -64,6 +64,10 @@ BSD terms apply: see the file COPYING in the distribution root for details.
/* Large case statements make GNU indent very confused */
/* *INDENT-OFF* */
+/* good srouce on message types:
+ * https://software.rtcm-ntrip.org/export/HEAD/ntrip/trunk/BNC/src/bnchelp.html
+ * Also look in the BNC source
+ */
void rtcm3_unpack(const struct gps_context_t *context,
struct rtcm3_t *rtcm, char *buf)
/* break out the raw bits into the scaled report-structure fields */
@@ -72,6 +76,7 @@ void rtcm3_unpack(const struct gps_context_t *context,
int bitcount = 0;
unsigned int i;
signed long temp;
+ bool unknown = true;;
#define ugrab(width) (bitcount += width, ubits((unsigned char *)buf, bitcount-width, width, false))
#define sgrab(width) (bitcount += width, sbits((signed char *)buf, bitcount-width, width, false))
@@ -99,7 +104,15 @@ void rtcm3_unpack(const struct gps_context_t *context,
rtcm->type, rtcm->length);
switch (rtcm->type) {
- case 1001: /* GPS Basic RTK, L1 Only */
+ case 63:
+ /* RTCM - 63
+ * BDS/BeiDou Ephemeris
+ * length 64
+ */
+ break;
+
+ case 1001:
+ /* GPS Basic RTK, L1 Only */
rtcm->rtcmtypes.rtcm3_1001.header.station_id = (uint)ugrab(12);
rtcm->rtcmtypes.rtcm3_1001.header.tow = (time_t)ugrab(30);
rtcm->rtcmtypes.rtcm3_1001.header.sync = (bool)ugrab(1);
@@ -115,9 +128,11 @@ void rtcm3_unpack(const struct gps_context_t *context,
R1001.L1.locktime = (unsigned char)sgrab(7);
}
#undef R1001
+ unknown = false;
break;
- case 1002: /* GPS Extended RTK, L1 Only */
+ case 1002:
+ /* GPS Extended RTK, L1 Only */
rtcm->rtcmtypes.rtcm3_1002.header.station_id = (uint)ugrab(12);
rtcm->rtcmtypes.rtcm3_1002.header.tow = (time_t)ugrab(30);
rtcm->rtcmtypes.rtcm3_1002.header.sync = (bool)ugrab(1);
@@ -135,9 +150,11 @@ void rtcm3_unpack(const struct gps_context_t *context,
R1002.L1.CNR = (ugrab(8)) * CARRIER_NOISE_RATIO_UNITS;
}
#undef R1002
+ unknown = false;
break;
- case 1003: /* GPS Basic RTK, L1 & L2 */
+ case 1003:
+ /* GPS Basic RTK, L1 & L2 */
rtcm->rtcmtypes.rtcm3_1003.header.station_id = (uint)ugrab(12);
rtcm->rtcmtypes.rtcm3_1003.header.tow = (time_t)ugrab(30);
rtcm->rtcmtypes.rtcm3_1003.header.sync = (bool)ugrab(1);
@@ -162,9 +179,11 @@ void rtcm3_unpack(const struct gps_context_t *context,
R1003.L2.locktime = (unsigned char)sgrab(7);
}
#undef R1003
+ unknown = false;
break;
- case 1004: /* GPS Extended RTK, L1 & L2 */
+ case 1004:
+ /* GPS Extended RTK, L1 & L2 */
rtcm->rtcmtypes.rtcm3_1004.header.station_id = (uint)ugrab(12);
rtcm->rtcmtypes.rtcm3_1004.header.tow = (time_t)ugrab(30);
rtcm->rtcmtypes.rtcm3_1004.header.sync = (bool)ugrab(1);
@@ -187,9 +206,11 @@ void rtcm3_unpack(const struct gps_context_t *context,
R1004.L2.CNR = ugrab(8) * CARRIER_NOISE_RATIO_UNITS;
}
#undef R1004
+ unknown = false;
break;
- case 1005: /* Stationary Antenna Reference Point, No Height Information */
+ case 1005:
+ /* Stationary Antenna Reference Point, No Height Information */
#define R1005 rtcm->rtcmtypes.rtcm3_1005
R1005.station_id = (unsigned short)ugrab(12);
ugrab(6); /* reserved */
@@ -202,9 +223,11 @@ void rtcm3_unpack(const struct gps_context_t *context,
ugrab(2);
R1005.ecef_z = sgrab(38) * ANTENNA_POSITION_RESOLUTION;
#undef R1005
+ unknown = false;
break;
- case 1006: /* Stationary Antenna Reference Point, with Height Information */
+ case 1006:
+ /* Stationary Antenna Reference Point, with Height Information */
#define R1006 rtcm->rtcmtypes.rtcm3_1006
R1006.station_id = (unsigned short)ugrab(12);
(void)ugrab(6); /* reserved */
@@ -218,18 +241,22 @@ void rtcm3_unpack(const struct gps_context_t *context,
R1006.ecef_z = sgrab(38) * ANTENNA_POSITION_RESOLUTION;
R1006.height = ugrab(16) * ANTENNA_POSITION_RESOLUTION;
#undef R1006
+ unknown = false;
break;
- case 1007: /* Antenna Descriptor */
+ case 1007:
+ /* Antenna Descriptor */
rtcm->rtcmtypes.rtcm3_1007.station_id = (unsigned short)ugrab(12);
n = (unsigned long)ugrab(8);
(void)memcpy(rtcm->rtcmtypes.rtcm3_1007.descriptor, buf + 7, n);
rtcm->rtcmtypes.rtcm3_1007.descriptor[n] = '\0';
bitcount += 8 * n;
rtcm->rtcmtypes.rtcm3_1007.setup_id = ugrab(8);
+ unknown = false;
break;
- case 1008: /* Antenna Descriptor & Serial Number */
+ case 1008:
+ /* Antenna Descriptor & Serial Number */
rtcm->rtcmtypes.rtcm3_1008.station_id = (unsigned short)ugrab(12);
n = (unsigned long)ugrab(8);
(void)memcpy(rtcm->rtcmtypes.rtcm3_1008.descriptor, buf + 7, n);
@@ -240,9 +267,11 @@ void rtcm3_unpack(const struct gps_context_t *context,
(void)memcpy(rtcm->rtcmtypes.rtcm3_1008.serial, buf + 9 + n, n2);
rtcm->rtcmtypes.rtcm3_1008.serial[n2] = '\0';
//bitcount += 8 * n2;
+ unknown = false;
break;
- case 1009: /* GLONASS Basic RTK, L1 Only */
+ case 1009:
+ /* GLONASS Basic RTK, L1 Only */
rtcm->rtcmtypes.rtcm3_1009.header.station_id =
(unsigned short)ugrab(12);
rtcm->rtcmtypes.rtcm3_1009.header.tow = (time_t)ugrab(27);
@@ -260,9 +289,11 @@ void rtcm3_unpack(const struct gps_context_t *context,
R1009.L1.locktime = (unsigned char)sgrab(7);
}
#undef R1009
+ unknown = false;
break;
- case 1010: /* GLONASS Extended RTK, L1 Only */
+ case 1010:
+ /* GLONASS Extended RTK, L1 Only */
rtcm->rtcmtypes.rtcm3_1010.header.station_id =
(unsigned short)ugrab(12);
rtcm->rtcmtypes.rtcm3_1010.header.tow = (time_t)ugrab(27);
@@ -282,9 +313,11 @@ void rtcm3_unpack(const struct gps_context_t *context,
R1010.L1.CNR = ugrab(8) * CARRIER_NOISE_RATIO_UNITS;
}
#undef R1010
+ unknown = false;
break;
- case 1011: /* GLONASS Basic RTK, L1 & L2 */
+ case 1011:
+ /* GLONASS Basic RTK, L1 & L2 */
rtcm->rtcmtypes.rtcm3_1011.header.station_id =
(unsigned short)ugrab(12);
rtcm->rtcmtypes.rtcm3_1011.header.tow = (time_t)ugrab(27);
@@ -311,9 +344,11 @@ void rtcm3_unpack(const struct gps_context_t *context,
R1011.L2.CNR = ugrab(8) * CARRIER_NOISE_RATIO_UNITS;
}
#undef R1011
+ unknown = false;
break;
- case 1012: /* GLONASS Extended RTK, L1 & L2 */
+ case 1012:
+ /* GLONASS Extended RTK, L1 & L2 */
rtcm->rtcmtypes.rtcm3_1012.header.station_id =
(unsigned short)ugrab(12);
rtcm->rtcmtypes.rtcm3_1012.header.tow = (time_t)ugrab(27);
@@ -343,9 +378,11 @@ void rtcm3_unpack(const struct gps_context_t *context,
R1012.L2.CNR = (unsigned char)ugrab(8) * CARRIER_NOISE_RATIO_UNITS;
}
#undef R1012
+ unknown = false;
break;
- case 1013: /* System Parameters */
+ case 1013:
+ /* System Parameters */
rtcm->rtcmtypes.rtcm3_1013.station_id = (unsigned short)ugrab(12);
rtcm->rtcmtypes.rtcm3_1013.mjd = (unsigned short)ugrab(16);
rtcm->rtcmtypes.rtcm3_1013.sod = (unsigned short)ugrab(17);
@@ -358,9 +395,13 @@ void rtcm3_unpack(const struct gps_context_t *context,
R1013.interval = (unsigned short)ugrab(16);
}
#undef R1013
+ unknown = false;
break;
case 1014:
+ /* Network Auxiliary Station Data
+ * coordinate difference between one Aux station and the master station
+ */
rtcm->rtcmtypes.rtcm3_1014.network_id = (int)ugrab(8);
rtcm->rtcmtypes.rtcm3_1014.subnetwork_id = (int)ugrab(4);
rtcm->rtcmtypes.rtcm3_1014.stationcount = (char)ugrab(5);
@@ -371,9 +412,35 @@ void rtcm3_unpack(const struct gps_context_t *context,
rtcm->rtcmtypes.rtcm3_1014.d_lon =
(unsigned short)ugrab(21) * ANTENNA_DEGREE_RESOLUTION;
rtcm->rtcmtypes.rtcm3_1014.d_alt = (unsigned short)ugrab(23) / 1000;
+ unknown = false;
+ break;
+
+ case 1017:
+ /* RTCM 3.1 - 1017
+ * GPS Combined Geometric and Ionospheric Correction Differences
+ * for all satellites between one Aux station and the master station
+ * (same content as both types 1015 and 1016 together, but less size)
+ */
+ break;
+
+ case 1019:
+ /* RTCM 3.1 - 1020
+ * GPS Ephemeris
+ * length 19
+ */
+ break;
+
+ case 1020:
+ /* RTCM 3.1 - 1020
+ * GLONASS Ephemeris
+ * length 45
+ */
break;
case 1029:
+ /* Text in UTF8 format
+ *(max. 127 multibyte characters and max. 255 bytes)
+ */
rtcm->rtcmtypes.rtcm3_1029.station_id = (unsigned short)ugrab(12);
rtcm->rtcmtypes.rtcm3_1029.mjd = (unsigned short)ugrab(16);
rtcm->rtcmtypes.rtcm3_1029.sod = (unsigned short)ugrab(17);
@@ -381,9 +448,11 @@ void rtcm3_unpack(const struct gps_context_t *context,
rtcm->rtcmtypes.rtcm3_1029.unicode_units = (size_t)ugrab(8);
(void)memcpy(rtcm->rtcmtypes.rtcm3_1029.text,
buf + 12, rtcm->rtcmtypes.rtcm3_1029.unicode_units);
+ unknown = false;
break;
case 1033: /* see note in header */
+ /* Receiver and Antenna Descriptor */
rtcm->rtcmtypes.rtcm3_1033.station_id = (unsigned short)ugrab(12);
n = (unsigned long)ugrab(8);
(void)memcpy(rtcm->rtcmtypes.rtcm3_1033.descriptor, buf + 7, n);
@@ -402,20 +471,87 @@ void rtcm3_unpack(const struct gps_context_t *context,
(void)memcpy(rtcm->rtcmtypes.rtcm3_1033.firmware, buf + 11+n+n2+n3, n3);
rtcm->rtcmtypes.rtcm3_1033.firmware[n4] = '\0';
//bitcount += 8 * n4;
+ unknown = false;
break;
- default:
- /*
- * Leader bytes, message length, and checksum won't be copied.
- * The first 12 bits of the copied payload will be the type field.
+ case 1043:
+ /* RTCM 3.x - 1043
+ * SBAS Ephemeris
+ * length 29
*/
- memcpy(rtcm->rtcmtypes.data, buf+3, rtcm->length);
+ break;
+
+ case 1044:
+ /* RTCM 3.x - 1044
+ * QZSS ephemeris
+ * length 61
+ */
+ break;
+
+ case 1045:
+ /* RTCM 3.x - 1045
+ * Galileo Ephemeris FNAV data
+ * length 62
+ */
+ break;
+
+ case 1046:
+ /* RTCM 3.x - 1046
+ * Galileo Ephemeris INAV data
+ * length 63
+ */
+ break;
+
+ case 1077:
+ /* RTCM 3.x - 1077
+ * Full GPS pseudo-ranges, carrier phases, Doppler and
+ * signal strength (high resolution)
+ * length 438
+ */
+ break;
+
+ case 1087:
+ /* RTCM 3.x - 1087
+ * Full GLONASS pseudo-ranges, carrier phases, Doppler and
+ * signal strength (high resolution)
+ * length 417 or 427
+ */
+ break;
+
+ case 1097:
+ /* RTCM 3.x - 1097
+ * Full Galileo pseudo-ranges, carrier phases, Doppler and
+ * signal strength (high resolution)
+ * length 96
+ */
+ break;
+
+ case 1107:
+ /* RTCM 3.x - 1107
+ * 'Multiple Signal Message
+ * Full SBAS pseudo-ranges, carrier phases, Doppler and
+ * signal strength (high resolution)
+ * length 96
+ */
+ break;
+
+ default:
break;
}
#undef RANGEDIFF
#undef GPS_PSEUDORANGE
#undef sgrab
#undef ugrab
+ if ( unknown ) {
+ /*
+ * Leader bytes, message length, and checksum won't be copied.
+ * The first 12 bits of the copied payload will be the type field.
+ */
+ memcpy(rtcm->rtcmtypes.data, buf+3, rtcm->length);
+ gpsd_log(&context->errout, LOG_PROG, "RTCM3: unknown type %d, length %d\n",
+ rtcm->type, rtcm->length);
+ }
+
}
/* *INDENT-ON* */