summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-04-12 21:48:22 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-04-12 22:09:04 -0400
commitb093228c4d419e87ba2e3899882dae79de55e6d9 (patch)
treedd0668c3cb995d423374f3c9ce24512da1e7d7ff
parentdca77bfa22797e6126a53f5f05f1ff2f7b52f69d (diff)
downloadgpsd-b093228c4d419e87ba2e3899882dae79de55e6d9.tar.gz
Conjectural decode of RTCM3 message 1033.
-rw-r--r--driver_rtcm3.c16
-rw-r--r--gps.h8
-rw-r--r--gpsd_json.c13
3 files changed, 34 insertions, 3 deletions
diff --git a/driver_rtcm3.c b/driver_rtcm3.c
index 7b7d0c7c..651bf6b7 100644
--- a/driver_rtcm3.c
+++ b/driver_rtcm3.c
@@ -28,8 +28,10 @@ is correct, as it's identical to 1008 up to where it ends.
The 1033 decode was arrived at by looking at an rtcminspect dump and noting
that it carries an information superset of the 1008. There are additional
-Receiver and Firmware fields we don't know how to decode without access
-to an RTCM3 standard at revision 4 or later.
+Receiver and Firmware fields we're not certain to decode without access
+to an RTCM3 standard at revision 4 or later, but the guess in the code
+has been observed to correctly analyze a message with a nonempty Receiver
+field.
This file is Copyright (c) 2010 by the GPSD project
BSD terms apply: see the file COPYING in the distribution root for details.
@@ -65,7 +67,7 @@ BSD terms apply: see the file COPYING in the distribution root for details.
void rtcm3_unpack( /*@out@*/ struct rtcm3_t *rtcm, char *buf)
/* break out the raw bits into the scaled report-structure fields */
{
- unsigned int n, n2;
+ unsigned int n, n2, n3, n4;
int bitcount = 0;
unsigned int i;
signed long temp;
@@ -411,6 +413,14 @@ void rtcm3_unpack( /*@out@*/ struct rtcm3_t *rtcm, char *buf)
(void)memcpy(rtcm->rtcmtypes.rtcm3_1033.serial, buf + 9 + n, n2);
rtcm->rtcmtypes.rtcm3_1033.serial[n2] = '\0';
bitcount += 8 * n2;
+ n3 = (unsigned long)ugrab(8);
+ (void)memcpy(rtcm->rtcmtypes.rtcm3_1033.receiver, buf + 10+n+n2, n3);
+ rtcm->rtcmtypes.rtcm3_1033.receiver[n3] = '\0';
+ bitcount += 8 * n3;
+ n4 = (unsigned long)ugrab(8);
+ (void)memcpy(rtcm->rtcmtypes.rtcm3_1033.firmware, buf + 11+n+n2+n3, n3);
+ rtcm->rtcmtypes.rtcm3_1033.firmware[n4] = '\0';
+ bitcount += 8 * n4;
break;
default:
diff --git a/gps.h b/gps.h
index 3402c560..0d93dd7c 100644
--- a/gps.h
+++ b/gps.h
@@ -505,6 +505,14 @@ struct rtcm3_t {
size_t unicode_units; /* # Unicode units in text */
unsigned char text[128];
} rtcm3_1029;
+ struct rtcm3_1033_t {
+ unsigned int station_id; /* Reference Station ID */
+ char descriptor[RTCM3_MAX_DESCRIPTOR+1]; /* Description string */
+ unsigned char setup_id;
+ char serial[RTCM3_MAX_DESCRIPTOR+1]; /* Serial # string */
+ char receiver[RTCM3_MAX_DESCRIPTOR+1]; /* Receiver string */
+ char firmware[RTCM3_MAX_DESCRIPTOR+1]; /* Firmware string */
+ } rtcm3_1033;
char data[1024]; /* Max RTCM3 msg length is 1023 bytes */
} rtcmtypes;
};
diff --git a/gpsd_json.c b/gpsd_json.c
index 27bb4a58..ce23dc5c 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -1304,6 +1304,19 @@ void json_rtcm3_dump(const struct rtcm3_t *rtcm,
/*@+formatcode@*/
break;
+ case 1033:
+ (void)snprintf(buf + strlen(buf), buflen - strlen(buf),
+ "\"station_id\":%u,\"desc\":\"%s\","
+ "\"setup-id\":%u,\"serial\":\"%s\","
+ "\"receiver\":%s,\"firmware\":\"%s\"",
+ rtcm->rtcmtypes.rtcm3_1033.station_id,
+ rtcm->rtcmtypes.rtcm3_1033.descriptor,
+ INT(rtcm->rtcmtypes.rtcm3_1033.setup_id),
+ rtcm->rtcmtypes.rtcm3_1033.serial,
+ rtcm->rtcmtypes.rtcm3_1033.receiver,
+ rtcm->rtcmtypes.rtcm3_1033.firmware);
+ break;
+
default:
(void)strlcat(buf, "\"data\":[", buflen);
for (n = 0; n < rtcm->length; n++)