better handling of type 6 unhandled FID entries
authorJon Schlueter <jschlueter@redhat.com>
Thu, 8 Oct 2015 00:47:31 +0000 (20:47 -0400)
committerJon Schlueter <jschlueter@redhat.com>
Thu, 8 Oct 2015 01:13:15 +0000 (21:13 -0400)
When there are unknown FID values in type 6 messages for DAC values that
have some known FIDs (DAC 200, 235 and 250), the data is not read (and
thus printed as all zeros). I have added some example AIVDM messages
which exhibit this problem, some that did not have the problem in the
existing version and a patch for the problem.

Added sample

!AIVDM,1,1,,A,601uEPprEH2@<P<j00,4*32
-{"class":"AIS","device":"stdin","type":6,"repeat":0,"mmsi":2053507,"scaled":true,"seqno":2,"dest_mmsi":244670500,"retransmit":false,"dac":200,"fid":3,"data":"16:0000"}
+{"class":"AIS","device":"stdin","type":6,"repeat":0,"mmsi":2053507,"scaled":true,"seqno":2,"dest_mmsi":244670500,"retransmit":false,"dac":200,"fid":3,"data":"16:3200"}

adjusted loop logic to allow it to continue to process other types

Identified by:  Stefan Roels <sroels-gpsd-dev@42solutions.nl>

driver_ais.c
test/sample.aivdm
test/sample.aivdm.chk
test/sample.aivdm.js.chk
test/sample.aivdm.ju.chk

index 1942ef7..535a420 100644 (file)
@@ -240,7 +240,6 @@ bool ais_binary_decode(const struct gpsd_errout_t *errout,
                ais->type6.structured = true;
                break;
            }
-           break;
        }
        /* UK and Republic Of Ireland */
        else if (ais->type6.dac == 235 || ais->type6.dac == 250) {
@@ -260,7 +259,6 @@ bool ais_binary_decode(const struct gpsd_errout_t *errout,
                ais->type6.structured = true;
                break;
            }
-           break;
        }
        /* International */
        else if (ais->type6.dac == 1)
index 61e000f..2f16aa7 100644 (file)
@@ -1056,3 +1056,6 @@ AIVDM,2,2,1,B,00000000000,2*26
 !AIVDM,2,1,7,B,802`m000BkGTp0b<j59?000000000000000O,0*14
 !AIVDM,2,2,7,B,p0000000000<0000000@000,2*1C
 #{"class":"AIS","device":"stdin","type":8,"repeat":0,"mmsi":2766080,"scaled":true,"dac":1,"fid":11,"lat":58.867,"lon":23.047,"timestamp":"20T18:30Z","wspeed":0,"wgust":0,"wdir":0,"wgustdir":0,"humidity":0,"airtemp":-60.0,"dewpoint":-20.0,"pressure":800,"pressuretend":"steady","visibility":0.0,"waterlevel":-10.0,"leveltrend":"steady","cspeed":25.5,"cdir":0,"cspeed2":0.0,"cdir2":0,"cdepth2":0,"cspeed3":0.0,"cdir3":0,"cdepth3":0,"waveheight":0.0,"waveperiod":3,"wavedir":0,"swellheight":0.0,"swellperiod":0,"swelldir":0,"seastate":0,"watertemp":429496729.6,"preciptype":0,"preciptype_text":"reserved","salinity":0.0,"ice":0,"ice_text":"no"}
+# type 6 with unhandled type
+!AIVDM,1,1,,A,601uEPprEH2@<P<j00,4*32
+#{"class":"AIS","device":"stdin","type":6,"repeat":0,"mmsi":2053507,"scaled":true,"seqno":2,"dest_mmsi":244670500,"retransmit":false,"dac":200,"fid":3,"data":"16:3200"}
index 701dc76..0b51472 100644 (file)
@@ -84,3 +84,4 @@
 8|1|002300057|1|11|1586491|3616491|20T18:27Z|15|18|115|106|579|67|1023|231|2|255|511|3|255|511|255|511|31|255|511|31|255|63|511|255|63|511|15|1023|7|511|3\r
 8|1|002300059|1|11|1325788|3622678|20T18:28Z|12|14|92|84|586|90|1023|228|2|255|511|3|255|511|255|511|31|255|511|31|255|63|511|255|63|511|15|1023|7|511|3\r
 8|0|002766080|1|11|1382800|3532000|20T18:30Z|0|0|0|0|0|0|0|0|0|0|0|0|255|0|0|0|0|0|0|0|0|3|0|0|0|0|0|1|0|0|0\r
+6|0|002053507|2|244670500|0|200|3|16:3200\r
index f936d52..82231dc 100644 (file)
@@ -84,3 +84,4 @@
 {"class":"AIS","device":"stdin","type":8,"repeat":1,"mmsi":2300057,"scaled":true,"dac":1,"fid":11,"lat":60.275,"lon":26.442,"timestamp":"20T18:27Z","wspeed":15,"wgust":18,"wdir":115,"wgustdir":106,"humidity":67,"airtemp":-2.1,"dewpoint":82.3,"pressure":1031,"pressuretend":"decreasing","visibility":25.5,"waterlevel":41.1,"leveltrend":"N/A","cspeed":25.5,"cdir":511,"cspeed2":25.5,"cdir2":511,"cdepth2":31,"cspeed3":25.5,"cdir3":511,"cdepth3":31,"waveheight":25.5,"waveperiod":63,"wavedir":511,"swellheight":25.5,"swellperiod":63,"swelldir":511,"seastate":15,"watertemp":92.3,"preciptype":7,"preciptype_text":"N/A","salinity":51.1,"ice":3,"ice_text":"N/A"}\r
 {"class":"AIS","device":"stdin","type":8,"repeat":1,"mmsi":2300059,"scaled":true,"dac":1,"fid":11,"lat":60.378,"lon":22.096,"timestamp":"20T18:28Z","wspeed":12,"wgust":14,"wdir":92,"wgustdir":84,"humidity":90,"airtemp":-1.4,"dewpoint":82.3,"pressure":1028,"pressuretend":"decreasing","visibility":25.5,"waterlevel":41.1,"leveltrend":"N/A","cspeed":25.5,"cdir":511,"cspeed2":25.5,"cdir2":511,"cdepth2":31,"cspeed3":25.5,"cdir3":511,"cdepth3":31,"waveheight":25.5,"waveperiod":63,"wavedir":511,"swellheight":25.5,"swellperiod":63,"swelldir":511,"seastate":15,"watertemp":92.3,"preciptype":7,"preciptype_text":"N/A","salinity":51.1,"ice":3,"ice_text":"N/A"}\r
 {"class":"AIS","device":"stdin","type":8,"repeat":0,"mmsi":2766080,"scaled":true,"dac":1,"fid":11,"lat":58.867,"lon":23.047,"timestamp":"20T18:30Z","wspeed":0,"wgust":0,"wdir":0,"wgustdir":0,"humidity":0,"airtemp":-60.0,"dewpoint":-20.0,"pressure":800,"pressuretend":"steady","visibility":0.0,"waterlevel":-10.0,"leveltrend":"steady","cspeed":25.5,"cdir":0,"cspeed2":0.0,"cdir2":0,"cdepth2":0,"cspeed3":0.0,"cdir3":0,"cdepth3":0,"waveheight":0.0,"waveperiod":3,"wavedir":0,"swellheight":0.0,"swellperiod":0,"swelldir":0,"seastate":0,"watertemp":-9.9,"preciptype":0,"preciptype_text":"reserved","salinity":0.0,"ice":0,"ice_text":"no"}\r
+{"class":"AIS","device":"stdin","type":6,"repeat":0,"mmsi":2053507,"scaled":true,"seqno":2,"dest_mmsi":244670500,"retransmit":false,"dac":200,"fid":3,"data":"16:3200"}\r
index d5c6fa9..134bada 100644 (file)
@@ -84,3 +84,4 @@
 {"class":"AIS","device":"stdin","type":8,"repeat":1,"mmsi":2300057,"scaled":false,"dac":1,"fid":11,"lat":3616491,"lon":1586491,"timestamp":"20T18:27Z","wspeed":15,"wgust":18,"wdir":115,"wgustdir":106,"humidity":67,"airtemp":579,"dewpoint":1023,"pressure":231,"pressuretend":2,"visibility":255,"waterlevel":511,"leveltrend":3,"cspeed":255,"cdir":511,"cspeed2":255,"cdir2":511,"cdepth2":31,"cspeed3":255,"cdir3":511,"cdepth3":31,"waveheight":255,"waveperiod":63,"wavedir":511,"swellheight":255,"swellperiod":63,"swelldir":511,"seastate":15,"watertemp":1023,"preciptype":7,"preciptype_text":"N/A","salinity":511,"ice":3,"ice_text":"N/A"}\r
 {"class":"AIS","device":"stdin","type":8,"repeat":1,"mmsi":2300059,"scaled":false,"dac":1,"fid":11,"lat":3622678,"lon":1325788,"timestamp":"20T18:28Z","wspeed":12,"wgust":14,"wdir":92,"wgustdir":84,"humidity":90,"airtemp":586,"dewpoint":1023,"pressure":228,"pressuretend":2,"visibility":255,"waterlevel":511,"leveltrend":3,"cspeed":255,"cdir":511,"cspeed2":255,"cdir2":511,"cdepth2":31,"cspeed3":255,"cdir3":511,"cdepth3":31,"waveheight":255,"waveperiod":63,"wavedir":511,"swellheight":255,"swellperiod":63,"swelldir":511,"seastate":15,"watertemp":1023,"preciptype":7,"preciptype_text":"N/A","salinity":511,"ice":3,"ice_text":"N/A"}\r
 {"class":"AIS","device":"stdin","type":8,"repeat":0,"mmsi":2766080,"scaled":false,"dac":1,"fid":11,"lat":3532000,"lon":1382800,"timestamp":"20T18:30Z","wspeed":0,"wgust":0,"wdir":0,"wgustdir":0,"humidity":0,"airtemp":0,"dewpoint":0,"pressure":0,"pressuretend":0,"visibility":0,"waterlevel":0,"leveltrend":0,"cspeed":255,"cdir":0,"cspeed2":0,"cdir2":0,"cdepth2":0,"cspeed3":0,"cdir3":0,"cdepth3":0,"waveheight":0,"waveperiod":3,"wavedir":0,"swellheight":0,"swellperiod":0,"swelldir":0,"seastate":0,"watertemp":1,"preciptype":0,"preciptype_text":"reserved","salinity":0,"ice":0,"ice_text":"no"}\r
+{"class":"AIS","device":"stdin","type":6,"repeat":0,"mmsi":2053507,"scaled":false,"seqno":2,"dest_mmsi":244670500,"retransmit":false,"dac":200,"fid":3,"data":"16:3200"}\r