AIS:refine parsing of type 8 DAC 1 FID 16 messages
authorJon Schlueter <jschlueter@redhat.com>
Tue, 6 Oct 2015 07:26:00 +0000 (03:26 -0400)
committerJon Schlueter <jschlueter@redhat.com>
Thu, 8 Oct 2015 02:37:53 +0000 (22:37 -0400)
- Type 8, DAC = 1 FID = 16: This should only be decoded as "Persons on board" if the message length is either 72 or 136 bits long (if even then).
- Type 8, DAC = 1 FID = 16: If decoded, the json output should use the ais->type8.dac1fid16.persons field and not the type6 field

Was not able to locate entry that had persons actually populated in AISHub sample data file

added sample data that should not be decoded to sample.aivdm
had to regenerate large sample file as it had multiple entries for this

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

type 8 dac 1 fid 16 can have either data or persons
had to add logic to detect structured vs not structured for type 8 FID 16 messages

ais_json.c
driver_ais.c
test/daemon/ais-nmea-sample.log.chk
test/sample.aivdm
test/sample.aivdm.chk
test/sample.aivdm.js.chk
test/sample.aivdm.ju.chk

index 59cf0af..8481e47 100644 (file)
@@ -316,7 +316,9 @@ int json_ais_read(const char *buf,
            }
            else if (strstr(buf, "\"fid\":16,") != NULL) {
                status = json_read_object(buf, json_ais8_fid16, endptr);
-               structured = true;
+               if (status == 0) {
+                       structured = true;
+               }
            }
            else if (strstr(buf, "\"fid\":17,") != NULL) {
                status = json_read_object(buf, json_ais8_fid17, endptr);
index a5c26c0..b5602d4 100644 (file)
@@ -526,10 +526,15 @@ bool ais_binary_decode(const struct gpsd_errout_t *errout,
                break;
            case 16:        /* Number of Persons On Board */
                if (ais->type8.bitcount == 136)
-                   ais->type8.dac1fid16.persons = UBITS(88, 13);/* 289 */
-               else
-                   ais->type8.dac1fid16.persons = UBITS(55, 13);/* 236 */
-               ais->type8.structured = true;
+               {
+                       ais->type8.dac1fid16.persons = UBITS(88, 13);/* 289 */
+                       ais->type8.structured = true;
+               }
+               else if (ais->type8.bitcount == 72)
+               {
+                       ais->type8.dac1fid16.persons = UBITS(55, 13);/* 236 */
+                       ais->type8.structured = true;
+               }
                break;
            case 17:        /* IMO289 - VTS-generated/synthetic targets */
 #define ARRAY_BASE 56
index f231862..35e27cf 100644 (file)
 !AIVDM,1,1,,A,13aENohP00PDAIbMdQLqMwvR28:3,0*3F\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":244670175,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":0,"accuracy":true,"lon":2657077,"lat":31138163,"course":2423,"heading":511,"second":17,"maneuver":0,"raim":true,"radio":33411}\r
 !AIVDM,1,1,,A,802At?00D000q::4P2;>bPc;4rmw0@00qH<PP2:so0cEa@0w00,4*63\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e4a2848022ceaa0acb13ad7f010000e583208022bbdc0ad5a5003f00"}\r
 !AIVDM,1,1,,B,14a8;:0000QEKNhO8K?2U:>T00SI,0*2F\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":311561000,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":0,"accuracy":true,"lon":11197400,"lat":32643900,"course":660,"heading":327,"second":18,"maneuver":0,"raim":false,"radio":2265}\r
 !AIVDM,1,1,,A,13f?D88000wWHE<DcDWcT:fP0<3F,0*6E\r
 !AIVDM,1,1,,A,13L>bV003>0tBiTOWG2bf8W008DG,0*69\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":230927000,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":206,"accuracy":false,"lon":7902770,"lat":33150730,"course":2744,"heading":275,"second":32,"maneuver":0,"raim":false,"radio":34071}\r
 !AIVDM,1,1,,A,802At?00D000q6bL02;A=hc5UPqw0000qK1;02;>=0c7Kh0w00,4*7D\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e46a9c0022d1370ac5960e7f000000e5b04b0022ce340ac76f003f00"}\r
 !AIVDM,1,1,,A,14eH?f0000rBgdNHhqgqbJA40PS1,0*32\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":316018616,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":0,"accuracy":true,"lon":-47874673,"lat":25967039,"course":2473,"heading":328,"second":34,"maneuver":0,"raim":false,"radio":133313}\r
 !AIVDM,1,1,,A,13HOW>0P0100Q;4LD>h`6ww008C`,0*66\r
 !AIVDM,1,1,,A,139Lb2P02Qvg;MP6h8Sf0s;P08MJ,0*41\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":211233290,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":161,"accuracy":true,"lon":-10593360,"lat":7080078,"course":3587,"heading":357,"second":48,"maneuver":0,"raim":false,"radio":34650}\r
 !AIVDM,1,1,,A,802At?00D000pPdG02:=?0c9dK=w8@00pS8kP2;0Shc?480w00,4*1D\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e20b1700228d3c0ac9b1b37f210000e232338022c08f0acf10803f00"}\r
 !AIVDM,1,1,,B,13aDr6hP00PGRVRMWgFKR?wRR8MU,0*75\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":244660763,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":0,"accuracy":true,"lon":3085521,"lat":31059801,"course":2952,"heading":511,"second":49,"maneuver":1,"raim":true,"radio":34661}\r
 !AIVDM,1,1,,A,13iHfh0000P>`:4MHBSWHWKR0HMT,0*2F\r
 !AIVDM,1,1,,A,4028j@1uho;NiOS>8NDqOko00<3F,0*3E\r
 {"class":"AIS","type":4,"repeat":0,"mmsi":2241088,"scaled":false,"timestamp":"2012-03-14T11:30:49Z","accuracy":false,"lon":-3772145,"lat":21913551,"epfd":7,"epfd_text":"Surveyed","raim":false,"radio":49366}\r
 !AIVDM,1,1,,A,802At?00D000q2UdP2;A4Pc<wP0w0000j9HI02;0<@c<w00w00,4*2F\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e4296c8022d1120accfe003f000000c896190022c0310accfc003f00"}\r
 !AIVDM,1,1,,A,13PP2d001s0r:BLOjd`VjEQT00St,0*3C\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":235406000,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":123,"accuracy":false,"lon":7623246,"lat":33336482,"course":1737,"heading":176,"second":50,"maneuver":0,"raim":false,"radio":2300}\r
 !AIVDM,1,1,,A,14eGEB?02?o;AB8KqG71TAGT0`N0,0*38\r
 !AIVDM,1,1,,A,33aGsSUP00PCRRnMcojh0?vF2JH0,0*24\r
 {"class":"AIS","type":3,"repeat":0,"mmsi":244710286,"scaled":false,"status":5,"status_text":"Moored","turn":-128,"speed":0,"accuracy":true,"lon":2561115,"lat":31127499,"course":0,"heading":511,"second":11,"maneuver":0,"raim":true,"radio":108032}\r
 !AIVDM,1,1,,B,802At?00D000pQK`02:vEPc>J00w00020AANp2;1P0c8aPIw00,4*54\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e216e80022be560ace68003f00000201145ee022c1800ac8a6067f00"}\r
 !AIVDM,1,1,,A,16KDPk0000:1BovDERBLIh4D00Rq,0*6A\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":431300812,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":0,"accuracy":false,"lon":84055807,"lat":21324361,"course":3175,"heading":2,"second":10,"maneuver":0,"raim":false,"radio":2233}\r
 !AIVDM,2,1,4,A,57f7R@01jN<DGEG;3O1HE=@8u8N222222222221?5hD564oR0=Clk3p88888,0*68\r
 !AIVDM,1,1,,B,13aGu:`P00PO1d`MqK>P0?vH2Kvt,0*07\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":244710698,"scaled":false,"status":8,"status_text":"Under way sailing","turn":-128,"speed":0,"accuracy":true,"lon":4066708,"lat":31349562,"course":0,"heading":511,"second":12,"maneuver":0,"raim":true,"radio":114620}\r
 !AIVDM,1,1,,A,802At?00D002G`lB42:Wa@c6;u:w0001Cgw402:um0c8Ph0w00,4*23\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:00025e8d121022a7a50ac62fd2bf0000014effc40022bdd40ac883003f00"}\r
 !AIVDM,1,1,,B,36:;4q0P008ViCrDaUuea?vH02pQ,0*11\r
 {"class":"AIS","type":3,"repeat":0,"mmsi":413320420,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":0,"accuracy":false,"lon":72190589,"lat":21652982,"course":3492,"heading":511,"second":12,"maneuver":0,"raim":false,"radio":11809}\r
 !AIVDM,1,1,,A,33:=a`5P000W9hlNabkh0?v@0000,0*68\r
 !AIVDM,1,1,,A,6h2E:p66B2SR04<0@00000000000,0*4C\r
 {"class":"AIS","type":6,"repeat":3,"mmsi":2444000,"scaled":false,"seqno":1,"dest_mmsi":563219000,"retransmit":true,"dac":1,"fid":3,"data":"80:00400000000000000000"}\r
 !AIVDM,1,1,,B,802At?00D000qINRP2:vGhc>J@0w0000qLG702:qaPcGEp0w00,4*33\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e597a28022be5f0ace69003f000000e5c5c70022b9a60ad757803f00"}\r
 !AIVDM,1,1,,A,33oT?@0P130Jkg<Qq1saTWlr00v0,0*12\r
 {"class":"AIS","type":3,"repeat":0,"mmsi":259592000,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":67,"accuracy":false,"lon":3513830,"lat":35537390,"course":2450,"heading":250,"second":29,"maneuver":0,"raim":false,"radio":3968}\r
 !AIVDM,1,1,,A,15Ap5J0000`e2JpFDNF5t1hv0<3c,0*59\r
 !AIVDM,1,1,,A,23@QU<000KPCRsfMFckH1VfJ0@7H,0*7F\r
 {"class":"AIS","type":2,"repeat":0,"mmsi":218654000,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":27,"accuracy":true,"lon":2561911,"lat":30780365,"course":2054,"heading":215,"second":13,"maneuver":0,"raim":false,"radio":66008}\r
 !AIVDM,1,1,,B,802At?00D000qIBlP2:v6hc9<`0w0000pPV702:wQhc;?P0w00,4*05\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e594b48022be1b0ac932803f000000e209870022bf870acb3e003f00"}\r
 !AIVDM,1,1,,B,139e>N0P03PD8?fME6SKggvH2D3w,0*37\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":211504760,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":3,"accuracy":true,"lon":2638327,"lat":30754445,"course":3006,"heading":511,"second":12,"maneuver":0,"raim":true,"radio":82175}\r
 !AIVDM,1,1,,B,23aEQnPP18PB0OvMIAQB5wvH20S6,0*60\r
 !AIVDM,1,1,,B,16SWfBPP00a3R6>EKdSI9?w400SR,0*3E\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":440004170,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":0,"accuracy":true,"lon":75960519,"lat":22473869,"course":2340,"heading":511,"second":34,"maneuver":0,"raim":false,"radio":2274}\r
 !AIVDM,1,1,,A,802At?00D000lQE0028?9@d6i3Dw3000qKuf02;?:0c:SP0w00,4*52\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000d2154000220f250b06c4353f0c0000e5bf6e0022cf280aca8e003f00"}\r
 !AIVDM,1,1,,B,16:BHgP0008JpE2FCe<qehe40<4e,0*4C\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":413440190,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":0,"accuracy":false,"lon":70632097,"lat":23391539,"course":2487,"heading":22,"second":34,"maneuver":0,"raim":false,"radio":49453}\r
 !AIVDM,1,1,,A,13ktps002GPqtOBP4e9uEba62HD@,0*56\r
 !AIVDM,1,1,,A,83aGEM@j2d<d<>LvL@N8JhUE7<P0,0*3C\r
 {"class":"AIS","type":8,"repeat":0,"mmsi":244700533,"scaled":false,"dac":200,"fid":10,"vin":"02009391","length":241,"beam":53,"shiptype":8490,"shiptype_text":"Illegal ship type value.","hazard":5,"hazard_text":"Unknown","draught":230,"loaded":1,"loaded_text":"Unloaded","speed_q":false,"course_q":false,"heading_q":false}\r
 !AIVDM,1,1,,A,802At?00D000q:@r02:tT@c@QP0w0000s@KlP2:t5hcA?H0w00,4*55\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e4a43a0022bc910ad086003f000000ed06f48022bc170ad13d803f00"}\r
 !AIVDM,2,1,0,A,55DF:V02=a3DSP<r220pEN04l8U@Ttr222222216BhC:C4neNHRT85Bh`3iQ`888,0*4D\r
 !AIVDM,2,2,0,A,8888880,2*24\r
 {"class":"AIS","type":5,"repeat":0,"mmsi":356879000,"scaled":false,"imo":9282613,"ais_version":0,"callsign":"H8CN","shipname":"NEW AMBITION","shiptype":70,"shiptype_text":"Cargo - all ships of this type","to_bow":150,"to_stern":19,"to_port":10,"to_starboard":19,"epfd":1,"epfd_text":"GPS","eta":"03-13T13:30Z","draught":98,"destination":"JP UKB OFF","dte":0}\r
 !AIVDM,1,1,,A,15SF860000`ctfTAVp<VrR4P0D;3,0*49\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":372607000,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":0,"accuracy":true,"lon":72869330,"lat":18462770,"course":1770,"heading":66,"second":16,"maneuver":0,"raim":false,"radio":82627}\r
 !AIVDM,1,1,,A,802At?00D000qIwgP?wwv@00080w0000pPKGP2:tr0cBV@0w00,4*6A\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e59fef80fffff9000000803f000000e206d78022bce80ad299003f00"}\r
 !AIVDM,1,1,,A,16:>QD`0018fiILAQBV<@Q?B20RU,0*02\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":413376850,"scaled":false,"status":8,"status_text":"Under way sailing","turn":0,"speed":1,"accuracy":false,"lon":73239342,"lat":18371224,"course":3138,"heading":39,"second":41,"maneuver":0,"raim":true,"radio":2213}\r
 !AIVDM,1,1,,A,168uC<P000`eRBLAtfm==:L`0<7k,0*52\r
 !AIVDM,1,1,,A,15NJrMWP00ISo5TA2s2P0?wd00SM,0*6A\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":367442550,"scaled":false,"status":7,"status_text":"Engaged in fishing","turn":-128,"speed":0,"accuracy":false,"lon":-54019918,"lat":17873674,"course":0,"heading":511,"second":54,"maneuver":0,"raim":false,"radio":2269}\r
 !AIVDM,1,1,,A,802At?00D000pPGnP2:uN@cBSH0w0002G`hft2:qg@cG:p0w00,4*19\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e205f68022bd790ad28d803f0000025e8c2ef022b9bd0ad72b803f00"}\r
 !AIVDM,1,1,,A,13Ebs7g001vqI0D@64QDliih0HPT,0*04\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":224049950,"scaled":false,"status":15,"status_text":"Not defined","turn":0,"speed":1,"accuracy":true,"lon":-9254902,"lat":16876677,"course":1235,"heading":56,"second":56,"maneuver":0,"raim":false,"radio":100388}\r
 !AIVDM,1,1,,B,15Mj2wP001o>bi4K=hP;E:5h05It,0*23\r
 !AIVDM,1,1,,A,13aGuJhP000DQflMe;1@0?v6082;,0*06\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":244710763,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":0,"accuracy":false,"lon":2690522,"lat":31148805,"course":0,"heading":511,"second":3,"maneuver":0,"raim":false,"radio":32907}\r
 !AIVDM,1,1,,A,802At?00D000sJFUP2:wnhc>0`0w0000pPsd@2:s6hc@<p0w00,4*55\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000eda5a58022bfdb0ace02803f000000e20eec4022bb1b0ad033803f00"}\r
 !AIVDM,1,1,,B,133rENgP00PDmIrMCmgqMgv82<2K,0*7E\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":205428090,"scaled":false,"status":15,"status_text":"Not defined","turn":-128,"speed":0,"accuracy":true,"lon":2730813,"lat":30733759,"course":2422,"heading":511,"second":4,"maneuver":0,"raim":true,"radio":49307}\r
 !AIVDM,1,1,,A,13@o=nW0000hM`dQ1bn0ba`60@26,0*53\r
 !AIVDM,1,1,,B,13aGE1PP00PDPD`MdQ9aGgvN2<7w,0*63\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":244700422,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":0,"accuracy":true,"lon":2687636,"lat":31138086,"course":2398,"heading":511,"second":15,"maneuver":0,"raim":true,"radio":49663}\r
 !AIVDM,1,1,,B,802At?00D000q@wTP2;CU0c5eP0w0000pg4c02:r`0cCSh0w00,4*2A\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e50fe48022d3940ac5b6003f000000e2f12b0022baa00ad38f003f00"}\r
 !AIVDM,1,1,,A,16K2<e001gabnU4Cef8AjQFN25J0,0*2C\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":431000756,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":111,"accuracy":true,"lon":81114274,"lat":20672033,"course":458,"heading":43,"second":15,"maneuver":0,"raim":true,"radio":22144}\r
 !AIVDM,1,1,,A,36K8DI1000b08G>DDjp6MDVL0000?A3vRJ,0*53\r
 !AIVDM,1,1,,A,839hJ90j2d<dttd==QcPq?be0000,0*14\r
 {"class":"AIS","type":8,"repeat":0,"mmsi":211556900,"scaled":false,"dac":200,"fid":10,"vin":"02332046","length":860,"beam":114,"shiptype":8021,"shiptype_text":"Motor tanker, liquid cargo, type N","hazard":5,"hazard_text":"Unknown","draught":0,"loaded":0,"loaded_text":"N/A (default)","speed_q":false,"course_q":false,"heading_q":false}\r
 !AIVDM,1,1,,A,802At?00D000qOGOP2;?d0c7Np0w00020BVcP2:jn@b@S00w00,4*10\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e5f5df8022cfb00ac77b803f0000020129ab8022b2d90a908c003f00"}\r
 !AIVDM,1,1,,A,401uEPiuho;PG0CdM4M@0JQ00<3P,0*53\r
 {"class":"AIS","type":4,"repeat":0,"mmsi":2053507,"scaled":false,"timestamp":"2012-03-14T11:32:23Z","accuracy":false,"lon":2581410,"lat":30670954,"epfd":1,"epfd_text":"GPS","raim":false,"radio":49376}\r
 !AIVDM,1,1,,B,19NS1sP02W06lbTM=<5`c6nh05J0,0*1E\r
 !AIVDM,1,1,,B,13q5DN@P00Q1MsBNncAp5wvtRD0S,0*22\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":261182585,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":0,"accuracy":true,"lon":8580969,"lat":32353095,"course":2071,"heading":511,"second":30,"maneuver":1,"raim":true,"radio":81955}\r
 !AIVDM,1,1,,A,802At?00D001@frWP2:ewPc6IQSw0000gtRl42:`kPbg:DHw20,4*1B\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:000142eea78022adfe0ac66618ff000000bfc8b41022a8ce0aaf29463f08"}\r
 !AIVDM,1,1,,A,1>qc9ww000OkfS@MMI5004Rt0L0B,0*03\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":999999999,"scaled":false,"status":15,"status_text":"Not defined","turn":0,"speed":0,"accuracy":false,"lon":-1608600,"lat":30890260,"course":0,"heading":145,"second":30,"maneuver":0,"raim":false,"radio":114706}\r
 !AIVDM,1,1,,A,13@nj4P000PqaCBOpH4q4hjv0D1?,0*7D\r
 !AIVDM,1,1,,A,23`ekA@P000CUf@MFW500?wR0<3w,0*23\r
 {"class":"AIS","type":2,"repeat":0,"mmsi":244020037,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":0,"accuracy":false,"lon":2567624,"lat":30779156,"course":0,"heading":511,"second":49,"maneuver":0,"raim":false,"radio":49407}\r
 !AIVDM,1,1,,A,802At?00D001E6vLP2:vG@c>@Low0000qHrJ02;C4@c5hp0w00,4*48\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0001546f9c8022be5d0ace41cdff000000e58e9a0022d3110ac5c3803f00"}\r
 !AIVDM,1,1,,A,13q6oh001SQE?5rO;`r=2rOT0L17,0*10\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":261208000,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":99,"accuracy":true,"lon":11172029,"lat":32696552,"course":3339,"heading":335,"second":50,"maneuver":0,"raim":false,"radio":114759}\r
 !AIVDM,1,1,,B,133m@ogP00PD;76MD5O@0?wT2D7?,0*2E\r
 !AIVDM,1,1,,A,13u=aO0P000m4VVQ7pgP0?wb0L0@,0*7C\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":265513340,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":0,"accuracy":false,"lon":6956243,"lat":34732222,"course":0,"heading":511,"second":53,"maneuver":0,"raim":false,"radio":114704}\r
 !AIVDM,1,1,,A,802At?00D000qHVp02:t00cAt@0w0000qMhu02;?3hc7G@0w00,4*0C\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e589b80022bc000ad1f1003f000000e5dc3d0022cf0f0ac75d003f00"}\r
 !AIVDM,1,1,,A,13aGtvPP00PD4KlMEvC09gwd20Sp,0*66\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":244710650,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":0,"accuracy":true,"lon":2630522,"lat":30768716,"course":38,"heading":511,"second":54,"maneuver":0,"raim":true,"radio":2296}\r
 !AIVDM,1,1,,A,33a9980P@P0=LOLMCsdUPDEf01t0,0*73\r
 !AIVDM,1,1,,A,33CsGSTP2I8dBGrF?E906Owd00SQ,0*0B\r
 {"class":"AIS","type":3,"repeat":0,"mmsi":222222222,"scaled":false,"status":4,"status_text":"Constrained by her draught","turn":-128,"speed":153,"accuracy":false,"lon":72913661,"lat":23319844,"course":25,"heading":511,"second":54,"maneuver":0,"raim":false,"radio":2273}\r
 !AIVDM,1,1,,A,802At?00D000qO1202:uShc=aqnw2P00q@7r02:h6@c8dALw00,4*0F\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e5f0420022bd8f0acda79dbf0a0000e501fa0022b0190ac8b1173f00"}\r
 !AIVDM,1,1,,B,14QsE<002700knrNt6aUCTEf0@PA,0*64\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":304010544,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":135,"accuracy":false,"lon":106205,"lat":32442022,"course":1358,"heading":138,"second":55,"maneuver":0,"raim":false,"radio":67601}\r
 !AIVDM,1,1,,B,13P;nFOOh1P7R`hMK2kT=hKf00S4,0*14\r
 !AIVDM,1,1,,B,33ctMd501r0gsDLHRoD9d2=d00nA,0*59\r
 {"class":"AIS","type":3,"repeat":0,"mmsi":247406000,"scaled":false,"status":5,"status_text":"Moored","turn":0,"speed":122,"accuracy":false,"lon":6281870,"lat":25737040,"course":2480,"heading":70,"second":54,"maneuver":0,"raim":false,"radio":3473}\r
 !AIVDM,1,1,,A,802At?00D000qO20P2:wu0c;WQgw0001<=N=02:sk0cEVp0w00,4*5A\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e5f0808022bff40acb9e1bff00000130d78d0022bbcc0ad59b803f00"}\r
 !AIVDM,1,1,,A,13aIjChP1NPCcldMEG=18wwjRD30,0*1E\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":244740687,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":94,"accuracy":true,"lon":2580118,"lat":30758708,"course":291,"heading":511,"second":57,"maneuver":1,"raim":true,"radio":82112}\r
 !AIVDM,1,1,,2,133Scr0000PA=>LM?h01U1Aj05J0,0*53\r
 !AIVDM,1,1,,B,15N:=eP001qT5`JA4ihL=AJj05J4,0*49\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":367168950,"scaled":false,"status":0,"status_text":"Under way using engine","turn":0,"speed":1,"accuracy":true,"lon":-53990131,"lat":17904065,"course":3125,"heading":45,"second":25,"maneuver":0,"raim":false,"radio":22148}\r
 !AIVDM,1,1,,A,802At?00D000qFap02:lA0b@?3fw0001<:iFP2:rf0cCGp0w00,4*5E\r
-{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"persons":0}\r
+{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e56a780022b4440a903c3bbf00000130ac568022bab80ad35f803f00"}\r
 !AIVDM,1,1,,A,15NKjc0P00IT;D6A7qu:Agvh05J4,0*11\r
 {"class":"AIS","type":1,"repeat":0,"mmsi":367456940,"scaled":false,"status":0,"status_text":"Under way using engine","turn":-128,"speed":0,"accuracy":false,"lon":-53978493,"lat":17955316,"course":2630,"heading":511,"second":24,"maneuver":0,"raim":false,"radio":22148}\r
 !AIVDM,1,1,,B,13aIk2@P00PDQQ@Me6kh;gvh28>M,0*34\r
index ebc1b43..736923e 100644 (file)
@@ -1065,3 +1065,11 @@ AIVDM,2,2,1,B,00000000000,2*26
 !AIVDM,3,2,7,A,?A;J6b7AwuiqIGLeNiKCPDR7HQR<u;TTFufegr>kCSF,0*41
 !AIVDM,3,3,7,A,Uq:1Kk`e8,4*27
 # {"class":"AIS","type":8,"repeat":0,"mmsi":366999607,"scaled":false,"dac":366,"fid":57,"data":"510:7ffdef068fbded3c0a1943dfb997b4a10fadec21e6e0a6608f0f44b686a8747ff71e595dcb5ec5b4e05221d886233d2e4916f6eb6fe8ecd38d69792816f3a2d0"}
+# sample of type 8 fid 16 where persons shouldn't be parsed
+!AIVDM,1,1,,A,802At?00D000qFap02:lA0b@?3fw0001<:iFP2:rf0cCGp0w00,4*5E
+#{"class":"AIS","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e56a780022b4440a903c3bbf00000130ac568022bab80ad35f803f00"}
+# I do also have some examples of the type 8 DAC 1 FID 16 messages that should not be converted. I have no examples of the ones that should, but from the documentation, it seems not sure that they actually exist.
+!AIVDM,3,1,0,A,802UMp@0D002G`lCH2FuR@mE8;;w2d00001h82F0@hm;gh0w00010Wk3<2FG,0*00
+!AIVDM,3,2,0,A,ePm;5@0w0000iLBaP2F4khlwAH0w0000u7fUP2G=u0m3T@0w00010W:s02F>,0*72
+!AIVDM,3,3,0,A,Ghm4utWw2P,4*27
+# 8|0|002711009|1|16|720:00025e8d136025bd890d5520b2ff0ac000000070202580430d4bbf003f000001027cc3302597b60d4b15003f000000c5c4a9802584cf0d3f45803f000000f47ba58025cdf40d4391003f0000010272bb00258e5f0d44f7c9ff0a
index ff37743..bae0191 100644 (file)
@@ -86,3 +86,5 @@
 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
 8|0|366999607|366|57|510:7ffdef068fbded3c0a1943dfb997b4a10fadec21e6e0a6608f0f44b686a8747ff71e595dcb5ec5b4e05221d886233d2e4916f6eb6fe8ecd38d69792816f3a2d0\r
+8|0|002391100|1|16|240:0000e56a780022b4440a903c3bbf00000130ac568022bab80ad35f803f00\r
+8|0|002711009|1|16|720:00025e8d136025bd890d5520b2ff0ac000000070202580430d4bbf003f000001027cc3302597b60d4b15003f000000c5c4a9802584cf0d3f45803f000000f47ba58025cdf40d4391003f0000010272bb00258e5f0d44f7c9ff0a\r
index 4d6b80c..eb6a1a2 100644 (file)
@@ -86,3 +86,5 @@
 {"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
 {"class":"AIS","device":"stdin","type":8,"repeat":0,"mmsi":366999607,"scaled":true,"dac":366,"fid":57,"data":"510:7ffdef068fbded3c0a1943dfb997b4a10fadec21e6e0a6608f0f44b686a8747ff71e595dcb5ec5b4e05221d886233d2e4916f6eb6fe8ecd38d69792816f3a2d0"}\r
+{"class":"AIS","device":"stdin","type":8,"repeat":0,"mmsi":2391100,"scaled":true,"dac":1,"fid":16,"data":"240:0000e56a780022b4440a903c3bbf00000130ac568022bab80ad35f803f00"}\r
+{"class":"AIS","device":"stdin","type":8,"repeat":0,"mmsi":2711009,"scaled":true,"dac":1,"fid":16,"data":"720:00025e8d136025bd890d5520b2ff0ac000000070202580430d4bbf003f000001027cc3302597b60d4b15003f000000c5c4a9802584cf0d3f45803f000000f47ba58025cdf40d4391003f0000010272bb00258e5f0d44f7c9ff0a"}\r
index 105840b..c3ec424 100644 (file)
@@ -86,3 +86,5 @@
 {"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
 {"class":"AIS","device":"stdin","type":8,"repeat":0,"mmsi":366999607,"scaled":false,"dac":366,"fid":57,"data":"510:7ffdef068fbded3c0a1943dfb997b4a10fadec21e6e0a6608f0f44b686a8747ff71e595dcb5ec5b4e05221d886233d2e4916f6eb6fe8ecd38d69792816f3a2d0"}\r
+{"class":"AIS","device":"stdin","type":8,"repeat":0,"mmsi":2391100,"scaled":false,"dac":1,"fid":16,"data":"240:0000e56a780022b4440a903c3bbf00000130ac568022bab80ad35f803f00"}\r
+{"class":"AIS","device":"stdin","type":8,"repeat":0,"mmsi":2711009,"scaled":false,"dac":1,"fid":16,"data":"720:00025e8d136025bd890d5520b2ff0ac000000070202580430d4bbf003f000001027cc3302597b60d4b15003f000000c5c4a9802584cf0d3f45803f000000f47ba58025cdf40d4391003f0000010272bb00258e5f0d44f7c9ff0a"}\r