summaryrefslogtreecommitdiff
path: root/driver_aivdm.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-09-23 01:15:55 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-09-23 01:15:55 +0000
commitd343faca52d659d6b8fe1264269a1859e4265af0 (patch)
tree7436c7f357eb4febb68e5060e443762abef9af88 /driver_aivdm.c
parent5b813a4110b473244efc99b3eede64f6debe9361 (diff)
downloadgpsd-d343faca52d659d6b8fe1264269a1859e4265af0.tar.gz
Handle AIS Type 21 Name Extension field.
Diffstat (limited to 'driver_aivdm.c')
-rw-r--r--driver_aivdm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/driver_aivdm.c b/driver_aivdm.c
index 59359bc0..d8eb3b9b 100644
--- a/driver_aivdm.c
+++ b/driver_aivdm.c
@@ -6,8 +6,6 @@
*
* Message types 1-5, 9-11, 18-19, and 24 have been tested against live data.
* Message types 6-8, 12-17, 20-23, and 25-26 have not.
- *
- * Message type 21 decoding does not yet handle the Name Extension field.
*/
#include <sys/types.h>
#include <stdio.h>
@@ -447,7 +445,12 @@ bool aivdm_decode(const char *buf, size_t buflen,
break;
case 21: /* Aid-to-Navigation Report */
ais->type21.type = UBITS(38, 5);
- UCHARS(43, ais->type21.name);
+ from_sixbit((char *)ais_context->bits,
+ 43, 20, ais->type21.name);
+ if (strlen(ais->type21.name) == 20 && ais_context->bitlen > 272)
+ from_sixbit((char *)ais_context->bits,
+ 272, (ais_context->bitlen - 272)/6,
+ ais->type21.name+20);
ais->type21.accuracy = UBITS(163, 163);
ais->type21.lon = UBITS(164, 28);
ais->type21.lat = UBITS(192, 27);