summaryrefslogtreecommitdiff
path: root/gpsdecode.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-09-15 11:47:33 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-09-15 11:47:33 -0400
commit795a00d7598541e59d36eb865cc14eedf1d0f628 (patch)
tree65b9a1b202c4fdac127200b8b2a1d0d5305a5014 /gpsdecode.c
parent205add74159c5056972932e31ce873e73477dcc8 (diff)
downloadgpsd-795a00d7598541e59d36eb865cc14eedf1d0f628.tar.gz
Extract ITU-R 1371-4 model and serial fields from AIS Type24 messages.
In ITU-R 1371-4, there are new model and serial fields carved out of the right-hand end of vendorid, which is reduced from 7 chars to 3. It is not clear in which minor revision this change took place. To cope with older AIS implementations, unpack the trailing bits *both* ways; truly revision-4-conformant implementations will have up to four characters of trailing garbage on the vendorid, and older implementations will have garbafe in the model and serial fields. This commit also reverts the change to copy only 20 characters rather than 21 when analyzing the name field in a type21. There's some mystery about why this didn't break the rgression tests sooner.
Diffstat (limited to 'gpsdecode.c')
-rw-r--r--gpsdecode.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gpsdecode.c b/gpsdecode.c
index 0ed7ef50..25b1d002 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -429,7 +429,13 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"%u|", ais->type24.shiptype);
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%s|%s|", ais->type24.vendorid, ais->type24.callsign);
+ "%s|", ais->type24.vendorid);
+ (void)snprintf(buf + strlen(buf), buflen - strlen(buf),
+ "%u|", ais->type24.model);
+ (void)snprintf(buf + strlen(buf), buflen - strlen(buf),
+ "%u|", ais->type24.serial);
+ (void)snprintf(buf + strlen(buf), buflen - strlen(buf),
+ "%s|", ais->type24.callsign);
if (AIS_AUXILIARY_MMSI(ais->mmsi)) {
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"%u", ais->type24.mothership_mmsi);