summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--driver_ais.c11
-rw-r--r--test/sample.aivdm4
-rw-r--r--test/sample.aivdm.chk1
-rw-r--r--test/sample.aivdm.js.chk1
-rw-r--r--test/sample.aivdm.ju.chk1
-rw-r--r--www/AIVDM.txt6
6 files changed, 21 insertions, 3 deletions
diff --git a/driver_ais.c b/driver_ais.c
index 6b5dbba6..72036915 100644
--- a/driver_ais.c
+++ b/driver_ais.c
@@ -1134,11 +1134,18 @@ bool ais_binary_decode(const int debug,
(ais->type26.bitcount + 7) / 8);
break;
case 27: /* Long Range AIS Broadcast message */
- if (bitlen != 96) {
+ if (bitlen != 96 && bitlen != 168) {
gpsd_report(debug, LOG_WARN,
- "AIVDM message type 27 size not 96 bits (%zd).\n",
+ "unexpected AIVDM message type 27 (%zd).\n",
bitlen);
return false;
+ } if (bitlen == 168) {
+ /*
+ * This is an implementation error observed in the wild,
+ * sending a full 168-bit slot rather than just 96 bits.
+ */
+ gpsd_report(debug, LOG_WARN,
+ "oversized 169=8-bit AIVDM message type 27.\n");
}
ais->type27.accuracy = (bool)UBITS(38, 1);
ais->type27.raim = UBITS(39, 1)!=0;
diff --git a/test/sample.aivdm b/test/sample.aivdm
index 2c7be1ea..818d2153 100644
--- a/test/sample.aivdm
+++ b/test/sample.aivdm
@@ -892,6 +892,10 @@ DGNSS data : 376:7c0556c07031febbf52924fe33fa2933ffa0fd2932fdb7062
# The only message 27 in more than 25 millions messages that is 96 bits long!
!AIVDM,1,1,,A,KCQ9r=hrFUnH7P00,0*41
#
+# Type 27:
+# From Marius Kintel <marius@kintel.net>
+# It's apparently more common for these to be 168 bits long (a full slot)
+!AIVDM,1,1,,B,KC5E2b@U19PFdLbMuc5=ROv62<7m,0*16
#
##############################################################################
# Invalid packet tests:
diff --git a/test/sample.aivdm.chk b/test/sample.aivdm.chk
index 51923be1..28f11a62 100644
--- a/test/sample.aivdm.chk
+++ b/test/sample.aivdm.chk
@@ -58,6 +58,7 @@
26|2|633353704|0|1|0|24576|92:0014f2251db2ce9000ff9600:0
26|0|016777280|0|0|0|0|116:c700ef007300e0000000080018282e:0
27|1|236091959|3|0|-92521|52239|0|0|0|0
+27|1|206914217|2|0|82214|2904|57|167|0|0
24|0|271040660|GOZDEM-1|37|1C00045|12|199989|YM5504|0|24|0|6
5|0|271010059|0|0|TCA2350|HEALTH CONTROL 13|55|6|10|2|2|1|00-00T24:60Z|20||0
5|0|271010059|0|0|TCA2350|HEALTH CONTROL 13|55|6|10|2|2|1|00-00T24:60Z|20||0
diff --git a/test/sample.aivdm.js.chk b/test/sample.aivdm.js.chk
index 02325ae5..67b53528 100644
--- a/test/sample.aivdm.js.chk
+++ b/test/sample.aivdm.js.chk
@@ -58,6 +58,7 @@
{"class":"AIS","device":"stdin","type":26,"repeat":2,"mmsi":633353704,"scaled":true,"addressed":false,"structured":true,"dest_mmsi":0,"app_id":24576,"data":"92:0014f2251db2ce9000ff9600","radio":0}
{"class":"AIS","device":"stdin","type":26,"repeat":0,"mmsi":16777280,"scaled":true,"addressed":false,"structured":false,"dest_mmsi":0,"app_id":0,"data":"116:c700ef007300e0000000080018282e","radio":0}
{"class":"AIS","device":"stdin","type":27,"repeat":1,"mmsi":236091959,"scaled":true,"status":"Restricted manoeuverability","accuracy":false,"lon":-154.2,"lat":87.1,"speed":0,"course":0,"raim":false,"gnss":false}
+{"class":"AIS","device":"stdin","type":27,"repeat":1,"mmsi":206914217,"scaled":true,"status":"Not under command","accuracy":false,"lon":137.0,"lat":4.8,"speed":57,"course":167,"raim":false,"gnss":false}
{"class":"AIS","device":"stdin","type":24,"repeat":0,"mmsi":271040660,"scaled":true,"shipname":"GOZDEM-1","shiptype":37,"shiptype_text":"Pleasure Craft","vendorid":"1C00045","model":12,"serial":199989,"callsign":"YM5504","to_bow":0,"to_stern":24,"to_port":0,"to_starboard":6}
{"class":"AIS","device":"stdin","type":5,"repeat":0,"mmsi":271010059,"scaled":true,"imo":0,"ais_version":0,"callsign":"TCA2350","shipname":"HEALTH CONTROL 13","shiptype":55,"shiptype_text":"Law Enforcement","to_bow":6,"to_stern":10,"to_port":2,"to_starboard":2,"epfd":1,"epfd_text":"GPS","eta":"00-00T24:60Z","draught":2.0,"destination":"","dte":0}
{"class":"AIS","device":"stdin","type":5,"repeat":0,"mmsi":271010059,"scaled":true,"imo":0,"ais_version":0,"callsign":"TCA2350","shipname":"HEALTH CONTROL 13","shiptype":55,"shiptype_text":"Law Enforcement","to_bow":6,"to_stern":10,"to_port":2,"to_starboard":2,"epfd":1,"epfd_text":"GPS","eta":"00-00T24:60Z","draught":2.0,"destination":"","dte":0}
diff --git a/test/sample.aivdm.ju.chk b/test/sample.aivdm.ju.chk
index 8086a40b..a7bbdba9 100644
--- a/test/sample.aivdm.ju.chk
+++ b/test/sample.aivdm.ju.chk
@@ -58,6 +58,7 @@
{"class":"AIS","device":"stdin","type":26,"repeat":2,"mmsi":633353704,"scaled":false,"addressed":false,"structured":true,"dest_mmsi":0,"app_id":24576,"data":"92:0014f2251db2ce9000ff9600","radio":0}
{"class":"AIS","device":"stdin","type":26,"repeat":0,"mmsi":16777280,"scaled":false,"addressed":false,"structured":false,"dest_mmsi":0,"app_id":0,"data":"116:c700ef007300e0000000080018282e","radio":0}
{"class":"AIS","device":"stdin","type":27,"repeat":1,"mmsi":236091959,"scaled":false,"status":3,"accuracy":false,"lon":-92521,"lat":52239,"speed":0,"course":0,"raim":false,"gnss":false}
+{"class":"AIS","device":"stdin","type":27,"repeat":1,"mmsi":206914217,"scaled":false,"status":2,"accuracy":false,"lon":82214,"lat":2904,"speed":57,"course":167,"raim":false,"gnss":false}
{"class":"AIS","device":"stdin","type":24,"repeat":0,"mmsi":271040660,"scaled":false,"shipname":"GOZDEM-1","shiptype":37,"shiptype_text":"Pleasure Craft","vendorid":"1C00045","model":12,"serial":199989,"callsign":"YM5504","to_bow":0,"to_stern":24,"to_port":0,"to_starboard":6}
{"class":"AIS","device":"stdin","type":5,"repeat":0,"mmsi":271010059,"scaled":false,"imo":0,"ais_version":0,"callsign":"TCA2350","shipname":"HEALTH CONTROL 13","shiptype":55,"shiptype_text":"Law Enforcement","to_bow":6,"to_stern":10,"to_port":2,"to_starboard":2,"epfd":1,"epfd_text":"GPS","eta":"00-00T24:60Z","draught":20,"destination":"","dte":0}
{"class":"AIS","device":"stdin","type":5,"repeat":0,"mmsi":271010059,"scaled":false,"imo":0,"ais_version":0,"callsign":"TCA2350","shipname":"HEALTH CONTROL 13","shiptype":55,"shiptype_text":"Law Enforcement","to_bow":6,"to_stern":10,"to_port":2,"to_starboard":2,"epfd":1,"epfd_text":"GPS","eta":"00-00T24:60Z","draught":20,"destination":"","dte":0}
diff --git a/www/AIVDM.txt b/www/AIVDM.txt
index f140a770..d5de08db 100644
--- a/www/AIVDM.txt
+++ b/www/AIVDM.txt
@@ -4601,7 +4601,7 @@ The 20 radio status bits are always present after end-of-data in the
last slot and are in the format specified by <<IALA>>. The radio
status is 20 bits rather than 19 because an extra first bit selects
whether it should be interpretred as a SOTDMA or ITDMA state.
-
+i
Note: Type 26 is extremely rare. As of April 2011 it has not been
observed even in long-duration samples from AISHub.
@@ -4613,6 +4613,10 @@ satellite). This message has a similar content to Messages 1, 2 and 3,
but the total number of bits has been compressed to allow for
increased propagation delays associated with long-range detection
+Length according to ITU-1374 is 96 bits. However, in the wild these
+are sometimes transmitted with 168 bits (a full slot). Robust decoders
+should warn when this occurs but decode the first 96 bits.
+
//: Type 27
[frame="topbot",options="header"]
|==============================================================================