summaryrefslogtreecommitdiff
path: root/www/AIVDM.adoc
blob: e4eb929cf8cc7d402e0c878a94d5e9f46ce038cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
= AIVDM/AIVDO protocol decoding =
:description: The AIVDM Marine AIS protocol demystified, for programmers.
:keywords: AIS, AIVDM, AIVDO, standard, protocol, Automatic Identification System
Eric S. Raymond <esr@thyrsus.com>
v1.52, Aug 2016

This document is mastered in asciidoc format.  If you are reading it in HTML,
you can find the original at the GPSD project website

// If you are reading the asciidoc master of this document, the
// occasional comments led with '//!' are hints for GPSD developer tools
// that use the table layouts to generate code.

If you find this document useful - and especially if it helps you make
money - please contribute to maintaining it by supporting the author's
full-time open-source work through <<PATREON>>. Even a few dollars a
week can make a difference.

== Introduction ==

This is a description of how to decode AIVDM/AIVDO sentences.  It
collects and integrates information from publicly available sources
and is intended to assist developers of open-source software for
interpreting these messages.

AIVDM/AIVDO sentences are emitted by receivers for AIS, the marine
Automatic Identification System. AIS transmitters are fitted to
vessels, navigation markers, and certain types of shore station. They
periodically squawk their position (and course, when applicable), using
TDMA (Time Division Multiple Access) technology similar to the way
cellphones do to avoid mutual interference. AIS receivers make this data
available for navigation, anti-collision systems, and other uses.

The International Maritime Organization's (IMO) International
Convention for the Safety of Life at Sea (SOLAS) requires operating AIS
transmitters on all international cargo vessels of more than 300 tons
displacement, all cargo vessels of more than 500 tons displacement,
and all passenger vessels; see <<SOLAS>> for details.  Individual
maritime nations may have stricter and more detailed rules: for those
obtaining in U.S. waters, see <<US-REQUIREMENTS>>.

AIS receivers report ASCII data packets as a byte stream over serial
or USB lines, using the NMEA 0183 or NMEA 2000 data formats. The RS422
variant of serial specified as a physical layer by NMEA 0183 is common
in marine navigation systems; there may be a "pilot plug"
<<PILOTPLUG>> which converts to USB. Alternatively, newer AIS
receivers may report directly over RS232 or USB.

AIS packets have the introducer "!AIVDM" or "!AIVDO"; AIVDM packets
are reports from other ships and AIVDO packets are reports from your
own ship.

A lengthy description of AIS, focusing on the goals and history of the
system, but not describing the data protocols in any detail, can be
found at <<AIS>>.

== Standards ==

Multiple standards bear on the AIVDM/AIVDO format.  This document
exists because assembling them into a complete picture is technically
difficult and was long impeded by legal barriers as well.

ITU Recommendation M.1371, "Technical Characteristics for a Universal
Shipborne Automatic Identification System Using Time Division Multiple
Access" <<ITU1371>>, issued in 2001, first described the bit-level
format of AIS radio messages. This standard was proprietary and
expensive when issued. I did not have access to it or any of its
followup revisions while assembling versions of this document up to
1.29.

ITU-R M.1371 was expanded and clarified by "IALA Technical
Clarifications on Recommendation ITU-R M.1371-1" <<IALA>>, which
is freely available.

There have been three minor revisions of ITU-R M.1371 since it was
originally issued.  These add interpretations to packet bitfields that
were previously marked "spare" and "regional reserved". ITU-R M.1371
revision 4 became available for free download, apparently at some
point in early 2011, well after most of this document was assembled.

The ASCII format for AIVDM/AIVDO representations of AIS radio messages
seems to have been set by IEC-PAS 61162-100, "Maritime navigation and
radiocommunication equipment and systems" <<IEC-PAS>>. It is
proprietary and I have not looked at it.  Various public sources
indicate that it has been "harmonized" with some version of NMEA 0183,
which I also have not looked at because it too is proprietary and
expensive, and surrounded by rapacious attack lawyers.

== Information Sources ==

Together, the IALA Technical Clarifications at <<IALA>> and the
Coast Guard's AIS pages at <<NAVCEN>> describe AIS message payloads
type 1-24 almost completely. Certain specialized binary messages of
types 6 and 8 defined by the International Maritime Organization are
described in <<IMO236>> and <<IMO289>>. The detail information on
payload formats in this document is mostly derived from these public
sources.

Kurt Schwehr is a research scientist at the Center for Coastal and
Ocean Mapping at the University of New Hampshire. Much of his research
involves AIS.  His work blog at <<Schwehr>> contains sample messages
and descriptions of AIS operation in the wild that shed light on
various obscure corners of the specification.  He has explained the
otherwise undocumented Repeat Indicator field and USCG extended AIVDM
to me by email. He also communicated some critical information from
<<IEC-PAS>>, and supplied information about new messages and fields in
ITU-1371-3.

Descriptions of messages 25 and 26 are based on AIS transceiver vendor
documentation was originally forwarded to me by a source wishing to
remain anonymous; I later checked them against ITU1371-4.  Message
type 27 was described in ITU1371-4 and added here after that became a
freely available download.

Should you set out to write a decoder using this document, you are
likely to find that one of your challenges is finding enough AIS
packet data to make an effective regression test -- especially if you
live out of line of sight of any ship traffic and would get nothing
from running an AIS receiver.  Fortunately, various AIS sites offer
live feeds over the Internet that aggregate AIS streams from all over
the world. Some charge subscriptions; others offer time-delayed access
for free and charge for a real-time feed. Still others are pool sites;
you join by contributing your feed and receive all feeds.

AIS Hub (<<AISHUB>>) is a free, public AIS feed pool. It provides
exchange of AIS data in raw NMEA format; all AISHub members share
their own received AIS data and receive the merged feed from all other
participating parties.  It is open-source friendly, offering a Linux
port in source of its software for collecting and forwarding AIS
data. Peter Stoyanov and the other AIS Hub principals have generously
donated a live feed to the GPSD project despite the fact that I live
60 miles inland and cannot send them anything interesting.

Some of what this document explains about the quirks of real-world
encoders comes from examples provided by Kurt Schwehr. Other such
information, especially for the less common sentences, comes from
inspection of sentences forwarded to me from AIS Hub by various
interested parties, and more recently from AIS Hub itself.

== Improving This Document ==

To avoid copyright difficulties, I rely only on freely redistributable
public documents and paraphrased reports from people who have seen the
relevant proprietary standards.  If you are such a person, please help
by reporting the following to be included in future versions of this
document:

* Sample sentences of types 16-17, 22-23, and 25-27.

* Sample sentences of type 6 and 8 conforming to <<IMO236>>,
  <<IMO289>>, and <<INLAND>>.

For verification purposes, I need the raw sentences together with
decoded dumps of their field values.  Please note that sample
sentences not accompanied by field dumps are *not* useful; I can get
plenty of those.

== Open-Source Implementations ==

The GPSD project ships an AIVDM/AIVDO sentence decoder as part of the
daemon. This document was developed to be the specification for it,
and it will decode all sentence type described herein.

The source-code repository of the GPSD project holds a conforming
standalone Python decoder, ais.py, that is not included in shipped
releases. It may be useful for developers working in that language.

<<Schwehr>> includes links to a collection of Python scripts for
decoding and analyzing AIVDM sentences.  Kurt Schwehr warns that this
is research code rather than a production tool.

There is a http://gnuais.sourceforge.net/[GNU AIS] project at
SourceForge.  It seems intended primarily to work directly
with AIS radios.

http://www.maritec.co.za/aisvdmvdodecoding.php[The Maritec decoder]
looks to be pretty high-quality and can be exercised through a
public web form. This is a useful resource for anyone qualifying
an AIS decoder.

== AIVDM/AIVDO Sentence Layer ==

AIVDM/AIVDO is a two-layer protocol.  The outer layer is a variant of
NMEA 0183, the ancient standard for data interchange in marine
navigation systems; NMEA 0183 is described at <<NMEA>>.

Here is a typical AIVDM data packet:

--------------------------------------------------------------------
!AIVDM,1,1,,B,177KQJ5000G?tO`K>RA1wUbN0TKH,0*5C
--------------------------------------------------------------------

And here is what the fields mean:

Field 1, !AIVDM, identifies this as an AIVDM packet.

Field 2 (1 in this example) is the count of fragments in the currently
accumulating message.  The payload size of each sentence is limited by
NMEA 0183's 82-character maximum, so it is sometimes required to split
a payload over several fragment sentences.

Field 3 (1 in this example) is the fragment number of this
sentence. It will be one-based.  A sentence with a fragment count of
1 and a fragment number of 1 is complete in itself.

Field 4 (empty in this example) is a sequential message ID for
multi-sentence messages.

Field 5 (B in this example) is a radio channel code. AIS uses the high
side of the duplex from two VHF radio channels: AIS Channel A is
161.975Mhz (87B); AIS Channel B is 162.025Mhz (88B).  In the wild,
channel codes '1' and '2' may also be encountered; the standards
do not prescribe an interpretation of these but it's obvious enough.

Field 6 (177KQJ5000G?tO`K>RA1wUbN0TKH in this example) is the data
payload. We'll describe how to decode this in later sections.

Field 7 (0) is the number of fill bits requires to pad the data
payload to a 6 bit boundary, ranging from 0 to 5.  Equivalently,
subtracting 5 from this tells how many least significant bits of the
last 6-bit nibble in the data payload should be ignored. Note that
this pad byte has a tricky interaction with the <<<ITU-1371>>>
requirement for byte alignment in over-the-air AIS messages; see the
detailed discussion of message lengths and alignment in a later
section.

The \*-separated suffix (\*5C) is the NMEA 0183 data-integrity checksum
for the sentence, preceded by "*".  It is computed on the entire
sentence including the AIVDM tag but excluding the leading "!".

For comparison, here is an example of a multifragment sentence with a
nonempty message ID field:

--------------------------------------------------------------------
!AIVDM,2,1,3,B,55P5TL01VIaAL@7WKO@mBplU@<PDhh000000001S;AJ::4A80?4i@E53,0*3E
!AIVDM,2,2,3,B,1@0000000000000,2*55
--------------------------------------------------------------------

Technically, NMEA0183 does not actually require that a !-led sentence
be AIS.  This format can be used for any encapsulated data. The
syntax and semantics of fields 1-4 are fixed, and the fill-bit field
and NEA checksum are required, but the payload fields may contain any
encapsulated data.

It is, however, a safe bet that any such sentence containing an A or B
channel code in field 5 is AIVDM/AIVDO.

== Talker IDS ==

The AI prefix commonly found on these sentences is an NMEA talker ID
for a mobile AIS station.  Other possible values are as listed:

.AIS talker IDs
[width="25%",frame="topbot",options="header"]
|================================================
| !AB | NMEA 4.0 Base AIS station
| !AD | MMEA 4.0 Dependent AIS Base Station
| !AI | Mobile AIS station
| !AN | NMEA 4.0 Aid to Navigation AIS station
| !AR | NMEA 4.0 AIS Receiving Station
| !AS | NMEA 4.0 Limited Base Station
| !AT | NMEA 4.0 AIS Transmitting Station
| !AX | NMEA 4.0 Repeater AIS station
| !BS | Base AIS station (deprecated in NMEA 4.0)
| !SA | NMEA 4.0 Physical Shore AIS Station
|================================================

== AIVDM/AIVDO Payload Armoring ==

The data payload is an ASCII-encoded bit vector.  Each character
represents six bits of data.  To recover the six bits, subtract 48
from the ASCII character value; if the result is greater than 40
subtract 8. According to <<IEC-PAS>>, the valid ASCII characters for
this encoding begin with "0" (64) and end with "w" (87); however, the
intermediate range "X" (88) to "\_" (95) is not used.

.ASCII payload armoring
[width="25%",frame="topbot",options="header"]
|======================================
| Char    |ASCII   |Decimal   |Bits
|"0"      | 48     | 0        |000000
|"1"      | 49     | 1        |000001
|"2"      | 50     | 2        |000010
|"3"      | 51     | 3        |000011
|"4"      | 52     | 4        |000100
|"5"      | 53     | 5        |000101
|"6"      | 54     | 6        |000110
|"7"      | 55     | 7        |000111
|"8"      | 56     | 8        |001000
|"9"      | 57     | 9        |001001
|":"      | 58     |10        |001010
|";"      | 59     |11        |001011
|"<"      | 60     |12        |001100
|"="      | 61     |13        |001101
|">"      | 62     |14        |001110
|"?"      | 63     |15        |001111
|"@"      | 64     |16        |010000
|"A"      | 65     |17        |010001
|"B"      | 66     |18        |010010
|"C"      | 67     |19        |010011
|"D"      | 68     |20        |010100
|"E"      | 69     |21        |010101
|"F"      | 70     |22        |010110
|"G"      | 71     |23        |010111
|"H"      | 72     |24        |011000
|"I"      | 73     |25        |011001
|"J"      | 74     |26        |011010
|"K"      | 75     |27        |011011
|"L"      | 76     |28        |011100
|"M"      | 77     |29        |011101
|"N"      | 78     |30        |011110
|"O"      | 79     |31        |011111
|"P"      | 80     |32        |100000
|"Q"      | 81     |33        |100001
|"R"      | 82     |34        |100010
|"S"      | 83     |35        |100011
|"T"      | 84     |36        |100100
|"U"      | 85     |37        |100101
|"V"      | 86     |38        |100110
|"W"      | 87     |39        |100111
|"`"      | 96     |40        |101000
|"a"      | 97     |41        |101001
|"b"      | 98     |42        |101010
|"c"      | 99     |43        |101011
|"d"      |100     |44        |101100
|"e"      |101     |45        |101101
|"f"      |102     |46        |101110
|"g"      |103     |47        |101111
|"h"      |104     |48        |110000
|"i"      |105     |49        |110001
|"j"      |106     |50        |110010
|"k"      |107     |51        |110011
|"l"      |108     |52        |110100
|"m"      |109     |53        |110101
|"n"      |110     |54        |110110
|"o"      |111     |55        |110111
|"p"      |112     |56        |111000
|"q"      |113     |57        |111001
|"r"      |114     |58        |111010
|"s"      |115     |59        |111011
|"t"      |116     |60        |111100
|"u"      |117     |61        |111101
|"v"      |118     |62        |111110
|"w"      |119     |63        |111111
|======================================

Concatenate all six-bit quantities found in the payload, MSB first.
This is the binary payload of the sentence.

== AIS Payload Data Types ==

Data in AIS message payloads (what you get after undoing the AIVDM/AIVDO
armoring) is encoded as bitfields in the sentence.  Bitfields may be
interpreted in one of the following ways:

- Signed or unsigned integer
- Float (scaled from signed integer)
- Flag or Boolean
- Index into a controlled vocabulary
- Reserved bits
- Spare bits
- Strings

Numeric bitfields are interpreted as big-endian twos-complement
integers; when signed, the sign bit is the highest.

Float fields have an associated divisor which should be applied
to convert to the correct units. In one case, the ROT field in message
types 1-3, the scaling operation involves a more elaborate formula.

Flags are encoded as 1 for true/yes/on, 0 for false/no/off.

Indices into controlled vocabularies are numeric bitfields which
must be interpreted using per-field string lists specified in the
standards.

Spare fields generally seem to have been inserted in order to put
certain field starts on 8-bit boundaries, and should be ignored.  Decoders
should not, however, assume that spare fields will be all zeroes.

Reserved fields should not be ignored, as they may be assigned for
extension data in minor revisions of the AIS standard; it is noted in
the message descriptions where this has already occurred.  It is good
practice for a decoder to make reserved fields available to client
applications as uninterpreted bitfields.

Character-string fields within AIS messages are encoded in a special
way, referred to as "six-bit" in the tables below. First, chop the
string field into consecutive six-bit nibbles without padding (each
span of three 8-bit bytes includes 4 of these). Each six-bit nibble
maps to an ASCII character.  Nibbles 0-31 map to the characters "@" (
ASCII 64) through "\_" (ASCII 95) respectively; nibbles 32-63 map to
characters " " (ASCII 32) though "?"  (ASCII 63). Lowercase ASCII
letters, the backtick, right and left curly brackets, pipe bar, tilde
and DEL cannot be encoded.

.Sixbit ASCII
[width="25%",frame="topbot"]
|==========================================================================================
|000000 | 0  |"@"    |010000 |16  |"P"            |100000 |32  |" "     |110000 |48  |"0"
|000001 | 1  |"A"    |010001 |17  |"Q"            |100001 |33  |"!"     |110001 |49  |"1"
|000010 | 2  |"B"    |010010 |18  |"R"            |100010 |34  |"""     |110010 |50  |"2"
|000011 | 3  |"C"    |010011 |19  |"S"            |100011 |35  |"\#"    |110011 |51  |"3"
|000100 | 4  |"D"    |010100 |20  |"T"            |100100 |36  |"$"     |110100 |52  |"4"
|000101 | 5  |"E"    |010101 |21  |"U"            |100101 |37  |"%"     |110101 |53  |"5"
|000110 | 6  |"F"    |010110 |22  |"V"            |100110 |38  |"&"     |110110 |54  |"6"
|000111 | 7  |"G"    |010111 |23  |"W"            |100111 |39  |"\'"    |110111 |55  |"7"
|001000 | 8  |"H"    |011000 |24  |"X"            |101000 |40  |"("     |111000 |56  |"8"
|001001 | 9  |"I"    |011001 |25  |"Y"            |101001 |41  |")"     |111001 |56  |"9"
|001010 |10  |"J"    |011010 |26  |"Z"            |101010 |42  |"\*"    |111010 |58  |":"
|001011 |11  |"K"    |011011 |27  |"["            |101011 |43  |"\+"    |111011 |59  |";"
|001100 |12  |"L"    |011100 |28  |"{backslash}"  |101100 |44  |","     |111100 |60  |"<"
|001101 |13  |"M"    |011101 |29  |"]"            |101101 |45  |"-"     |111101 |61  |"="
|001110 |14  |"N"    |011110 |30  |"\^"           |101110 |46  |"."     |111110 |62  |">"
|001111 |15  |"O"    |011111 |31  |"\_"           |101111 |47  |"/"     |111111 |63  |"?"
|==========================================================================================

According to the standard, trailing unused characters in six-bit
fields will be represented by "@" (six-bit zero); however, real-world
encoders are not careful about this and often have nonzero garbage
after the "@". The terminating "@" should not be considered part of
the text, and any non-"@" characters after it should be discarded.  It
is also common to space-fill short fields such as ship and station
name, so a decoder should strip trailing spaces after stripping
at-signs and the garbage after them.

Trailing string fields are often specified as "up to" a certain number of bits.
Decoders should be prepared to handle any field length up to that
number, including zero.

== AIS Payload Interpretation ==

The following table describes message types that are international
standards from <<ITU1371>> and its revisions.  There are also local
and regional extensions used on inland waterways such as the Danube
and the Thames and in British and Irish coastal waters; pointers
to some of these are included later in this document.

Note that many sources use 1-origin numbering for the bits.  We'll
use 0-origin in this document.

The first 6 bits of the payload (0-5) are the message type.  Message
types are as follows:

.Message types
[width="50%",frame="topbot"]
|======================================================
|01 |Position Report Class A
|02 |Position Report Class A (Assigned schedule)
|03 |Position Report Class A (Response to interrogation)
|04 |Base Station Report
|05 |Static and Voyage Related Data
|06 |Binary Addressed Message
|07 |Binary Acknowledge
|08 |Binary Broadcast Message
|09 |Standard SAR Aircraft Position Report
|10 |UTC and Date Inquiry
|11 |UTC and Date Response
|12 |Addressed Safety Related Message
|13 |Safety Related Acknowledgement
|14 |Safety Related Broadcast Message
|15 |Interrogation
|16 |Assignment Mode Command
|17 |DGNSS Binary Broadcast Message
|18 |Standard Class B CS Position Report
|19 |Extended Class B Equipment Position Report
|20 |Data Link Management
|21 |Aid-to-Navigation Report
|22 |Channel Management
|23 |Group Assignment Command
|24 |Static Data Report
|25 |Single Slot Binary Message,
|26 |Multiple Slot Binary Message With Communications State
|27 |Position Report For Long-Range Applications
|======================================================

In normal operation, an AIS transceiver will broadcast a position report
(type 1, 2, or 3) every 2 to 10 seconds depending on the vessel's
speed while underway, and every 3 minutes while the vessel is at
anchor and stationary. It will send a type 5 identification every 6
minutes. (More detail is at <<IALA>>, part 2.3)

Class 6 is used for unencrypted structured extension messages systems
conforming to the Inland AIS standard defined by <<INLAND>>, and by local
authorities such as the St. Lawrence Seaway and the U.S Coast Guard's
PAWSS.  This document describes all of the Class 6 special message
formats approved for use in <<IMO236>>, <<IMO289>>, and <<INLAND>>.

Class 8 is in common use for private encrypted messages, such as
location transmission in military exercises. It is also used for
unencrypted structured extension messages by Inland AIS, and by local
authorities such as the St. Lawrence Seaway and PAWSS. This document
describes all of the Class 8 special message formats approved for use
in <<IMO236>>, <<IMO289>>, and <<INLAND>>.

Classes 12 and 14 are used for text messaging, nominally safety-related
but also for traffic control and occasionally chatter.

In practice, message types other than 1, 3, 4, 5, 18, and 24 are
unusual or rare; many AIS transmitters never emit them.

An MMSI is a Mobile Marine Service Identifier, a unique 9-digit ID for
the ship's radio(s).  The first three digits convey information about
the country in which the ID was issued <<ITU-MID>>.  US vessels
travelling solely in U.S. waters sometimes incorrectly omit the
leading "3", the geography code for North and Central America and
Caribbean, emitting 8-digit MMSIs beginning with the U.S. country code
of 669.

According to <<MMSI>>, different formats of MMSI are used for
different classes of transmitter. In the format descriptions below, a
MID is a three-digit decimal literal ranging from 201 to 775 that
identifies a country or other maritime jurisdiction.  See <<ITU-MID>>
for a list of MIDs.

.MID formats
[frame="topbot",options="header"]
|==============================================================================
|8MIDXXXXX  | Diver's radio (not used in the U.S. in 2013)
|MIDXXXXXX  | Ship
|0MIDXXXXX  | Group of ships; the U.S. Coast Guard, for example, is 03699999
|00MIDXXXX  | Coastal stations
|111MIDXXX  | SAR (Search and Rescue) aircraft
|99MIDXXXX  | Aids to Navigation
|98MIDXXXX  | Auxiliary craft associated with a parent ship
|970MIDXXX  | AIS SART (Search and Rescue Transmitter)
|972XXXXXX  | MOB (Man Overboard) device
|974XXXXXX  | EPIRB (Emergency Position Indicating Radio Beacon) AIS
|==============================================================================

Detailed descriptions of message types 1-24 follow. Message types 1-22
are derived from <<IALA>>. Message type 23 was described to me by Mike
Greene based on <<IEC-62287>>.  Message type 24 was described to me by
<<Schwehr>>, whose Python toolkit decodes it. Message types 25-26 are
reported by <<Schwehr>>, who observes they were added in Version 3 of
<<ITU1371>>. Message type 27 is direct from <<ITU1371>> version 4.

The "Member" column in these tables is not derived from any of the ITU
standards or amendments.  I have invented it in order to be able to
describe a lossless textual encoding of AIS sentences in JSON.  These
names are also chosen for suitability as structure/object member names
in computer languages, so that application programming interfaces
across different languages can have a common and readily intelligible
set to use.

The "T" column declares the data type of the field, and may have
any of the values in the following table.  It is intended to be used
for generating bitfield-extraction code directly from the message
type descriptions.

[frame="topbot",options="header"]
|==============================================================================
|u|   Unsigned integer
|U|   Unsigned integer with scale - renders as float, suffix is decimal places
|i|   Signed integer
|I|   Signed integer with scale - renders as float, suffix is decimal places
|b|   Boolean
|e|   Enumerated type (controlled vocabulary)
|x|   Spare or reserved bit
|t|   String (packed six-bit ASCII)
|d|   Data (uninterpreted binary)
|a|   Array boundary, numeric suffix is maximum array size.
      ^ before suffix means preceding fields is the length.
      Following fields are repeated to end of message
|==============================================================================

The field breakdowns in this document have been checked against live
decoded data rendered by known-good implementations for message types
1-15, 18-21, and 24.  Described but unchecked are 16-17, 22-23, and
25-27. Also, the interpretation of IMO extension subtypes of messages
6 and 8 has yet to be tested.

Bit lengths and length ranges are given because decoders should check
them against the message type. Messages with correct checksums but the
wrong payload length for their type occur with about 0.3% frequency on
AISHub; if you don't reject these, your clients will see spurious
zeros or garbage.

=== Types 1, 2 and 3: Position Report Class A ===

Type 1, 2 and 3 messages share a common reporting structure for
navigational information; we'll call it the Common Navigation Block
(CNB). This is the information most likely to be of interest for
decoding software. Total of 168 bits, occupying one AIVDM sentence.

//: Type CNB
.Common Navigation Block
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description             |Member    |T|Units
|0-5     | 6  |Message Type            |type      |u|Constant: 1-3
|6-7     | 2  |Repeat Indicator        |repeat    |u|Message repeat count
|8-37    |30  |MMSI                    |mmsi      |u|9 decimal digits
|38-41   | 4  |Navigation Status       |status    |e|See "Navigation Status"
|42-49   | 8  |Rate of Turn (ROT)      |turn      |I3|See below
|50-59   |10  |Speed Over Ground (SOG) |speed     |U1|See below
|60-60   | 1  |Position Accuracy       |accuracy  |b|See below
|61-88   |28  |Longitude               |lon       |I4|Minutes/10000 (see below)
|89-115  |27  |Latitude                |lat       |I4|Minutes/10000 (see below)
|116-127 |12  |Course Over Ground (COG)|course    |U1|Relative to true north,
                                                     to 0.1 degree precision
|128-136 | 9  |True Heading (HDG)      |heading   |u|0 to 359 degrees,
                                                      511 = not available.
|137-142 | 6  |Time Stamp              |second    |u|Second of UTC timestamp
|143-144 | 2  |Maneuver Indicator      |maneuver  |e|See "Maneuver Indicator"
|145-147 | 3  |Spare                   |          |x|Not used
|148-148 | 1  |RAIM flag               |raim      |b|See below
|149-167 |19  |Radio status            |radio     |u|See below
|==============================================================================

The Repeat Indicator is a directive to an AIS transceiver that this
message should be rebroadcast.  This was intended as a way of getting
AIS messages around hills and other obstructions in coastal waters,
but is little used as base station coverage is more effective.  It is
intended that the bit be incremented on each retransmission, to a
maximum of three hops. A value of 3 indicates "Do not repeat".

.Navigation Status
[width="50%",frame="topbot"]
|=================================================================
|0 | Under way using engine
|1 | At anchor
|2 | Not under command
|3 | Restricted manoeuverability
|4 | Constrained by her draught
|5 | Moored
|6 | Aground
|7 | Engaged in Fishing
|8 | Under way sailing
|9 | Reserved for future amendment of Navigational Status for HSC
|10| Reserved for future amendment of Navigational Status for WIG
|11| Reserved for future use
|12| Reserved for future use
|13| Reserved for future use
|14| AIS-SART is active
|15| Not defined (default)
|=================================================================

Note, the AIS-SART value was added after <<IALA>> and designates an
AIS transmitter in an survival craft such as a lifeboat.  See
<<AIS-SART>> for the field specification and <<SART>> for
background.

Turn rate is encoded as follows:

* 0 = not turning
* 1...126 = turning right at up to 708 degrees per minute or higher
* 1...-126 = turning left at up to 708 degrees per minute or higher
* 127 = turning right at more than 5deg/30s (No TI available)
* -127 = turning left at more than 5deg/30s (No TI available)
* 128 (80 hex) indicates no turn information available (default)

Values between 0 and 708 degrees/min coded by ROT~AIS~=4.733 *
SQRT(ROT~sensor~) degrees/min where ROT~sensor~ is the Rate of Turn as
input by an external Rate of Turn Indicator. ROT~AIS~ is rounded to
the nearest integer value.  Thus, to decode the field value, divide by 4.733
and then square it. Sign of the field value should be preserved when
squaring it, otherwise the left/right indication will be lost.

Speed over ground is in 0.1-knot resolution from 0 to 102 knots.
Value 1023 indicates speed is not available, value 1022 indicates
102.2 knots or higher.

The position accuracy flag indicates the accuracy of the fix.  A value of
1 indicates a DGPS-quality fix with an accuracy of < 10ms.  0, the
default, indicates an unaugmented GNSS fix with accuracy > 10m.

Longitude is given in in 1/10000 min; divide by 600000.0 to obtain
degrees. Values up to plus or minus 180 degrees, East = positive, West
\= negative.  A value of 181 degrees (0x6791AC0 hex) indicates that
longitude is not available and is the default.

Latitude is given in in 1/10000 min; divide by 600000.0 to obtain
degrees. Values up to plus or minus 90 degrees, North = positive,
South = negative. A value of 91 degrees (0x3412140 hex) indicates
latitude is not available and is the default.

Course over ground will be 3600 (0xE10) if that data is not available.

Seconds in UTC timestamp should be 0-59, except for these special values:

* 60 if time stamp is not available (default)
* 61 if positioning system is in manual input mode
* 62 if Electronic Position Fixing System operates in estimated (dead
     reckoning) mode,
* 63 if the positioning system is inoperative.

The Regional Reserved field is intended for use by local maritime
authorities.  It is not known to be in any actual use up to 2009.

The Maneuver Indicator (143-144) may have these values:

.Maneuver Indicator
[width="50%",frame="topbot",options="header"]
|===========================================================
|0 | Not available (default)
|1 | No special maneuver
|2 | Special maneuver (such as regional passing arrangement)
|===========================================================

Riverine and inland navigation systems conforming to <<INLAND>>
designate this field "Blue Sign" with the following enumerated
values:

.Blue Sign
[width="50%",frame="topbot",options="header"]
|===========================================================
|0 | Not available (default)
|1 | No
|2 | Yes
|===========================================================

The interpretation of bits 143-147 has been a bit unstable. In
<<IALA>> and therefore in the original <<ITU1371>>, they were
described like this:

[width="50%",frame="topbot",options="header"]
|=================================
|Field   |Len |Description
|143-145 | 3  |Regional Reserved
|146-147 | 2  |Spare
|=================================

The interpretation of 143-144 as a special maneuver field is new in
revision 3 of <<ITU1371>>.

The RAIM flag indicates whether Receiver Autonomous Integrity
Monitoring is being used to check the performance of the EPFD.
0 = RAIM not in use (default), 1 = RAIM in use.  See <<RAIM>> for
a detailed description of this flag.

Bits 149-167 are diagnostic information for the radio system.  Consult
<<IALA>> for detailed description of the latter.

=== Type 4: Base Station Report ===

This message is to be used by fixed-location base stations to
periodically report a position and time reference. Total of 168 bits,
occupying one AIVDM sentence.

The standard uses "EPFD" to designate any Electronic Position Fixing Device.

//: Type 4
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len  |Description      |Member   |T|Units
|0-5     |  6  |Message Type     |type     |u|Constant: 4
|6-7     |  2  |Repeat Indicator |repeat   |u|As in Common Navigation Block
|8-37    | 30  |MMSI             |mmsi     |u|9 decimal digits
|38-51   | 14  |Year (UTC)       |year     |u|UTC, 1-9999, 0 = N/A (default)
|52-55   |  4  |Month (UTC)      |month    |u|1-12; 0 = N/A (default)
|56-60   |  5  |Day (UTC)        |day      |u|1-31; 0 = N/A (default)
|61-65   |  5  |Hour (UTC)       |hour     |u|0-23; 24 = N/A (default)
|66-71   |  6  |Minute (UTC)     |minute   |u|0-59; 60 = N/A (default)
|72-77   |  6  |Second (UTC)     |second   |u|0-59; 60 = N/A (default)
|78-78   |  1  |Fix quality      |accuracy |b|As in Common Navigation Block
|79-106  | 28  |Longitude        |lon      |I4|As in Common Navigation Block
|107-133 | 27  |Latitude         |lat      |I4|As in Common Navigation Block
|134-137 |  4  |Type of EPFD     |epfd     |e|See "EPFD Fix Types"
|138-147 | 10  |Spare            |         |x|Not used
|148-148 |  1  |RAIM flag        |raim     |b|As for common navigation block
|149-167 | 19  |SOTDMA state     |radio    |u|As in same bits for Type 1
|==============================================================================

.EPFD Fix Types
[width="50%",frame="topbot",options="header"]
|===================================
|Code |Position Fix Type
|0    |Undefined (default)
|1    |GPS
|2    |GLONASS
|3    |Combined GPS/GLONASS
|4    |Loran-C
|5    |Chayka
|6    |Integrated navigation system
|7    |Surveyed
|8    |Galileo
|===================================

Note: though values 9-15 are marked "not used" in <<IALA>>, the EPFD
type value 15 (all field bits 1) is not uncommon in the wild; it
appears some receivers emit it as the undefined value. Decoders should
be prepared to accept this.

=== Type 5: Static and Voyage Related Data ===

Message has a total of 424 bits, occupying two AIVDM sentences.

In practice, the information in these fields (especially ETA and
destination) is not reliable, as it has to be hand-updated by
humans rather than gathered automatically from sensors.

Also note that it is fairly common in the wild for this message to
have a wrong bit length (420 or 422). Robust decoders should ignore
trailing garbage and deal gracefully with a slightly truncated
destination field.

//: Type 5
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description            |Member/Type  |T|Encoding
|0-5     |  6 |Message Type           |type         |u|Constant: 5
|6-7     |  2 |Repeat Indicator       |repeat       |u|Message repeat count
|8-37    | 30 |MMSI                   |mmsi         |u|9 digits
|38-39   |  2 |AIS Version            |ais_version  |u|0=<<ITU1371>>,
                                                       1-3 = future editions
|40-69   | 30 |IMO Number             |imo          |u|IMO ship ID number
|70-111  | 42 |Call Sign              |callsign     |t|7 six-bit characters
|112-231 |120 |Vessel Name            |shipname     |t|20 six-bit characters
|232-239 |  8 |Ship Type              |shiptype     |e|See "Codes for Ship Type"
|240-248 |  9 |Dimension to Bow       |to_bow       |u|Meters
|249-257 |  9 |Dimension to Stern     |to_stern     |u|Meters
|258-263 |  6 |Dimension to Port      |to_port      |u|Meters
|264-269 |  6 |Dimension to Starboard |to_starboard |u|Meters
|270-273 |  4 |Position Fix Type      |epfd         |e|See "EPFD Fix Types"
|274-277 |  4 |ETA month (UTC)        |month        |u|1-12, 0=N/A (default)
|278-282 |  5 |ETA day (UTC)          |day          |u|1-31, 0=N/A (default)
|283-287 |  5 |ETA hour (UTC)         |hour         |u|0-23, 24=N/A (default)
|288-293 |  6 |ETA minute (UTC)       |minute       |u|0-59, 60=N/A (default)
|294-301 |  8 |Draught                |draught      |U1|Meters/10
|302-421 |120 |Destination            |destination  |t|20 6-bit characters
|422-422 |  1 |DTE                    |dte          |b|0=Data terminal ready,
                                                       1=Not ready (default).
|423-423 |  1 |Spare                  |             |x|Not used
|==============================================================================

<<INLAND>> specifies the following:

* the IMO Number field should be zeroed for inland vessels.
* ATIS code should be used for inland vessels
* ship dimensions should be set to the maximum rectangle size of the convoy
* draught information should be rounded up to nearest decimeter
* For the destination, UN/LOCODE and ERI terminal codes should be used

Ship dimensions will be 0 if not available. For the dimensions to bow
and stern, the special value 511 indicates 511 meters or greater; for
the dimensions to port and starboard, the special value 63 indicates
63 meters or greater.

.Codes for Ship Type
[width="50%",frame="topbot",options="header"]
|==============================================================
|Code   |Ship & Cargo Classification
|0      |Not available (default)
|1-19   |Reserved for future use
|20     |Wing in ground (WIG), all ships of this type
|21     |Wing in ground (WIG), Hazardous category A
|22     |Wing in ground (WIG), Hazardous category B
|23     |Wing in ground (WIG), Hazardous category C
|24     |Wing in ground (WIG), Hazardous category D
|25     |Wing in ground (WIG), Reserved for future use
|26     |Wing in ground (WIG), Reserved for future use
|27     |Wing in ground (WIG), Reserved for future use
|28     |Wing in ground (WIG), Reserved for future use
|29     |Wing in ground (WIG), Reserved for future use
|30     |Fishing
|31     |Towing
|32     |Towing: length exceeds 200m or breadth exceeds 25m
|33     |Dredging or underwater ops
|34     |Diving ops
|35     |Military ops
|36     |Sailing
|37     |Pleasure Craft
|38     |Reserved
|39     |Reserved
|40     |High speed craft (HSC), all ships of this type
|41     |High speed craft (HSC), Hazardous category A
|42     |High speed craft (HSC), Hazardous category B
|43     |High speed craft (HSC), Hazardous category C
|44     |High speed craft (HSC), Hazardous category D
|45     |High speed craft (HSC), Reserved for future use
|46     |High speed craft (HSC), Reserved for future use
|47     |High speed craft (HSC), Reserved for future use
|48     |High speed craft (HSC), Reserved for future use
|49     |High speed craft (HSC), No additional information
|50     |Pilot Vessel
|51     |Search and Rescue vessel
|52     |Tug
|53     |Port Tender
|54     |Anti-pollution equipment
|55     |Law Enforcement
|56     |Spare - Local Vessel
|57     |Spare - Local Vessel
|58     |Medical Transport
|59     |Noncombatant ship according to RR Resolution No. 18
|60     |Passenger, all ships of this type
|61     |Passenger, Hazardous category A
|62     |Passenger, Hazardous category B
|63     |Passenger, Hazardous category C
|64     |Passenger, Hazardous category D
|65     |Passenger, Reserved for future use
|66     |Passenger, Reserved for future use
|67     |Passenger, Reserved for future use
|68     |Passenger, Reserved for future use
|69     |Passenger, No additional information
|70     |Cargo, all ships of this type
|71     |Cargo, Hazardous category A
|72     |Cargo, Hazardous category B
|73     |Cargo, Hazardous category C
|74     |Cargo, Hazardous category D
|75     |Cargo, Reserved for future use
|76     |Cargo, Reserved for future use
|77     |Cargo, Reserved for future use
|78     |Cargo, Reserved for future use
|79     |Cargo, No additional information
|80     |Tanker, all ships of this type
|81     |Tanker, Hazardous category A
|82     |Tanker, Hazardous category B
|83     |Tanker, Hazardous category C
|84     |Tanker, Hazardous category D
|85     |Tanker, Reserved for future use
|86     |Tanker, Reserved for future use
|87     |Tanker, Reserved for future use
|88     |Tanker, Reserved for future use
|89     |Tanker, No additional information
|90     |Other Type, all ships of this type
|91     |Other Type, Hazardous category A
|92     |Other Type, Hazardous category B
|93     |Other Type, Hazardous category C
|94     |Other Type, Hazardous category D
|95     |Other Type, Reserved for future use
|96     |Other Type, Reserved for future use
|97     |Other Type, Reserved for future use
|98     |Other Type, Reserved for future use
|99     |Other Type, no additional information
|==============================================================

Note that garbage values greater than 99 are supposed to be unused,
but are not uncommon in the wild; AIS transmitters seem prone to put
junk in this field when it's not explicitly set.  Decoders should
treat these like value 0 rather than throwing an exception until and
unless the controlled vocabulary is extended to include the unknown
values.

=== Type 6: Binary Addressed Message ===

Message type 6 is an addressed point-to-point message with unspecified
binary payload.  The St. Lawrence Seaway AIS system, the USG PAWSS
system, and the Port Authority of London use this payload for local
extension messages. <<IMO236>> and <<IMO289>> describe payload use as
international extension messages.  This type is variable in length up
to a maximum of 1008 bits (up to 5 AIVDM sentence payloads).

//: Type 6
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member    |T|Units
|0-5     |  6 |Message Type         |type      |u|Constant: 6
|6-7     |  2 |Repeat Indicator     |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi      |u|9 decimal digits
|38-39   |  2 |Sequence Number      |seqno     |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI     |dest_mmsi |u|9 decimal digits
|70      |  1 |Retransmit flag      |retransmit|b|0 = no retransmit (default)
                                                  1 = retransmitted
|71      |  1 |Spare                |          |x|Not used
|72-81   | 10 |Designated Area Code |dac       |u|Unsigned integer
|82-87   |  6 |Functional ID        |fid       |u|Unsigned integer
|88      |920 |Data                 |data      |d|Binary data
                                                  May be shorter than 920 bits.
|==============================================================================

Interpretation of the binary payload is controlled by:

* The Designated Area Code, which is a jurisdiction code: 366 for the
  United States.  It uses the same encoding as the area designator in
  MMMSIs; see <<ITU-MID>>. 1 designates international (ITU) messages.

* The FID, which is the Functional ID for a message subtype. In some
  sources this is abbreviated FI.

The following is a non-exhaustive list of standardized DAC-FID pairs
in use for type 6.

|==============================================================================
| DAC |FID | Source        | Status           | Description
|   1 | 12 | <<IMO236>>    | Deprecated       | Dangerous cargo indication
|   1 | 14 | <<IMO236>>    | Deprecated       | Tidal window
|   1 | 16 | <<IMO236>>    | Deprecated/In Use| Number of persons on board
|   1 | 16 | <<IMO289>>    | Standard         | Number of persons on board
|   1 | 18 | <<IMO289>>    | Standard         | Clearance time to enter port
|   1 | 20 | <<IMO289>>    | Standard         | Berthing data (addressed)
|   1 | 23 | <<IMO289>>    | In use           | Area notice (addressed)
|   1 | 25 | <<IMO289>>    | Standard         | Dangerous Cargo indication
|   1 | 28 | <<IMO289>>    | Standard         | Route info addressed
|   1 | 30 | <<IMO289>>    | Standard         | Text description addressed
|   1 | 32 | <<IMO289>>    | Standard         | Tidal Window
| 200 | 21 | <<INLAND>>    | Standard         | ETA at lock/bridge/terminal
| 200 | 22 | <<INLAND>>    | Standard         | RTA at lock/bridge/terminal
| 200 | 55 | <<INLAND>>    | Standard         | Number of persons on board
| 235 | 10 | <<IALA-A126>> | In use           | AtoN monitoring data (UK)
| 250 | 10 | <<IALA-A126>> | In use           | AtoN monitoring data (ROI)
|==============================================================================

DAC/FID pairs are assigned separately per message type.

Note that the apparent presence of one of these DAC/FID pairs does
not guarantee that the message is structured.  Decoders should
perform range validation on the structured fields and interpret the
message as unstructured if any check fails. (As of Aug 2014 no such
collisions have been in the wild; but see the parallel note for Type 8.)

A list of binary layouts for selected subtypes of message 6 follows.

==== IMO236 Dangerous Cargo Indication ====

This message should be used as a response to a request for Dangerous
Cargo Indication from a competent authority. The message content is
used to identify the port where the documents for the dangerous goods
cargo can be found, e. g. last and next port of call, and to allow
the requesting authority to form a danger estimate.

A message 6 subtype. DAC = 001 FID = 12. Fixed length: 360 bits.
This is the <<IMO236>> version, now deprecated; there is a later
<<IMO289>> version.

//: Type 6(1/12)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member    |T|Units
|0-5     |  6 |Message Type         |type      |u|Constant: 6
|6-7     |  2 |Repeat Indicator     |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi      |u|9 decimal digits
|38-39   |  2 |Sequence Number      |seqno     |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI     |dest_mmsi |u|9 decimal digits
|70-70   |  1 |Retransmit flag      |retransmit|u|0 = no retransmit (default),
                                                  1 = retransmitted
|71-71   |  1 |Spare                |          |x|Not used
|72-81   | 10 |DAC                  |dac       |u|DAC = 001
|82-87   |  6 |FID                  |fid       |u|FID = 12
|88-117  | 30 |Last Port Of Call    |lastport  |t|5 6-bit characters, UN locode
|118-121 |  4 |ETA month (UTC)      |lmonth    |u|1-12, 0=N/A (default)
|122-126 |  5 |ETA day (UTC)        |lday      |u|1-31, 0=N/A (default)
|127-131 |  5 |ETA hour (UTC)       |lhour     |u|0-23, 24=N/A (default)
|132-137 |  6 |ETA minute (UTC)     |lminute   |u|0-59, 60=N/A (default)
|138-167 | 30 |Next Port Of Call    |nextport  |t|5 6-bit characters, UN locode
|168-171 |  4 |ETA month (UTC)      |nmonth    |u|1-12, 0=N/A (default)
|172-176 |  5 |ETA day (UTC)        |nday      |u|1-31, 0=N/A (default)
|177-181 |  5 |ETA hour (UTC)       |nhour     |u|0-23, 24=N/A (default)
|182-187 |  6 |ETA minute (UTC)     |nminute   |u|0-59, 60=N/A (default)
|188-307 |120 |Main Dangerous Good  |dangerous |t|20 6-bit characters
|308-331 | 24 |IMD Category         |imdcat    |t|4  6-bit characters
|332-344 | 13 |UN Number            |unid      |u|1-3363 UN Number
|345-354 | 10 |Amount of Cargo      |amount    |u|Unsigned integer
|355-356 |  2 |Unit of Quantity     |unit      |e|See "Cargo Unit Codes"
|357-359 |  3 |Spare                |          |x|Not used
|==============================================================================

.Cargo Unit Codes
[width="50%",frame="topbot",options="header"]
|===================================
|Code |Unit
|0    |Not available (default)
|1    |kg
|2    |metric tons
|3    |metric kilotons
|===================================

==== IMO236 Tidal Window ====

This message should be used by shore stations to inform vessels about
tidal windows which allow a vessel the safe passage of a fairway.  The
message includes 1-3 predictions of current speed and current direction.
Acknowledgment is required.

A message 6 subtype. DAC = 001 FID = 14. Variable length: 190-376 bits
This is the <<IMO236>> version; there is an <<IMO289>> version with
different widths for the latitude, longitude, and current-speed fields
(also the order of lat/lon is swapped).

//: Type 6(1/14)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description            |Member    |T|Units
|0-5     |  6 |Message Type           |type      |u|Constant: 6
|6-7     |  2 |Repeat Indicator       |repeat    |u|See Common Navigation Block
|8-37    | 30 |Source MMSI            |mmsi      |u|9 decimal digits
|38-39   |  2 |Sequence Number        |seqno     |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI       |dest_mmsi |u|9 decimal digits
|70-70   |  1 |Retransmit flag        |retransmit|b|0 = no retransmit (default),
                                                    1 = retransmitted
|71-71   |  1 |Spare                  |          |x|Not used
|72-81   | 10 |DAC                    |dac       |u|DAC = 001
|82-87   |  6 |FID                    |fid       |u|FID = 14
|88-91   |  4 |Month                  |month     |u|1-12; 0 = N/A (default)
|92-96   |  5 |Day                    |day       |u|1-31; 0 = N/A (default)
|97      |    |                       |tidals    |a3|Tidal information array
|0-26    | 27 |Latitude               |lat       |I4|Unit = minutes * 0.0001,
                                                    91000 = N/A (default),
                                                    N positive, S negative.
|27-54   | 28 |Longitude              |lon       |I4|Unit = minutes * 0.0001,
                                                    181000 = N/A (default),
                                                    E positive, W negative.
|55-59   |  5 |From UTC Hour          |from_hour |u|0-23, 24 = N/A (default)
|60-65   |  6 |From UTC Minute        |from_min  |u|0-59, 60 = N/A (default)
|66-70   |  5 |To UTC Hour            |to_hour   |u|0-23, 24 = N/A (default)
|71-76   |  6 |To UTC Minute          |to_min    |u|0-59, 60 = N/A (default)
|77-85   |  9 |Current Dir. Predicted |cdir      |u|0-359 deg, 360-N/A (default)
|86-92   |  7 |Current Speed Predicted|cspeed    |U1|0-126, units of 0.1 knots,
                                                   127 = N/A (default).
|=============================================================================

The group of fields from longitude on may repeat twice more to convey up to
three points of tidal information.

==== IMO236 Number of persons on board ====

This message should be used by a ship to report the number of persons
on board, e.g. on request by a competent authority.  Acknowledgement
required.

A message 6 subtype. DAC = 001 FID = 16.

<<IMO236>> describes a fixed-length, 72-bit message with this layout:

[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member   |T|Units
|0-5     |  6 |Message Type         |type     |u|Constant: 6
|6-7     |  2 |Repeat Indicator     |repeat   |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi     |u|9 decimal digits
|38-39   |  2 |Spare                |         |x|Not used
|40-49   | 10 |DAC                  |dac      |u|DAC = 001
|50-55   |  6 |FID                  |fid      |u|FID = 16
|55-68   | 14 |# persons on board   |persons  |u|Unsigned integer
                                                 0 = N/A (default)
                                                 8191 = >= 8191 persons.
|69-71   |  3 |Spare                |         |x|Not used
|==============================================================================

OPEN-QUESTION: Note that though this is a message 6 subtype and
described in <<IMO236>> with the attribute "addressed", there is no
destination address.  A strikeout in <<IMO236>> suggests that this was
originally a subtype of 8.  It would be good defensive implementation
for a decoder to accept either.  Bit length may be used to distinguish
them.

<<IMO289>> describes a fixed-length, 136-bit message with this layout:

//: Type 6(1/16)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member    |T|Units
|0-5     |  6 |Message Type         |type      |u|Constant: 6
|6-7     |  2 |Repeat Indicator     |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi      |u|9 decimal digits
|38-39   |  2 |Sequence Number      |seqno     |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI     |dest_mmsi |u|9 decimal digits
|70-70   |  1 |Retransmit flag      |retransmit|b|0 = no retransmit (default),
                                                  1 = retransmitted.
|71-71   |  1 |Spare                |          |x|Not used
|72-81   | 10 |DAC                  |dac       |u|DAC = 001
|82-87   |  6 |FID                  |fid       |u|FID = 16
|88-100  | 13 |# persons on board   |persons   |u|Unsigned integer,
                                                  0 = N/A (default),
                                                  8191 = >= 8191 persons.
|101-135 | 35 |Spare                |          |x|Not used
|==============================================================================

==== IMO289 Clearance Time To Enter Port ====

This message provides specific ships with information on the port to call and
time to enter.  It should be transmitted by an authority competent to grant
use of the port.

A message 6 subtype. DAC = 001 FID = 18. Fixed length: 360 bits.

//: Type 6(1/18)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member     |T|Units
|0-5     |  6 |Message Type         |type       |u|Constant: 6
|6-7     |  2 |Repeat Indicator     |repeat     |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi       |u|9 decimal digits
|38-39   |  2 |Sequence Number      |seqno      |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI     |dest_mmsi  |u|9 decimal digits
|70-70   |  1 |Retransmit flag      |retransmit |b|0 = no retransmit (default),
                                                   1 = retransmitted.
|71-71   |  1 |Spare                |           |x|Not used
|72-81   | 10 |DAC                  |dac        |u|DAC = 001
|82-87   |  6 |FID                  |fid        |u|FID = 18
|88-97   | 10 |Message Linkage ID   |linkage    |u|Unsigned integer
|98-101  |  4 |Month (UTC)          |month      |u|1-12; 0 = N/A (default)
|102-106 |  5 |Day (UTC)            |day        |u|1-31; 0 = N/A (default)
|107-111 |  5 |Hour (UTC)           |hour       |u|0-23; 24 = N/A (default)
|112-117 |  6 |Minute (UTC)         |minute     |u|0-59; 60 = N/A (default)
|118-237 |120 |Name of Port & Berth |portname   |t|20 6-bit characters
|238-267 | 30 |Destination          |destination|t|5 6-bit characters
|268-292 | 25 |Longitude            |lon        |I3|Unit = minutes * 0.001,
                                                   181000 = N/A (default).
|293-316 | 24 |Latitude             |lat        |I3|Unit = minutes * 0.001,
                                                   91000 = N/A (default).
|317-359 | 43 |Spare                |           |x|Not used
|==============================================================================

==== IMO 289 Berthing Data (addressed) ====

This message provides information on the ship's berth. If sent from a
ship it is a berthing request; if it is transmitted by a competent
authority it is a berthing assignment.

A message 6 subtype. DAC = 001 FID = 20. Fixed Length: 360 bits.

The 2-bit fields after "availability" describe services which may be
available at the berth.  They are valid only if this master availability
bit is on.

//: Type 6(1/20)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member/Type |T|Units
|0-5     |  6 |Message Type       |type        |u|Constant: 6
|6-7     |  2 |Repeat Indicator   |repeat      |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI        |mmsi        |u|9 decimal digits
|38-39   |  2 |Sequence Number    |seqno       |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI   |dest_mmsi   |u|9 decimal digits
|70-70   |  1 |Retransmit flag    |retransmit  |b|0 = no retransmit (default)
                                                  1 = retransmitted
|71-71   |  1 |Spare              |            |x|Not used
|72-81   | 10 |DAC                |dac         |u|AC = 001
|82-87   |  6 |FID                |fid         |u|ID = 20
|88-97   | 10 |Message Linkage ID |linkage     |u|Unsigned integer
|98-106  |  9 |Berth length       |berth_length|u|In 1m steps, 1-510m,
                                                  511 = >= 511m
                                                  0 = N/A (default).
|107-114 |  8 |Berth Water Depth  |berth_depth |U1|0.1-25.4m in 0.1 steps
                                                  255 = >= 25.5m
                                                  0 = N/A (default)
|115-117 |  3 |Mooring Position   |position    |e|See "Mooring Position"
|118-121 |  4 |Month (UTC)        |month       |u|1-12; 0 = N/A (default)
|122-126 |  5 |Day (UTC)          |day         |u|1-31; 0 = N/A (default)
|127-131 |  5 |Hour (UTC)         |hour        |u|0-23; 24 = N/A (default)
|132-137 |  6 |Minute (UTC)       |minute      |u|0-59; 60 = N/A (default)
|138-138 |  1 |Services Availability|availability|b|0 = services unknown (default)
                                                    1 = services known
|139-140 |  2 |Agent              |agent       |e|See "Service Status"
|141-142 |  2 |Bunker/fuel        |fuel        |e|See "Service Status"
|143-144 |  2 |Chandler           |chandler    |e|See "Service Status"
|145-146 |  2 |Stevedore          |stevedore   |e|See "Service Status"
|147-148 |  2 |Electrical         |electrical  |e|See "Service Status"
|149-150 |  2 |Potable water      |water       |e|See "Service Status"
|151-152 |  2 |Customs house      |customs     |e|See "Service Status"
|153-154 |  2 |Cartage            |cartage     |e|See "Service Status"
|155-156 |  2 |Crane(s)           |crane       |e|See "Service Status"
|157-158 |  2 |Lift(s)            |lift        |e|See "Service Status"
|159-160 |  2 |Medical facilities |medical     |e|See "Service Status"
|161-162 |  2 |Navigation repair  |navrepair   |e|See "Service Status"
|163-164 |  2 |Provisions         |provisions  |e|See "Service Status"
|165-166 |  2 |Ship repair        |shiprepair  |e|See "Service Status"
|167-168 |  2 |Surveyor           |surveyor    |e|See "Service Status"
|169-170 |  2 |Steam              |steam       |e|See "Service Status"
|171-172 |  2 |Tugs               |tugs        |e|See "Service Status"
|173-174 |  2 |Waste disposal (solid)    |solidwaste    |e|See "Service Status"
|175-176 |  2 |Waste disposal (liquid)   |liquidwaste   |e|See "Service Status"
|177-178 |  2 |Waste disposal (hazardous)|hazardouswaste|e|See "Service Status"
|179-180 |  2 |Reserved ballast exchange |ballast       |e|See "Service Status"
|181-182 |  2 |Additional services|additional  |e|See "Service Status"
|183-184 |  2 |Regional reserved 1|regional1   |e|See "Service Status"
|185-186 |  2 |Regional reserved 2|regional2   |e|See "Service Status"
|187-188 |  2 |Reserved for future|future1     |e|See "Service Status"
|189-190 |  2 |Reserved for future|future2     |e|See "Service Status"
|191-310 |120 |Name of Berth      |berth_name  |t|20 6-bit characters
|311-335 | 25 |Longitude          |berth_lon   |I3|Minutes * 0.001,
                                                  181000 = N/A (default)
|336-359 | 24 |Latitude           |berth_lat   |I3|Minutes * 0.001,
                                                  91000 = N/A (default)
|==============================================================================

The UTC timestamp refers to the time requested or granted for berthing.

The longitude and latitude refer to the center of the berth.

.Mooring Position
[width="50%",frame="topbot",options="header"]
|===================================
|Code |Position
|0    |Not available (default)
|1    |Port-side to
|2    |Starboard-side to
|3    |Mediterranean (end-on) mooring
|4    |Mooring buoy
|5    |Anchorage
|6-7  |Reserved for future use
|===================================

.Service Status
[width="50%",frame="topbot",options="header"]
|=============================================================================
|Code |Meaning
|0    |Not available or requested (default)
|1    |Service available
|2    |No data or unknown
|3    |Not to be used
|=============================================================================

==== IMO289 Area Notice (addressed) ====

This should be used to convey time- and location-dependent information about
hazards to navigation.  For information-lifetime restrictions and usage
guidance, refer to <<ITU1371>>.

A message 6 subtype. DAC = 001 FID = 23. 230 to 1013 bits.  There is a
related Message 8 subtype for broadcast use.

The message consists of a fixed-length header of 143 bits, followed by 1 to
10 sub-area indications which are fixed-length records 87 bits long. Here
is the message header format:

//: Type 6(1/23)
.Area Notice (addressed) message header
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member     |T|Units
|0-5     |  6 |Message Type         |type       |u|Constant: 6
|6-7     |  2 |Repeat Indicator     |repeat     |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi       |u|9 decimal digits
|38-39   |  2 |Sequence Number      |seqno      |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI     |dest_mmsi  |u|9 decimal digits
|70-70   |  1 |Retransmit flag      |retransmit |b|0 = no retransmit (default),
                                                   1 = retransmitted.
|71-71   |  1 |Spare                |           |x|Not used
|72-81   | 10 |DAC                  |dac        |u|DAC = 001
|82-87   |  6 |FID                  |fid        |u|FID = 23
|88-97   | 10 |Message Linkage ID   |linkage    |u|Unsigned integer
|98-104  |  7 |Notice Description   |notice     |e|See "Area Notice Description"
|105-108 |  4 |Month (UTC)          |month      |u|1-12; 0 = N/A (default)
|109-113 |  5 |Day (UTC)            |day        |u|1-31; 0 = N/A (default)
|114-118 |  5 |Hour (UTC)           |hour       |u|0-23; 24 = N/A (default)
|119-124 |  6 |Minute (UTC)         |minute     |u|0-59; 60 = N/A (default)
|125-142 | 18 |Duration             |duration   |In minutes,
                                                 262143 = N/A (default),
                                                 0 = cancel this notice.
|143     |    |                     |subarea    |a10|Subarea array
|0-2     |  2 |                     |shape      |u|Subarea shape
|3-86    | 85 |Subarea Payload      |payload    |d|Subarea payload
|==============================================================================

The Message Linkage field is, as usual, for linking to a textual explanatory
message sent with the same linkage ID. The standard says that in this context
it has the semantics of being an identifier of or reference to an area.

Notice description types are as follows:

.Area Notice Description
[frame="topbot",options="header"]
|==============================================================================
|  0| Caution Area: Marine mammals habitat
|  1| Caution Area: Marine mammals in area - reduce speed
|  2| Caution Area: Marine mammals in area - stay clear
|  3| Caution Area: Marine mammals in area - report sightings
|  4| Caution Area: Protected habitat - reduce speed
|  5| Caution Area: Protected habitat - stay clear
|  6| Caution Area: Protected habitat - no fishing or anchoring
|  7| Caution Area: Derelicts (drifting objects)
|  8| Caution Area: Traffic congestion
|  9| Caution Area: Marine event
| 10| Caution Area: Divers down
| 11| Caution Area: Swim area
| 12| Caution Area: Dredge operations
| 13| Caution Area: Survey operations
| 14| Caution Area: Underwater operation
| 15| Caution Area: Seaplane operations
| 16| Caution Area: Fishery – nets in water
| 17| Caution Area: Cluster of fishing vessels
| 18| Caution Area: Fairway closed
| 19| Caution Area: Harbor closed
| 20| Caution Area: Risk (define in associated text field)
| 21| Caution Area: Underwater vehicle operation
| 22| (reserved for future use)
| 23| Environmental Caution Area: Storm front (line squall)
| 24| Environmental Caution Area: Hazardous sea ice
| 25| Environmental Caution Area: Storm warning (storm cell or line of storms)
| 26| Environmental Caution Area: High wind
| 27| Environmental Caution Area: High waves
| 28| Environmental Caution Area: Restricted visibility (fog, rain, etc.)
| 29| Environmental Caution Area: Strong currents
| 30| Environmental Caution Area: Heavy icing
| 31| (reserved for future use)
| 32| Restricted Area: Fishing prohibited
| 33| Restricted Area: No anchoring.
| 34| Restricted Area: Entry approval required prior to transit
| 35| Restricted Area: Entry prohibited
| 36| Restricted Area: Active military OPAREA
| 37| Restricted Area: Firing – danger area.
| 38| Restricted Area: Drifting Mines
| 39| (reserved for future use)
| 40| Anchorage Area: Anchorage open
| 41| Anchorage Area: Anchorage closed
| 42| Anchorage Area: Anchorage prohibited
| 43| Anchorage Area: Deep draft anchorage
| 44| Anchorage Area: Shallow draft anchorage
| 45| Anchorage Area: Vessel transfer operations
| 46| (reserved for future use)
| 47| (reserved for future use)
| 48| (reserved for future use)
| 49| (reserved for future use)
| 50| (reserved for future use)
| 51| (reserved for future use)
| 52| (reserved for future use)
| 53| (reserved for future use)
| 54| (reserved for future use)
| 55| (reserved for future use)
| 56| Security Alert - Level 1
| 57| Security Alert - Level 2
| 57| Security Alert - Level 3
| 59| (reserved for future use)
| 60| (reserved for future use)
| 61| (reserved for future use)
| 62| (reserved for future use)
| 63| (reserved for future use)
| 64| Distress Area: Vessel disabled and adrift
| 65| Distress Area: Vessel sinking
| 66| Distress Area: Vessel abandoning ship
| 67| Distress Area: Vessel requests medical assistance
| 68| Distress Area: Vessel flooding
| 69| Distress Area: Vessel fire/explosion
| 70| Distress Area: Vessel grounding
| 71| Distress Area: Vessel collision
| 72| Distress Area: Vessel listing/capsizing
| 73| Distress Area: Vessel under assault
| 74| Distress Area: Person overboard
| 75| Distress Area: SAR area
| 76| Distress Area: Pollution response area
| 77| (reserved for future use)
| 78| (reserved for future use)
| 79| (reserved for future use)
| 80| Instruction: Contact VTS at this point/juncture
| 81| Instruction: Contact Port Administration at this point/juncture
| 82| Instruction: Do not proceed beyond this point/juncture
| 83| Instruction: Await instructions prior to proceeding beyond this point/juncture
| 84| Proceed to this location – await instructions
| 85| Clearance granted – proceed to berth
| 86| (reserved for future use)
| 87| (reserved for future use)
| 88| Information: Pilot boarding position
| 89| Information: Icebreaker waiting area
| 90| Information: Places of refuge
| 91| Information: Position of icebreakers
| 92| Information: Location of response units
| 93| VTS active target
| 94| Rogue or suspicious vessel
| 95| Vessel requesting non-distress assistance
| 96| Chart Feature: Sunken vessel
| 97| Chart Feature: Submerged object
| 98| Chart Feature: Semi-submerged object
| 99| Chart Feature: Shoal area
|100| Chart Feature: Shoal area due north
|101| Chart Feature: Shoal area due east
|102| Chart Feature: Shoal area due south
|103| Chart Feature: Shoal area due west
|104| Chart Feature: Channel obstruction
|105| Chart Feature: Reduced vertical clearance
|106| Chart Feature: Bridge closed
|107| Chart Feature: Bridge partially open
|108| Chart Feature: Bridge fully open
|109| (reserved for future use)
|110| (reserved for future use)
|111| (reserved for future use)
|112| Report from ship: Icing info
|113| (reserved for future use)
|114| Report from ship: Miscellaneous information – define in associated text field
|115| (reserved for future use)
|116| (reserved for future use)
|117| (reserved for future use)
|118| (reserved for future use)
|119| (reserved for future use)
|120| Route: Recommended route
|121| Route: Alternative route
|122| Route: Recommended route through ice
|123| (reserved for future use)
|124| (reserved for future use)
|125| Other – Define in associated text field
|126| Cancellation – cancel area as identified by Message Linkage ID
|127| Undefined (default)
|==============================================================================

Subarea types are as follows:

[frame="topbot",options="header"]
|==============================================================================
|  0  | Circle or point
|  1  | Rectangle
|  2  | Sector
|  3  | Polyline
|  4  | Polygon
|  5  | Associated text
| 6-7 | Reserved
|==============================================================================

Subarea payload layouts are as follows:

.Circle or Point
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member/Type |T|Units
|0-2     | 3  |Shape of area      |shape       |e|Constant: 0
|3-4     | 2  |Scale factor       |scale       |u|Exponent for area dimensions
                                                  1 = meters (default)
|5-29    | 25 |Longitude          |lon         |I3|Longitude of center point,
                                                   Unit = minutes * 0.001,
                                                   181000 = N/A (default).
|30-53   | 24 |Latitude           |lat         |I3|Latitude of center point,
                                                   Unit = minutes * 0.001,
                                                   91000 = N/A (default).
|54-56   |  3 |Precision          |precision   |u|Decimal places of precision
                                                  (defaults to 4)
|57-68   | 12 |Radius             |radius      |u|Radius of area
                                                  0 = point (default),
                                                  else 1-4095 * 10^scale m
|69-86   | 18 |Spare              |            |x|Not used
|==============================================================================

.Rectangle
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member/Type |T|Units
|0-2     | 3  |Shape of area      |shape       |e|Constant: 1
|3-4     | 2  |Scale factor       |scale       |u|Exponent for area dimensions
                                                  1 = meters (default)
|5-29    | 25 |Longitude          |lon         |I3|Longitude of SW corner
                                                   Unit = minutes * 0.001,
                                                   181000 = N/A (default).
|30-53   | 24 |Latitude           |lat         |I3|Latitude of SW corner
                                                   Unit = minutes * 0.001,
                                                   91000 = N/A (default).
|54-56   |  3 |Precision          |precision   |u|Decimal places of precision
                                                  (defaults to 4)
|57-64   |  8 |E dimension        |east        |u|Box dimension east
                                                  0 = N/S line (default),
                                                  else 1-255 * 10^scale m
|65-72   |  8 |N dimension        |north       |u|Box dimension north
                                                  0 = E/W line (default),
                                                  else 1-255 * 10^scale m
|73-81   |  9 |Orientation        |orientation |u|Degrees clockwise from true N,
                                                  0 = no rotation (default),
                                                  else 1-359,
                                                  360-511 reserved.
|82-86   |  5 |Spare              |            |x|Not used
|==============================================================================

.Sector
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member/Type |T|Units
|0-2     | 3  |Shape of area      |shape       |e|Constant: 2
|3-4     | 2  |Scale factor       |scale       |u|Exponent for area dimensions
                                                  1 = meters (default)
|5-29    | 25 |Longitude          |lon         |I3|Longitude of center point,
                                                   Unit = minutes * 0.001,
                                                   181000 = N/A (default).
|30-53   | 24 |Latitude           |lat         |I3|Latitude of center point,
                                                   Unit = minutes * 0.001,
                                                   91000 = N/A (default).
|54-56   |  3 |Precision          |precision   |u|Decimal places of precision
                                                  (defaults to 4)
|57-68   | 12 |Radius             |radius      |u|Radius of area
                                                  0 = point (default),
                                                  else 1-4095 * 10^scale m
|69-77   |  9 |Left boundary      |left       |u|Degrees clockwise from true N,
                                                  0 = no rotation (default),
                                                  else 1-359,
                                                  360-511 reserved.
|78-86   |  9 |Right boundary     |right      |u|Degrees clockwise from true N,
                                                  0 = no rotation (default),
                                                  else 1-359,
                                                  360-511 reserved.
|==============================================================================

.Polyline
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member/Type |T|Units
|0-2     | 3  |Shape of area      |shape       |e|Constant: 3
|3-4     | 2  |Scale factor       |scale       |u|Exponent for area dimensions
                                                  1 = meters (default)
|5       |    |                   |waypoints   |a4|Waypoints array
|0-9     |10  |Bearing            |bearing     |u|True bearing in half-degree
                                                  steps from previous waypoint;
                                                  720 = N/A (default).
|10-19   |10  |Distance           |distance    |u|Distance from prev. waypoint,
                                                  0 = no point (default),
                                                  else 1-1023 * 10^scale m
|==============================================================================

The last two fields are repeated 4 times; the final 2 bits of 87 are
unused.  A polyline must be preceded by either (a) a circle, in which
case the first bearing is from the center, or (b) a polyline, in which
case the first bearing is from the implied last point.

.Polygon
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member/Type |T|Units
|0-2     | 3  |Shape of area      |shape       |e|Constant: 4
|3-4     | 2  |Scale factor       |scale       |u|Exponent for area dimensions
                                                  1 = meters (default)
|5       |    |                   |vertices    |a4|Vertices array
|0-9     |10  |Bearing            |bearing     |u|True bearing in half-degree
                                                  steps from previous vertex;
                                                  720 = N/A (default).
|10-19   |10  |Distance           |distance    |u|Distance from prev. vertex,
|==============================================================================

The last two fields are repeated 4 times; the final 2 bits of 87 are
unused.  A polygon must be preceded by a circle; the first bearing is
from the circle center, which is treated as the zero vertex.  There is
an implied boundary from the last polygon vertex to the zero vertex.

.Associated text
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member/Type |T|Units
|0-2     | 3  |Shape of area      |shape       |e|Constant: 5
|3-86    |84  |Text               |text        |t|14 chars of packed 6-bit.
|==============================================================================

==== IMO289 Dangerous Cargo Indication ====

See the IMO236 variant for the meaning of this message.

A message 6 subtype. DAC = 001 FID = 25. Variable length: 117-576 bits.
This is the <<IMO289>> version; there is an earlier <<IMO236>> version
with a different layout, deprecated in <<IMO289>>.

//: Type 6(1/25)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member    |T|Units
|0-5     |  6 |Message Type         |type      |u|Constant: 6
|6-7     |  2 |Repeat Indicator     |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi      |u|9 decimal digits
|38-39   |  2 |Sequence Number      |seqno     |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI     |dest_mmsi |u|9 decimal digits
|70-70   |  1 |Retransmit flag      |retransmit|b|0 = no retransmit (default)
                                                  1 = retransmitted
|71-71   |  1 |Spare                |          |x|Not used
|72-81   | 10 |DAC                  |dac       |u|DAC = 001
|82-87   |  6 |FID                  |fid       |u|FID = 25
|88-89   |  2 |Unit of Quantity     |unit      |e|See "Cargo Unit Codes"
|90-99   | 10 |Amount of Cargo      |amount    |u|Unsigned integer
                                                  0 = N/A (default)
                                                  0 = N/A (default)
|100     |    |                     |cargos    |a28|Cargo types array
|0-3     |  4 |Cargo code           |code      |e|See "Cargo Codes"
|4-16    | 13 |Cargo subtype        |subtype   |u|Unsigned integer
                                                  0 = N/A (default)
|==============================================================================

The last two fields may repeat to describe up to 28 subcargos. The count
of repetitions must be computed from the message payload length.

For cargo unit codes, see the description of the IMO236 variant of
this message.

.Cargo Codes
[width="50%",frame="topbot",options="header"]
|===================================
|Code |Code under which cargo is carried
|0    |Not available (default)
|1    |IMDG Code (in packed form)
|2    |IGC code
|3    |BC Code (from 1.1.2011 IMSBC)
|4    |MARPOL Annex I List of oils (Appendix 1)
|5    |MARPOL Annex II IBC Code
|6    |Regional use
|7-15 |Reserved for future use
|===================================

The subtype field may be interpreted as an IMDG class or division code
(if the cargotype is 1 = IMDG code) or as a UN number (if the
cargotype is 2 = IGC code) or as a pair of BC class and IMDG class (if
the cargotype is 3 = BC code) or as a MARPOL Annex I code (if
the cargotype is 4 = MARPOL Annex I) or as a MARPOL Annex II code (if
the cargotype is 5 = MARPOL Annex II).

.Dangerous Cargo Indication: MARPOL Annex I list of oils
[width="50%",frame="topbot",options="header"]
|===================================
|0    | N/A (default)
|1    | asphalt solutions
|2    | oils
|3    | distillates
|4    | gas oil
|5    | gasoline blending stocks
|6    | gasoline
|7    | jet fuels
|8    | naphtha
|9-15 | reserved for future use
|===================================

.Dangerous Cargo Indication: MARPOL Annex II list of oils
[width="50%",frame="topbot",options="header"]
|===================================
|0    | N/A (default)
|1    | Category X
|2    | Category Y
|3    | Category Z
|4    | Other substances
|5-7  | reserved for future use
|===================================

==== IMO289 Route Information (addressed) ====

The content of this message is a time and a list of waypoints describing a
course. It has a broadcast equivalent that is a message 8 subtype.

A message 6 subtype. DAC = 001 FID = 28. Variable length: 204-1029 bits.

//: Type 6(1/28)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description       |Member    |T|Units
|0-5     |  6 |Message Type      |type      |u|Constant: 6
|6-7     |  2 |Repeat Indicator  |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI       |mmsi      |u|9 decimal digits
|38-39   |  2 |Sequence Number   |seqno     |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI  |dest_mmsi |u|9 decimal digits
|70-70   |  1 |Retransmit flag   |retransmit|b|0 = no retransmission (default),
                                               1 = retransmitted.
|71-71   |  1 |Spare             |          |x|Not used
|72-81   | 10 |DAC               |dac       |u|DAC = 001
|82-87   |  6 |FID               |fid       |u|FID = 28
|88-97   | 10 |Message Linkage ID|linkage   |u|Unsigned integer
|98-100  |  3 |Sender Class      |sender    |u|0 = ship (default),
                                               1 = authority,
                                               27 = reserved for future use
|101-105 |  5 |Route Type        |rtype     |e|See "Route Type Codes"
|106-109 |  4 |Start month (UTC) |month     |u|1-12, 0=N/A (default)
|110-114 |  5 |Start day (UTC)   |day       |u|1-31, 0=N/A (default)
|115-119 |  5 |Start hour (UTC)  |hour      |u|0-23, 24=N/A (default)
|120-125 |  6 |Start minute (UTC)|minute    |u|0-59, 60=N/A (default)
|126-143 | 18 |Duration          |duration  |u|Minutes from start time,
                                               0 = cancel route,
                                               262,143 = N/A (default),
|144-148 |  5 |                  |waycount  |u|Waypoint count (1-16),
                                               Values 17-31 are not used.
|149     |    |                  |waypoints |a^16|Waypoint array
|0-27    | 28 |Longitude         |lon       |I4|Minutes * 0.0001,
                                               181000 = N/A (default),
                                               E positive, W negative.
|28-54   | 27 |Latitude          |lat       |I4|Minutes * 0.0001,
                                               91000 = N/A (default),
                                               N positive, S negative.
|==============================================================================

The final pair of fields in the table above is a waypoint.  The message may
end with 1 to 16 waypoints.

.Route Type Codes
[width="50%",frame="topbot",options="header"]
|===================================
|0    |Undefined (default)
|1    |Mandatory
|2    |Recommended
|3    |Alternative
|4    |Recommended route through ice
|5    |Ship route plan
|6-30 |Reserved for future usage
|31   |Cancel route identified by message linkage
|===================================

==== IMO289 Text description (addressed) ====

This message may be used to attach a text description to another message with
a Message Linkage ID matching this one.  It is intended that the combination
of MMSI and Message Linkage ID should be unique.

A message 6 subtype. DAC = 001 FID = 30. Variable length: 104-1028 bits.

Intended to be used to associate a text annotation with another message
via the Message Linkage ID field.

//: Type 6(1/30)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len    |Description       |Member     |T|Units
|0-5     |  6    |Message Type      |type       |u|Constant: 6
|6-7     |  2    |Repeat Indicator  |repeat     |u|As in Common Navigation Block
|8-37    | 30    |Source MMSI       |mmsi       |u|9 decimal digits
|38-39   |  2    |Sequence Number   |seqno      |u|Unsigned integer 0-3
|40-69   | 30    |Destination MMSI  |dest_mmsi  |u|9 decimal digits
|70-70   |  1    |Retransmit flag   |retransmit |u|0 = no retransmit (default),
                                                   1 = retransmitted
|71-71   |  1    |Spare             |           |x|Not used
|72-81   | 10    |DAC               |dac        |u|DAC = 001
|82-87   |  6    |FID               |fid        |u|FID = 30
|88-97   | 10    |Message Linkage ID|linkage    |u|Unsigned integer
|98-?    | 6-930 |Description       |description|t|String
|==============================================================================

There is an equivalent subtype of message 8 that is a broadcast description.

==== Tidal Window (IMO289) ====

See the <<IMO239>> version of this message for intended meaning.

A message 6 subtype. DAC = 001 FID = 32. Variable length: 186-362 bits.
This is the <<IMO289>> version; there is an <<IMO289>> version with
different bit widths for the latitude and longitude fields.

//: Type 6(1/32)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description            |Member    |T|Units
|0-5     |  6 |Message Type           |type      |u|Constant: 6
|6-7     |  2 |Repeat Indicator       |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI            |mmsi      |u|9 decimal digits
|38-39   |  2 |Sequence Number        |seqno     |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI       |dest_mmsi |u|9 decimal digits
|70-70   |  1 |Retransmit flag        |retransmit|b|0 = no retransmit (default),
                                                    1 = retransmitted
|71-71   |  1 |Spare                  |          |x|Not used
|72-81   | 10 |DAC                    |dac       |u|DAC = 001
|82-87   |  6 |FID                    |fid       |u|FID = 32
|88-91   |  4 |Month                  |month     |u|1-12; 0 = N/A (default)
|92-96   |  5 |Day                    |day       |u|1-31; 0 = N/A (default)
|97      |    |                       |tidals    |a3|Tidal information array
|0-24    | 25 |Longitude              |lon       |I3|Unit = minutes * 0.001,
                                                    181000 = N/A (default),
                                                    E positive, W negative.
|25-48   | 24 |Latitude               |lat       |I3|Unit = minutes * 0.001.
                                                    91000 = N/A (default),
                                                    N positive, S negative.
|49-53   |  5 |From UTC Hour          |from_hour |u|0-23, 24 = N/A (default)
|54-59   |  6 |From UTC Minute        |from_min  |u|0-59, 60 = N/A (default)
|60-64   |  5 |To UTC Hour            |to_hour   |u|0-23, 24 = N/A (default)
|65-70   |  6 |To UTC Minute          |to_min    |u|0-59, 60 = N/A (default)
|71-79   |  9 |Current Dir. Predicted |cdir      |u|0-359 true bearing,
                                                    360 = N/A (default).
|80-87   |  8 |Current Speed Predicted|cspeed    |U1|0-250, units of 0.1 knots,
                                                    251 = speed >= 25.1 knots,
                                                    255 = N/A (default).
|=============================================================================

The group of fields from longitude on may repeat twice more to convey up to
three points of tidal information.

==== ETA at lock/bridge/terminal (Inland AIS) ====

A message 6 subtype. DAC = 200 FID = 21. Fixed length, 248 bits.

Should be used by inland vessels only, to send an ETA report to a
lock, bridge or terminal in order to apply for a time slot in resource
planning.

An acknowledgement by Inland AIS message 22 should be received within
15 minutes. Otherwise, the Inland AIS message 21 should be repeated
once.

//: Type 6(200/21)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member    |T|Units
|0-5     |  6 |Message Type       |type      |u|Constant: 6
|6-7     |  2 |Repeat Indicator   |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI        |mmsi      |u|9 decimal digits
|38-39   |  2 |Sequence Number    |seqno     |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI   |dest_mmsi |u|9 decimal digits
|70      |  1 |Retransmit flag    |retransmit|u|0 = no retransmit (default),
                                                1 = retransmitted
|71      |  1 |Spare              |          |x|Not used
|72-81   | 10 |DAC                |dac       |u|DAC = 200
|82-87   |  6 |FID                |fid       |u|FID = 21
|88-99   | 12 |UN Country Code    |country   |t|2 six-bit characters
|100-117 | 18 |UN/LOCODE          |locode    |t|3 six-bit characters
|118-147 | 30 |Fairway section    |section   |t|5 six-bit characters
|148-177 | 30 |Terminal code      |terminal  |t|5 six-bit characters
|178-207 | 30 |Fairway hectometre |hectometre|t|5 six-bit characters
|208-211 |  4 |ETA month          |month     |u|1-12, 0=N/A (default)
|212-216 |  5 |ETA day            |day       |u|1-31, 0=N/A (default)
|217-221 |  5 |ETA hour           |hour      |u|0-23, 24=N/A (default)
|222-227 |  6 |ETA minute         |minute    |u|0-59, 60=N/A (default)
|228-230 |  3 |Assisting Tugs     |tugs      |u|0-6, 7 = unknown (default)
|231-242 | 12 |Air Draught        |airdraught|u|0-4000 * 0.01m,
                                                0 = Unknown (default)
|243-247 |  5 |Spare              |          |x|Not used
|==============================================================================

<<INLAND>> says of the Destination MMSI field "a virtual MMSI number
should be used for each country, each national AIS network should
route messages addressed to other countries using this virtual MMSI
number".

OPEN-QUESTION: <<INLAND>> does not specify whether ETA time is UTC
or local.

==== RTA at lock/bridge/terminal (Inland AIS) ====

A message 6 subtype. DAC = 200 FID = 22. Fixed length, 232 bits.

This message should be sent by base stations only, to assign a RTA at
a lock, bridge or terminal to a certain vessel in response to the
preceding ETA request.

[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member    |T|Units
|0-5     |  6 |Message Type       |type      |u|Constant: 6
|6-7     |  2 |Repeat Indicator   |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI        |mmsi      |u|9 decimal digits
|38-39   |  2 |Sequence Number    |seqno     |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI   |dest_mmsi |u|9 decimal digits
|70-70   |  1 |Retransmit flag    |retransmit|u|0 = no retransmit (default),
                                                1 = retransmitted
|71-71   |  1 |Spare              |          |x|Not used
|72-81   | 10 |DAC                |dac       |u|DAC = 200
|82-87   |  6 |FID                |fid       |u|FID = 21
|88-99   | 12 |UN Country Code    |country   |t|2 six-bit characters
|100-117 | 18 |UN/LOCODE          |locode    |t|3 six-bit characters
|118-147 | 30 |Fairway section    |section   |t|5 six-bit characters
|148-177 | 30 |Terminal code      |terminal  |t|5 six-bit characters
|178-207 | 30 |Fairway hectometre |hectometre|t|5 six-bit characters
|208-211 |  4 |RTA month          |month     |u|1-12, 0=N/A (default)
|212-216 |  5 |RTA day            |day       |u|1-31, 0=N/A (default)
|217-221 |  5 |RTA hour           |hour      |u|0-23, 24=N/A (default)
|222-227 |  6 |RTA minute         |minute    |u|0-59, 60=N/A (default)
|228-229 |  2 |Status             |status    |e|See "Status Codes" below
|230-231 |  2 |Spare              |          |x|Not used
|==============================================================================

OPEN-QUESTION: <<INLAND>> does not specify whether ETA time is UTC
or local.

OPEN-QUESTION: No default is specified for the Status field.

.Lock/Bridge/Terminal status codes
[frame="topbot",options="header"]
|==============================================================================
| 0 | Operational
| 1 | Limited operation
| 2 | Out of order
| 3 | N/A
|==============================================================================

==== Number of persons on board (Inland AIS) ====

This message should be sent by inland vessels only, to inform about
the number of persons (passengers, crew, and shipboard personnel) on
board.

A message 6 subtype. DAC = 200 FID = 55.  Fixed length, 168 bits.

//: Type 6(200/55)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member    |T|Units
|0-5     |  6 |Message Type         |type      |u|Constant: 6
|6-7     |  2 |Repeat Indicator     |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi      |u|9 decimal digits
|38-39   |  2 |Sequence Number      |seqno     |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI     |dest_mmsi |u|9 decimal digits
|70-70   |  1 |Retransmit flag      |retransmit|u|0 = no retransmit (default),
                                                  1 = retransmitted
|71-71   |  1 |Spare                |          |x|Not used
|72-81   | 10 |DAC                  |dac       |u|DAC = 200
|82-87   |  6 |FID                  |fid       |u|FID = 55
|88-95   |  8 |# crew on board      |crew      |u|Unsigned integer
                                                  0-254,
                                                  255 = Unknown (default)
|96-108  | 13 |# passengers on board|passengers|u|Unsigned integer
                                                  0-8190,
                                                  8191 = Unknown (default)
|109-116 |  8 |# personnel on board |personnel |u|Unsigned integer
                                                  0-254,
                                                  255 = Unknown (default)
|117-167 | 51 |Spare                |          |x|Not used
|==============================================================================

==== AtoN monitoring data (GLA) ====

This message provides AtoN (Aid to navigation) monitoring data for the General
Lighthouse Authorities (GLA), which consists of Trinity House (England &
Wales), Northern Lighthouse Board (Scotland) and the Commissioners of Irish
Lights (Ireland). It is described in <<IALA-A126>>.

A message 6 subtype. DAC = 235 or 250 FID = 10. Fixed length: 136 bits.

DAC and FI are user configurable, DAC=235/FI=10 is used in UK, DAC=250/FI=10
in the Republic Of Ireland.

The interval between the transmissions of these messages will be synchronized
with message 21, although not necessarily at the same reporting rate. If
Message 21 is not used at a particular site, then the reporting interval
should be selected to minimize the power requirement of the transponder,
whilst still providing enough data to enable meaningful diagnostic analysis.

OPEN-QUESTION: <<INLAND>> lists a broadcast (type 8) variant of this
message, but without indicating how the Destination MMSI field is to
be set or interpreted.  Robust implementations should accept and
process this variant.

//: Type 6(235-250:10)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description       |Member     |T|Units
|0-5     |  6 |Message Type      |type       |u|Constant: 6
|6-7     |  2 |Repeat Indicator  |repeat     |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI       |mmsi       |u|9 decimal digits
|38-39   |  2 |Sequence Number   |seqno      |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI  |dest_mmsi  |u|9 decimal digits
|70-70   |  1 |Retransmit flag   |retransmit |u|0 = no retransmit (default),
                                                1 = retransmitted
|71-71   |  1 |Spare             |           |x|Not used
|72-81   | 10 |DAC               |dac        |u|DAC = 235 or 250
|82-87   |  6 |FID               |fid        |u|FID = 10
|88-97   | 10 |Analogue          |ana_int    |u|0.05-36V, 0.05V step
                                                Supply voltage to AIS Unit
                                                0 = Not Used
|98-107  | 10 |Analogue (ext. #1)|ana_ext1   |u|0.05-36V, 0.05V step
                                                0 = Not Used
|108-117 | 10 |Analogue (ext. #2)|ana_ext2   |u|0.05-36V, 0.05V step
                                                0 = Not Used
|118-119 |  2 |RACON status      |racon      |u|00 = no RACON installed
                                                01 = RACON not monitored
                                                10 = RACON operational
						11 = RACON ERROR
|120-121 |  2 |Light status      |light      |u|00 = no light or no monitoring
                                                01 = Light ON
                                                10 = Light OFF
                                                11 = Light ERROR
|122     |  1 |Health            |health     |b|0 = Good Health, 1 = Alarm
|123-130 |  8 |Status (external) |stat_ext   |u|7  Digital Input 0=Off, 1=On
                                                :
                                                :
                                                0  Digital Input 0=Off, 1=On
|131-131 |  1 |Position status   |off_pos    |b|0=On position, 1=Off position
|132-135 |  4 |Spare             |           |x|Not used
|==============================================================================

=== Type 7: Binary Acknowledge ===

Message type 7 is a receipt acknowledgement to the senders of a
previous messages of type 6.  Total length varies between 72 and 168
bits by 32-bit increments, depending on the number of destination
MMSIs included.

//: Type 7
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description         |Member   |T|Units
|0-5     |  6 |Message Type        |type     |u|Constant: 7
|6-7     |  2 |Repeat Indicator    |repeat   |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI         |mmsi     |u|9 decimal digits
|38-39   |  2 |Spare               |         |x|Not used
|40-69   | 30 |MMSI number 1       |mmsi1    |u|9 decimal digits
|70-71   |  2 |Sequence for MMSI 1 |mmsiseq1 |u|Not used
|72-101  | 30 |MMSI number 2       |mmsi2    |u|9 decimal digits
|102-103 |  2 |Sequence for MMSI 2 |mmsiseq2 |u|Not used
|104-133 | 30 |MMSI number 3       |mmsi3    |u|9 decimal digits
|134-135 |  2 |Sequence for MMSI 3 |mmsiseq3 |u|Not used
|136-165 | 30 |MMSI number 4       |mmsi4    |u|9 decimal digits
|166-167 |  2 |Sequence for MMSI 4 |mmsiseq4 |u|Not used
|==============================================================================

Use of the MMSI sequence fields was introduced in ITU-1371-5 to
indicate the sequence number of the Type 6 to which this responds.
In earlier versions these were spare fields.

=== Type 8: Binary Broadcast Message ===

Message type 8 is a broadcast message with unspecified binary payload.
The St. Lawrence Seaway AIS system, the USG PAWSS system, and the Port
Authority of London use this payload for local extension
messages. <<IMO236>> and <<IMO289>> describe payload use as
international extension messages. This type is variable in length up
to a maximum of 1008 bits (up to 5 AIVDM sentence payloads).

//: Type 8
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member    |T|Units
|0-5     |  6 |Message Type         |type      |u|Constant: 8
|6-7     |  2 |Repeat Indicator     |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi      |u|9 decimal digits
|38-39   |  2 |Spare                |          |x|Not used
|40-49   | 10 |Designated Area Code |dac       |u|Unsigned integer
|50-55   |  6 |Functional ID        |fid       |u|Unsigned integer
|56      |952 |Data                 |data      |d|Binary data,
                                                  May be shorter than 952 bits.
|==============================================================================

Interpretation of the binary payload is controlled by DAC/FID as in
message type 6. The following is a non-exhaustive list of standardized
DAC-FID pairs in use for type 8:

[frame="topbot",options="header"]
|==============================================================================
| DAC     |FID | Sub | Source     | Status     | Description
|   1     | 11 |     | <<IMO236>> | Deprecated/In Use | Meteorological/Hydrological Data
|   1     | 13 |     | <<IMO236>> | Deprecated | Fairway closed
|   1     | 15 |     | <<IMO236>> | Deprecated | Extended ship and voyage
|   1     | 17 |     | <<IMO89>>  | In use     | VTS-Generated/Synthetic targets
|   1     | 19 |     | <<IMO289>> | Standard   | Marine traffic signals
|   1     | 21 |     | <<IMO289>> | Standard   | Weather observation from ship
|   1     | 22 |     | <<IMO289>> | In use     | Area notice (broadcast)
|   1     | 24 |     | <<IMO289>> | Standard   | Extended ship and voyage
|   1     | 26 |     | <<IMO289>> | Standard   | Environmental
|   1     | 27 |     | <<IMO289>> | Standard   | Route info broadcast
|   1     | 29 |     | <<IMO289>> | Standard   | Text description broadcast
|   1     | 31 |     | <<IMO289>> | In use     | Meteorological and Hydrological
|  200    | 10 |     | <<INLAND>> | Standard   | Ship static and voyage related data
|  200    | 23 |     | <<INLAND>> | Standard   | EMMA warning report
|  200    | 24 |     | <<INLAND>> | Standard   | Water levels
|  200    | 40 |     | <<INLAND>> | Standard   | Signal status
| 316/366 |  1 |   2 | <<SEAWAY>> | In use     | Wind
| 316/366 |  1 |   1 | <<SEAWAY>> | In use     | Weather station
| 316/366 |  1 |   3 | <<SEAWAY>> | In use     | Water level
| 316/366 |  1 |   6 | <<SEAWAY>> | In use     | Water flow
| 316/366 |  2 |   1 | <<SEAWAY>> | In use     | Lockage Order
| 316/366 |  2 |   2 | <<SEAWAY>> | In use     | Estimated Lock Times
| 316/366 | 32 |   1 | <<SEAWAY>> | In use     | Seaway Version Message
| 366     |  1 |   4 | <<SEAWAY>> | In use     | PAWS Hydro / Current
| 366     |  1 |   6 | <<SEAWAY>> | In use     | PAWS Hydro / Salinity Temp
| 366     |  1 |   3 | <<SEAWAY>> | In use     | PAWS Vessel Procession Order
|==============================================================================

DAC/FID pairs are assigned separately per message type.  For St. Lawrence
Seaway messages, the DAC may be 316 (Canada) or 366 (U.S.) depending
on the transmitter location.

Note that the apparent presence of one of these DAC/FID pairs does
not guarantee that the message is structured.  Decoders should
perform range validation on the structured fields and interpret the
message as unstructured if any check fails. Actual false matches with
DAC/FID = 200/10 have been observed in the wild.

DAC/FID pairs 1/23, 1/28, and 1/30 have addressed versions described
under type 6.

FID types 11-15 are being phased out and are not to be used after 1
Jan 2013. The deprecated IMO236 1/11 has a different binary layout from
the IMO289 1/31.  FID type 17 is in use; there is a proposed
update for it in <<IMO289>>.

Breakdowns of Message 8 subtypes from <<IMO289>> follow.

==== Meteorological and Hydrological Data (IMO236) ====

A message 8 subtype. DAC = 001 FID = 11. Fixed length, 352 bits.
This is in use and described in <<IMO236>>, but has been deprecated by
<<289>> in favor of a message with the same title but FID = 31 and a
different binary layout. <<IMO236>> specifies a maximum interval between
broadcast of this message of 12 minutes.

//: Type 8(1/11)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member      |u|Units
|0-5     |  6 |Message Type       |type        |u|Constant: 8
|6-7     |  2 |Repeat Indicator   |repeat      |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI        |mmsi        |u|9 decimal digits
|38-39   |  2 |Spare              |            |x|Not used
|40-49   | 10 |DAC                |dac         |u|DAC = 001
|50-55   |  6 |FID                |fid         |u|FID = 11
|56-79   | 24 |Latitude           |lat         |I3|Unit = minutes * 0.001,
                                                  0x7FFFFF = N/A (default),
                                                  E positive, W negative.
|80-104  | 25 |Longitude          |lon         |I3|Unit = minutes * 0.001,
                                                  0xFFFFFF = N/A (default),
                                                  N positive, S negative.
|105-109 |  5 |Day (UTC)          |day         |u|1-31, 31=N/A (default)
|110-114 |  5 |Hour (UTC)         |hour        |u|0-23, 31=N/A (default)
|115-120 |  6 |Minute (UTC)       |minute      |u|0-59, 63=N/A (default)
|121-127 |  7 |Average Wind Speed |wspeed      |u|10-min avg wind speed, knots,
                                                  127 = N/A (default).
|128-134 |  7 |Gust Speed         |wgust       |u|10-min max wind speed, knots,
                                                  127 = N/A (default).
|135-143 |  9 |Wind Direction     |wdir        |u|0-359, degrees from true north
                                                   511 = N/A (default)
|144-152 |  9 |Wind Gust Direction|wgustdir    |u|0-359, degrees fom true north
                                                   511 = N/A (default)
|153-163 | 11 |Air Temperature    |temperature |u|Dry bulb temp: 0.1 deg C
                                                  -60.0 to +60.0,
                                                  2047 = N/A (default),
|164-170 |  7 |Relative Humidity  |humidity    |u|0-100%, units of 1%,
                                                  127 = N/A (default).
|171-180 | 10 |Dew Point          |dewpoint    |u|-20.0 to +50.0: 0.1 deg C,
                                                  1023 = N/A (default),
|181-189 |  9 |Air Pressure       |pressure    |u|800-1200hPa: units 1hPa,
                                                  511 = N/A (default).
|190-191 |  2 |Pressure Tendency  |pressuretend|e|0 = steady,
                                                  1 = decreasing,
                                                  2 = increasing,
                                                  3 - N/A (default).
|192-199 |  8 |Horiz. Visibility  |visibility  |U1|0-25.0, units of 0.1nm
                                                  255 = N/A (default)
|200-208 |  9 |Water Level        |waterlevel  |I1|-10.0 to +30.0 in 0.1m,
                                                  511 = N/A (default).
|209-210 |  2 |Water Level Trend  |leveltrend  |e|0 = steady,
                                                  1 = decreasing,
                                                  2 = increasing,
                                                  3 - N/A (default).
|211-218 |  8 |Surface Current Speed     |cspeed  |U1|0.0-25.0 knots: units 0.1 knot
|219-227 |  9 |Surface Current Direction |cdir    |u|0-359: deg from true north,
                                                     511 = N/A (default)
|228-235 |  8 |Current Speed #2     |cspeed2   |U1|0.0-25.0 in units of 0.1 knot,
                                                  255 = N/A (default).
|236-244 |  9 |Current Direction #2 |cdir2     |u|0-359: deg. fom true north,
                                                  511 = N/A (default)
|245-249 |  5 |Measurement Depth #2 |cdepth2   |U1|0-30m down: units 0.1m,
                                                   31 = N/A (default).
|250-257 |  8 |Current Speed #3     |cspeed3   |U1|0.0-25.0: units of 0.1 knot,
                                                   255 = N/A (default).
|258-266 |  9 |Current Direction #3 |cdir3     |u|0-359: degrees fom true north,
                                                  511 = N/A (default).
|267-271 |  5 |Measurement Depth #3 |cdepth3   |U1|0-30m down: units 0.1m,
                                                  31 = N/A (default).
|272-279 |  8 |Wave height          |waveheight|U1|0-25m: units of 0.1m,
                                                  255 = N/A (default).
|280-285 |  6 |Wave period          |waveperiod|u|Seconds 0-60:
                                                  63 = N/A (default).
|286-294 |  9 |Wave direction       |wavedir   |u|0-359: deg. fom true north,
                                                  511 = N/A (default).
|295-302 |  8 |Swell height         |swellheight|U1|0-25m: units of 0.1m
                                                   255 = N/A (default).
|303-308 |  6 |Swell period         |swellperiod|u|Seconds 0-60:
                                                   63 = N/A (default).
|309-317 |  9 |Swell direction      |swelldir   |u|0-359: deg. fom true north,
                                                   511 = N/A (default).
|318-321 |  4 |Sea state            |seastate   |e|See "Beaufort Scale"
|322-331 | 10 |Water Temperature    |watertemp  |U1|-10.0 to 50.0: units 0.1 C,
                                                   1023 = N/A (default).
|332-334 |  3 |Precipitation        |preciptype |e|See "Precipitation Types"
|335-343 |  9 |Salinity             |salinity   |U1|0.0-50.0%: units 0.1%,
                                                   511 = N/A (default)
|344-345 |  2 |Ice                  |ice        |e| 0 = No
                                                    1 = Yes
                                                    2 = (reserved for future use)
                                                    3 = not available = default
|346-351 |  6 |Spare                |           |x|Not used
|==============================================================================

<<IMO236>> says "If there is no data available, default value to be
transmitted is the highest available binary value for that particular
data field.", the above table reflects that.  The day, hour and minute
have to be considered not available when all three are set to their
individual "N/A" value.  For the latitude and the longitude, the
highest positive value is used, as the highest available binary value
for a signed integer is -1, which would forbid the -0.001/-0.001
position.  The replacement FID=31 message has different default values
that remove any ambiguities.

<<IMO236>> gives the length of this message as 352, but lists only 336
payload bits.

Water level is deviation from local chart datum and includes tide.

The waveheight field is labeled as "Significant" in <<IMO236>>,
for whatever that means.

The seastate field has a note in <<IMO236>> reading "(manual input?)"?

WMO 306 Code table 4.201 specifies the following precipitation type values:

.Precipitation Types
[width="50%",frame="topbot",options="header"]
|===================================
|Code |Precipitation Type
|0    |Reserved
|1    |Rain
|2    |Thunderstorm
|3    |Freezing rain
|4    |Mixed/ice
|5    |Snow
|6    |Reserved
|7    |N/A (default)
|===================================

.Beaufort Scale
[width="50%",frame="topbot",options="header"]
|===========================================================================
|Scale|Description    | Sea Conditions
|0    |Calm           |Flat.
|1    |Light air      |Ripples without crests.
|2    |Light breeze   |Small wavelets.
|                      Crests of glassy appearance, not breaking.
|3    |Gentle breeze  |Large wavelets.
|                      Crests begin to break; scattered whitecaps.
|4    |Moderate breeze|Small waves.
|5    |Fresh breeze   |Moderate (1.2 m) longer waves. Some foam and spray.
|6    |Strong breeze  |Large waves with foam crests and some spray.
|7    |High wind      |Sea heaps up and foam begins to streak.
|8    |Gale           |Moderately high waves with breaking crests
|                      forming spindrift. Streaks of foam.
|9    |Strong gale    |High waves (6-7 m) with dense foam.
|                      Wave crests start to roll over. Considerable spray.
|10   |Storm          |Very high waves. The sea surface is white and there
|                      is considerable tumbling. Visibility is reduced.
|11   |Violent storm  |Exceptionally high waves.
|12   |Hurricane force|Huge waves. Air filled with foam and spray. Sea
|                      completely white with driving spray. Visibility
|                      greatly reduced.
|13   |               |N/A (default)
|14-15|               |Reserved
|===========================================================================

==== Fairway Closed ====

This message should be broadcast from shore stations to inform ships,
in particular to give guidance to large vessels about temporary closed
fairways or sections in ports.

A message 8 subtype. DAC = 001 FID = 13. Fixed length, 472 bits.
Described in <<IMO236>> but deprecated by <<IMO289>>.

//: Type 8(1/13)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description             |Member   |T|Units
|0-5     |  6 |Message Type            |type     |u|Constant: 8
|6-7     |  2 |Repeat Indicator        |repeat   |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI             |mmsi     |u|9 decimal digits
|38-39   |  2 |Spare                   |         |x|Not used
|40-49   | 10 |DAC                     |dac      |u|DAC = 001
|50-55   |  6 |FID                     |fid      |u|FID = 13
|56-175  |120 |Reason For Closing      |reason   |t|20 6-bit characters
|176-295 |120 |Location Of Closing From|closefrom|t|20 6-bit characters
|296-415 |120 |Location of Closing To  |closeto  |t|20 6-bit characters
|416-425 | 10 |Radius extension        |radius   |u|0-1000, 10001 = N/A (default)
|426-427 |  2 |Unit of extension       |extunit  |u|0=m, 1=km, 2=nm, 3=cables
|428-432 |  5 |From day (UTC)          |fday     |u|1-31, 0=N/A (default)
|433-436 |  4 |From month (UTC)        |fmonth   |u|1-12, 0=N/A (default)
|437-441 |  5 |From hour (UTC)         |fhour    |u|0-23, 24=N/A (default)
|442-447 |  6 |From minute (UTC)       |fminute  |u|0-59, 60=N/A (default)
|448-452 |  5 |To day (UTC)            |tday     |u|1-31, 0=N/A (default)
|453-456 |  4 |To month (UTC)          |tmonth   |u|1-12, 0=N/A (default)
|457-461 |  5 |To hour (UTC)           |thour    |u|0-23, 24=N/A (default)
|462-467 |  6 |To minute (UTC)         |tminute  |u|0-59, 60=N/A (default)
|468-471 |  4 |Spare                   |         |x|Not used
|==============================================================================

No default is specified for the radius field in the standard.

==== IMO236 Extended Ship Static and Voyage Related Data ====

This message should be used by a ship to report the height over keel.

A message 8 subtype. DAC = 001 FID = 15 in <<IMO236>>.  Fixed length, 72 bits.
Deprecated in <<IMO289>>.

//: Type 8(1/15)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member    |T|Units
|0-5     |  6 |Message Type         |type      |u|Constant: 8
|6-7     |  2 |Repeat Indicator     |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi      |u|9 decimal digits
|38-39   |  2 |Spare                |          |x|Not used
|40-49   | 10 |DAC                  |dac       |u|DAC = 001
|50-55   |  6 |FID                  |fid       |u|FID = 15
|55-66   | 11 |Air Draught          |airdraught|u|Height in meters,
                                                  0 = N/A (default),
                                                  2047 = >= 2047 m,
|67-71   |  5 |Spare                |          |x|Not used
|==============================================================================

==== VTS-Generated/Synthetic targets ====

A message 8 subtype. DAC = 001 FID = 17. Variable length: 176-536
bits.  This message is laid out identically in <<IMO236>> and
<<IMO289>>.  In <<IMO236>> it is titled "Pseudo-AIS Targets".

//: Type 8(1/17)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member     |T|Units
|0-5     |  6 |Message Type       |type       |u|Constant: 8
|6-7     |  2 |Repeat Indicator   |repeat     |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI        |mmsi       |u|9 decimal digits
|38-39   |  2 |Spare              |           |x|Not used
|40-49   | 10 |DAC                |dac        |u|DAC = 001
|50-55   |  6 |FID                |fid        |u|FID = 17
|56      |    |                   |targets    |a4|Synthetic targets array
|0-1     |  2 |Identifier type    |idtype     |e|0 = id is the MMSI number,
                                                 1 = id is the IMO number,
                                                 2 = id is the call sign,
                                                 3 = Other (default).
|2-43    | 42 |Target identifier  |id         |u|Target ID data.
|44-47   |  4 |Spare              |           |x|Not used
|48-71   | 24 |Latitude           |lat        |I3|Minutes * 0.001,
                                                 91000 = N/A (default),
                                                 N positive, S negative.
|72-96   | 25 |Longitude          |lon        |I3|Minutes * 0.001,
                                                 181000 = N/A (default),
                                                 E positive, W negative.
|97-105  |  9 |Course Over Ground |course     |u|0-359 deg from true north,
                                                 360 = N/A (default).
|106-111 |  6 |Time Stamp         |second     |u|Second of UTC timestamp.
|112-121 | 10 |Speed Over Ground  |speed      |u|0-254 in knots, 255 = N/A.
|==============================================================================

The interpretation of the target identifier field depends on the
preceding type key.  For 0 and 1 it is a big-endian unsigned binary
integer (as shown above).  For type 2 and 3 it is 6-bit ASCII text. An
unknown target is expressed by type 3 and the string "@@@@@@@".

OPEN-QUESTION: <<IMO289>> says: "When MMSI or IMO number is used, the
least significant bit should equal bit zero of the Target Identifier."
It is unclear how "bit zero" is to be interpreted, but it is not
possible to reconcile interpreting it as the leading bit of the field
with AIS big-endian encoding. Settling this awaits live testing.

The trailing eight fields may be repeated up to 3 times (for a total of 1 to 4
field groups) to represent up to 4 targets.

==== IMO289 Marine Traffic Signal ====

This message provides information on a signal station and status of
the control signal at the entrance of a harbour or channel where the
shipping direction controlled so that the traffic flow be kept in
order.

A message 8 subtype described in <<IMO289>>. DAC = 001 FID = 19. Fixed
length: 360 bits.

//: Type 8(1/19)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len  |Description           |Member  |u|Units
|0-5     |   6 |Message Type          |type    |u|Constant: 8
|6-7     |   2 |Repeat Indicator      |repeat  |u|As in Common Navigation Block
|8-37    |  30 |Source MMSI           |mmsi    |u|9 decimal digits
|38-39   |   2 |Spare                 |        |x|Not used
|40-49   | 10  |DAC                   |dac     |u|DAC = 001
|50-55   |  6  |FID                   |fid     |u|FID = 19
|56-65   |  10 |Message Linkage ID    |linkage |u|Unsigned integer
|66-185  | 120 |Name of Signal Station|station |t|20 6-bit chars
|186-210 |  25 |Longitude             |lon     |I3|Unit = minutes * 0.001
                                                  181000 = N/A (default)
                                                  E positive, W negative.
|211-234 |  24 |Latitude              |lat     |I3|Unit = minutes * 0.001
                                                  91000 = N/A (default)
                                                  N positive, S negative.
|235-236 |   2 |Status of Signal      |status  |u|0=N/A (default
                                                  1 = In regular service
                                                  2 = Irregular service
                                                  3 = Reserved for future use
|237-241 |   5 |Signal In Service     |signal  |e|See "Marine Traffic Signals"
|242-246 |   5 |UTC hour              |hour    |u|0-23, 24=N/A (default)
|247-252 |   6 |UTC minute            |minute  |u|0-59, 60=N/A (default)
|253-257 |   5 |Expected Next Signal  |nextsignal|e|See "Marine Traffic Signals"
|258-359 | 102 |Spare                 |        |x|Not used
|==============================================================================

.Marine Traffic Signals
[width="50%",frame="topbot",options="header"]
|===========================================================================
|Code |Position Fix Type
|  0  |N/A (default)
|  1  |IALA port traffic signal 1: Serious emergency – all vessels to stop
|      or divert according to instructions.
|  2  |IALA port traffic signal 2: Vessels shall not proceed.
|  3  |IALA port traffic signal 3: Vessels may proceed. One way traffic.
|  4  |IALA port traffic signal 4: Vessels may proceed. Two way traffic.
|  5  |IALA port traffic signal 5: A vessel may proceed only when it has
|      received specific orders to do so.
|  6  |IALA port traffic signal 2a: Vessels shall not proceed, except that
|      vessels which navigate outside the main channel need not comply with
|      the main message.
|  7  |IALA port traffic signal 5a: A vessel may proceed only when it has
|      received specific orders to do so; except that vessels which navigate
|      outside the main channel need not comply with the main message.
|  8  |Japan Traffic Signal - I = "in-bound" only acceptable.
|  9  |Japan Traffic Signal - O = "out-bound" only acceptable.
| 10  |Japan Traffic Signal - F = both "in- and out-bound" acceptable.
| 11  |Japan Traffic Signal - XI = Code will shift to "I" in due time.
| 12  |Japan Traffic Signal - XO = Code will shift to "O" in due time.
| 13  |Japan Traffic Signal - X = Vessels shall not proceed, except a vessel
|      which receives the direction from the competent authority.
|14-31|Reserved
|===========================================================================

==== IMO289 Weather observation report from ship ====

There are two variants of this message.  They are distinguished by bit 56,
the WMO bit.  Field layouts after that bit vary depending on it.

A message 8 subtype described in <<IMO289>>. DAC = 001 FID = 21. Fixed
length: 360 bits.

//: Type 8(1/21)
.Weather observation report from ship: Non-WMO variant
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len  |Description        |Member      |T|Units
|0-5     |   6 |Message Type       |type        |u|Constant: 8
|6-7     |   2 |Repeat Indicator   |repeat      |u|As in Common Navigation Block
|8-37    |  30 |Source MMSI        |mmsi        |u|9 decimal digits
|38-39   |   2 |Spare              |            |x|Not used
|40-49   | 10  |DAC                |dac         |u|DAC = 001
|50-55   |  6  |FID                |fid         |u|FID = 21
|56-56   |   1 |Variant            |wmo         |b|Constant: 0 in this variant
|57-176  | 120 |Location           |location    |t|20 6-bit characters
|177-201 |  25 |Longitude          |lon         |I3|Unit = minutes * 0.001,
                                                   181000 = N/A (default),
                                                   E positive, W negative.
|202-225 |  24 |Latitude           |lat         |I3|Unit = minutes * 0.001,
                                                   91000 = N/A (default),
                                                   N positive, S negative.
|226-230 |   5 |UTC Day            |day         |u|1-31, 0=N/A (default)
|231-235 |   5 |UTC hour           |hour        |u|0-23, 24=N/A (default)
|236-241 |   6 |UTC minute         |minute      |u|0-59, 60=N/A (default)
|242-245 |   4 |Present Weather    |weather     |u|wmocode: 0-15
|246-246 |   1 |Visibility Limit   |vislimit    |b|See below
|247-253 |   7 |Horiz. Visibility  |visibility  |U1|0.0-12.6nm, units = nm*0.1,
                                                   127 = N/A (default).
|254-260 |   7 |Relative Humidity  |humidity    |u|0-100%: units of 1%,
                                                   127 = N/A (default).
|261-267 |   7 |Average Wind Speed |wspeed      |u|10-min avg wind speed knots,
                                                   127 = N/A (default).
|268-276 |   9 |Wind Direction     |wdir        |u|0-359, deg. fom true north,
                                                   360 = N/A (default).
|277-285 |   9 |Air Pressure       |pressure    |u|800-1200hPa: units 1hPa,
                                                   402 = pressure >= 1201 hPa,
                                                   403 - N/A (default),
                                                   else add 400 to value,
|286-289 |   4 |Pressure Tendency  |pressuretend|u|WMO FM13 code
|290-300 |  11 |Air Temperature    |airtemp     |I1|Dry bulb temp: units 0.1C,
                                                   -60.0 to +60.0,
                                                   -1024 = N/A (default).
|301-310 |  10 |Water Temperature  |watertemp   |I1|-10.0 to 50.0 in 0.1 C,
                                                   601 = N/A (default),
                                                   else -10C after scaling.
|311-316 |  6  |Wave period        |waveperiod  |u|Seconds: 0-60,
                                                   63 = N/A (default).
|317-324 |  8  |Wave height        |waveheight  |U1|0-25m in units of 0.1m,
                                                   255 = N/A (default).
|325-333 |  9  |Wave direction     |wavedir     |u|0-359: deg. fom true north,
                                                   360 = N/A (default).
|334-341 |  8  |Swell height       |swellheight |U1|0-25m: units 0.1m,
                                                   255 = N/A (default)
|342-350 |  9  |Swell direction    |swelldir    |u|0-359: deg, fom true north,
                                                   360 = N/A (default).
|351-356 |  6  |Swell period       |swellperiod |u|Seconds: 0-60,
                                                   63 = N/A (default).
|357-359 |  3  |Spare              |            |x|Not used
|==============================================================================

The vislimit bit, when on, indicates that the maximum range of the
visibility equipment was reached and the visibility reading shall be
regarded as > x.x NM.

The standard (<<IMO289>>) does not list the WMO FM13 codes.
The following table applies:

.Weather observation report from ship: WMO Code 45501
[width="50%",frame="topbot",options="header"]
|===========================================================================
|Code |Precipitation Type
|  0  |Clear (no clouds at any level)
|  1  |Cloudy
|  2  |Rain
|  3  |Fog
|  4  |Snow
|  5  |Typhoon/hurricane
|  6  |Monsoon
|  7  |Thunderstorm
|  8  |N/A (default)
| 9-15|Reserved for future use
|===========================================================================

.Weather observation report from ship: WMO variant
[frame="topbot",options="header"]
|==============================================================================
|0-5     |   6 |Message Type           |type    |u|Constant: 8
|6-7     |   2 |Repeat Indicator       |repeat  |u|As in Common Navigation Block
|8-37    |  30 |Source MMSI            |mmsi    |u|9 decimal digits
|38-39   |   2 |Spare                  |        |x|Not used
|40-49   |  10 |DAC                    |dac     |u|DAC = 001
|50-55   |   6 |FID                    |fid     |u|FID = 21
|56-56   |   1 |Variant                |wmo     |u|Constant: 1 in this variant
|57-72   |  16 |Longitude              |lon     |I3|Unsigned: minutes * 0.01,
                                                   E positive, W negative,
                                                   Lon = (value / 100) – 180,
                                                   65536 = N/A (default).
|73-87   |  15 |Latitude               |lat     |I3|Unsigned: minutes * 0.01,
                                                   N positive, S negative,
                                                   Lat = (value / 100) – 90,
                                                   32767 = N/A (default).
|88-91   |   4 |UTC Month              |month   |u|1-12, 15=N/A (default)
|92-97   |   6 |UTC Day                |day     |u|1-31, 63=N/A (default)
|98-102  |   5 |UTC hour               |hour    |u|0-23, 31=N/A (default)
|103-105 |   3 |UTC minute             |minute  |u|0-50, 7=N/A (default),
                                                   Minute = (value * 10).
|106-112 |   7 |Course Over Ground     |course  |u|0-359, unit = 1 degree,
                                                   average over last 10 minutes.
|113-117 |   5 |Speed Over Ground      |speed   |U1|0-14.5m/s:
                                                   SOG = (value * 0.5) for 0-29,
                                                   30 = 15 m/s and more,
                                                   average over last 10 minutes.
                                                   31 = N/A (default)
|118-124 |   7 |Heading of the ship    |heading |u|5-360: units of 5 degrees,
                                                   HDT = (value * 5) for 1-72,
                                                   average over last 10 minutes.
                                                   127 = N/A (default)
|125-135 |  11 |Pressure at sea level  |pressure|U1|90-1100 hPa:
                                                   P = (value/10)+900 for 0-2000
|136-145 |  10 |Pressure Change        |pdelta  |U1|-50-+50hPa: units of 0.1hPa,
                                                   d = (value/10)-50 for 0-100,
                                                   averaged over last 3 hours.
                                                   1023 = N/A (default)
|146-149 |   4 |Pressure Tendency      |ptend   |u|WMO BUFR table 010063:
                                                   Averaged over last 3 hours,
                                                   0-8, 15 = N/A.
|150-156 |   7 |True Wind Direction    |twinddir|u|005-360: deg:
                                                   average over last 10 minutes,
                                                   dir = (value*5), value 1-72,
                                                   0 = calm,
                                                   127 = N/A (default).
|157-164 |   8 |True Wind Speed        |twindspeed|u|0-127 m/s:
                                                     average over last 10 mins,
                                                     speed = value * 0.5,
                                                     255 = N/A (default).
|165-171 |   7 |Relative Wind Direction|rwinddir  |u|005-360 deg:
                                                     average over last 10 mins,
                                                     dir = (value*5) for 1-72,
                                                     0 = calm,
                                                     127 = N/A (default).
|172-179 |   8 |Relative Wind Speed    |rwindspeed|U1|0-127 m/s:
                                                    average over last 10 mins,
                                                     speed = val*0.5 for 0-254,
                                                     255 = N/A (default).
|180-187 |   8 |Maximum Gust Speed     |mgustspeed|U1|0-127 m/s:
                                                     speed = val*0.5 for 0-254,
                                                     255 = N/A (default),
|188-194 |   7 |Maximum Gust Direction |mgustdir  |u|05-360 deg:
                                                     dir = (value*5) for 1-72,
                                                     0 = calm,
                                                     127 = N/A (default).
|195-204 |  10 |Air Temperature        |airtemp   |U1|Dry bulb temp: units 0.1C,
                                                     223-323K (c.-50C - +50C).
                                                     T = (val/10)+223 for 0-1000,
                                                     1023 = N/A (default).
|205-211 |   7 |Relative Humidity      |humidity  |u|0-100%: units of 1%,
                                                    127 = N/A (default).
|212-220 |   9 |Sea Surface Temperature|surftemp  |U1|268-318K (c.-5C - +45C):
                                                     T = (val/10)+268 for 0-500,
                                                     511 = N/A (default).
|221-226 |   6 |Horiz. Visibility      |visibility|U2|0-50000m,
                                                     Vis = (val**2)*13.073 for 0-62,
                                                     63 = N/A (default).
|227-235 |   9 |Present Weather        |weather   |u|BUFR table 020003:
                                                     Codes 0-510,
                                                     511 = N/A (default).
|236-240 |   5 |Past Weather 1         |pweather1 |u|BUFR table 020005:
                                                     Codes 0-30,
                                                     31 = N/A (default).
|241-245 |   5 |Past Weather 2         |pweather2 |u|BUFR table 020004:
                                                     Codes 0-30,
                                                     31 = N/A (default).
|246-249 |   4 |Total Cloud Cover      |totalcloud|u|0-100%:
                                                     Cover = val * 10% for 0-10,
                                                     15 = N/A (default.)
|250-253 |   4 |Cloud amount (low)     |lowclouda |u|0-14: BUFR table 020011:
                                                     15 = N/A (default).
|254-259 |   6 |Cloud type (low)       |lowcloudt |u|0-62: BUFR table 020012:
                                                     63 = N/A (default).
|260-265 |   6 |Cloud type (middle)    |midcloudt |u|0-62: BUFR table 020012:
                                                     63 = N/A (default).
|266-271 |   6 |Cloud type (high)      |highcloudt|u|0-62: BUFR table 020012:
                                                     63 = N/A (default).
|272-278 |   7 |Height of cloud base   |cloudbase |U2|0-2500m:
                                                     h = (value**2)*.0.16 for 0-125,
                                                   126 = more than 2500m,
                                                   127 = N/A (default).
|279-283 |   5 |Period of Wind Waves   |wwperiod  |u|0-30s:
                                                     31 = N/A (default).
|284-289 |   6 |Height of Wind Waves   |wwheight  |u|Height in meters: 0-30,
                                                     h = (value * 0.5) for 0-60,
                                                     63 = N/A (default).
|290-295 |   6 |First Swell Direction  |swelldir1 |u|10-360 deg:
                                                     dir = (value*10) for 1-36,
                                                     0 = calm,
                                                     63 = N/A (default).
|296-300 |   5 |First Swell Period     |swperiod1 |u|Period in seconds: 0-30,
                                                     31 = N/A (default).
|301-306 |   6 |First Swell Height     |swheight1 |U1|Height in meters: 0-30,
                                                     h = (value * 0.5) for 0-60,
                                                     63 = N/A (default).
|307-312 |   6 |Second Swell Direction |swelldir2 |u|10-360 deg:
                                                     dir = (value*10) for 1-36,
                                                     0 = calm,
                                                     63 = N/A (default).
|313-317 |   5 |Second Swell Period    |swperiod2 |u|Period in seconds: 0-30,
                                                     31 = N/A (default).
|318-323 |   6 |Second Swell Height    |swheight2 |U1|Height in meters: 0-30,
                                                     h = (value * 0.5) for 0-60,
                                                     63 = N/A (default).
|324-330 |   7 |Ice deposit (thickness)|icedeposit|u|Thickness: 0-126cm,
                                                     127 = N/A (default).
|331-333 |   3 |Rate of Ice Accretion  |icerate   |u|0-6: BUFR table 020032:
                                                     7 = N/A (default).
|334-336 |   3 |Cause of Ice Accretion |icecause  |u|0-6: BUFR table 020033:
                                                     7 = N/A (default).
|337-341 |   5 |Sea Ice Concentration  |seaice    |u|0-30: BUFR table 020034:
                                                     31 = N/A (default).
|342-345 |   4 |Amount and Type of Ice |icetype   |u|0-14: BUFR table 020035:
                                                     15 = N/A (default).
|346-350 |   5 |Ice Situation          |icestate  |u|0-30: BUFR table 020036:
                                                     31 = N/A (default).
|351-355 |   5 |Ice Development        |icedevel  |u|0-30: BUFR table 020037:
                                                     31 = N/A (default).
|356-359 |   4 |Bearing of Ice Edge    |icebearing|u|Bearing: 45-360 deg,
                                                     dir = (value*45) for 1-8,
                                                     15 = N/A (default).
|==============================================================================

The "minute" entry actually only identifies the end of a 10-minute interval.

In <<IMO289>>, the Latitude formula is given as "Lat = (value / 100) – 9000".
This is incorrect; the decrement needs to be 90 for the range to be -90..+90.

Swell directions are arrival directions.

==== IMO289 Area Notice (broadcast) ====

This should be used to broadcast time- and location-dependent information about
hazards to navigation.  For information-lifetime restrictions and usage
guidance, refer to <<ITU1371>>.

A message 8 subtype. DAC = 001 FID = 22. 196 to 981 bits.  There is a
related Message 6 subtype for addressed use.

The message consists of a fixed-length header of 111 bits, followed by 1 to
10 sub-area indications which are fixed-length records 87 bits long. Here
is the message header format:

//: Type 8(1/22)
.Area Notice (addressed) message header
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member     |T|Units
|0-5     |  6 |Message Type         |type       |u|Constant: 6
|6-7     |  2 |Repeat Indicator     |repeat     |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi       |u|9 decimal digits
|38-39   |  2 |Spare                |           |x|Not used
|40-49   | 10 |DAC                  |dac        |u|DAC = 001
|50-55   |  6 |FID                  |fid        |u|FID = 22
|56-65   | 10 |Message Linkage ID   |linkage    |u|Unsigned integer
|66-72   |  7 |Notice Description   |notice     |u|See table below
|73-76   |  4 |Month (UTC)          |month      |u|1-12; 0 = N/A (default)
|77-81   |  5 |Day (UTC)            |day        |u|1-31; 0 = N/A (default)
|82-86   |  5 |Hour (UTC)           |hour       |u|0-23; 24 = N/A (default)
|87-92   |  6 |Minute (UTC)         |minute     |u|0-59; 60 = N/A (default)
|93-110  | 18 |Duration             |duration   |In minutes,
                                                 262143 = N/A (default),
                                                 0 = cancel this notice.
|143     |    |                     |subarea    |a10|Subarea array
|0-2     |  2 |                     |shape      |u|Subarea shape
|3-86    | 85 |Subarea Payload      |payload    |d|Subarea payload
|==============================================================================

The sub-area indications are as described under the addressed form,
message type 6 with DAC = 1 and FID = 23.

==== IMO289 Extended Ship Static and Voyage Related Data ====

This message should be used by a ship to report the height over keel.

A message 8 subtype. DAC = 001 FID = 24 in <<IMO289>>.  Fixed length, 360 bits.
Replaces a deprecated trial message from <<IMO236>>.

//: Type 8(1/24)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description            |Member        |T|Units
|0-5     |  6 |Message Type           |type          |u|Constant: 8
|6-7     |  2 |Repeat Indicator       |repeat        |u|As in CNB
|8-37    | 30 |Source MMSI            |mmsi          |u|9 digits
|38-39   |  2 |Spare                  |              |x|Not used
|40-49   | 10 |DAC                    |dac           |u|DAC = 001
|50-55   |  6 |FID                    |fid           |u|FID = 24
|56-65   | 10 |Message Linkage ID     |linkage       |u|Unsigned integer
|66-78   | 13 |Air Draught            |airdraught    |u|Unsigned int, in 0.1m
                                                        1-81.9 m.
                                                        0 = N/A (default)
                                                        81.91 = >= 81.91 m
|79-108  | 30 |Last Port Of Call      |lastport      |t|5 6-bit chars, UN locode
|109-138 | 30 |Next Port Of Call      |nextport      |t|5 6-bit chars, UN locode
|139-168 | 30 |Second Port Of Call    |secondport    |t|5 6-bit chars, UN locode
|169-170 |  2 |AIS Class A            |ais_state     |e|See "SOLAS Status"
|171-172 |  2 |Automatic Tracking Aid |ata_state     |e|See "SOLAS Status"
|173-174 |  2 |BNWAS                  |bnwas_state   |e|See "SOLAS Status"
|175-176 |  2 |ECDIS Back-up          |ecdisb_state  |e|See "SOLAS Status"
|177-178 |  2 |Paper Nautical Chart   |chart_state   |e|See "SOLAS Status"
|179-180 |  2 |Echo sounder           |sounder_state |e|See "SOLAS Status"
|181-182 |  2 |Electronic plotting aid|epaid_state   |e|See "SOLAS Status"
|183-184 |  2 |Emergency steering gear|steer_state   |e|See "SOLAS Status"
|185-186 |  2 |GNSS                   |gnss_state    |e|See "SOLAS Status"
|187-188 |  2 |Gyro compass           |gyro_state    |e|See "SOLAS Status"
|189-190 |  2 |LRIT                   |lrit_state    |e|See "SOLAS Status"
|191-192 |  2 |Magnetic compass       |magcomp_state |e|See "SOLAS Status"
|193-194 |  2 |NAVTEX                 |navtex_state  |e|See "SOLAS Status"
|195-196 |  2 |Radar (ARPA)           |arpa_state    |e|See "SOLAS Status"
|197-198 |  2 |Radar (S-band)         |sband_state   |e|See "SOLAS Status"
|199-200 |  2 |Radar (X-band)         |xband_state   |e|See "SOLAS Status"
|201-202 |  2 |Radio HF               |hfradio_state |e|See "SOLAS Status"
|203-204 |  2 |Radio INMARSAT         |inmarsat_state|e|See "SOLAS Status"
|205-206 |  2 |Radio MF               |mfradio_state |e|See "SOLAS Status"
|207-208 |  2 |Radio VHF              |vhfradio_state|e|See "SOLAS Status"
|209-210 |  2 |Speed Log over ground  |grndlog_state |e|See "SOLAS Status"
|211-212 |  2 |Speed Log through water|waterlog_state|e|See "SOLAS Status"
|213-214 |  2 |THD                    |thd_state     |e|See "SOLAS Status"
|215-216 |  2 |Track control system   |tcs_state     |e|See "SOLAS Status"
|217-218 |  2 |VDR/S-VDR              |vdr_state     |e|See "SOLAS Status"
|219-220 |  2 |Reserved               |              |x|Not used
|221-224 |  4 |Ice Class              |iceclass      |e|See "Ice Class"
|225-242 | 18 |Shaft Horsepower       |horsepower    |u|Total ship HP: 1hp units,
                                                        262,142 = >= 262,142hp,
                                                        262,143 = N/A (default).
|243-254 | 12 |VHF Working Channel    |vhfchan       |u|Channel number,
                                                        0 = N/A (default).
|255-296 | 42 |Lloyd's Ship Type      |lshiptype     |t|7 six-bit characters
|297-314 | 18 |Gross Tonnage          |tonnage       |u|0-262,141,
                                                        262,142 = >= 262,142hp,
                                                        262,143 = N/A (default).
|315-316 |  2 |Laden or Ballast       |lading        |e|0 = N/A (default),
                                                        1 = Laden,
                                                        2 = Ballast,
                                                        3 = Not in use.
|317-318 |  2 |Heavy Fuel Oil Bunkered|heavyoil      |e|0 = N/A (default),
                                                        1 = No,
                                                        2 = Yes,
                                                        3 = Not in use.
|319-320 |  2 |Light Fuel Oil Bunkered|lightoil      |e|0 = N/A (default),
                                                        1 = No,
                                                        2 = Yes,
                                                        3 = Not in use.
|321-322 |  2 |Diesel Oil Bunkered    |dieseloil     |e|0 = N/A (default),
                                                        1 = No,
                                                        2 = Yes,
                                                        3 = Not in use.
|323-336 | 14 |Total Bunker Oil       |totaloil      |u|0-16381 in tonnes,
                                                        16382 = >= 16382 tonnes,
                                                        16382 = N/A (default).
|337-349 | 13 |Number of persons      |persons       |u|0 = N/A (default),
                                                        1-8190,
                                                        8191 = >= 8191.
|350-359 | 10 |Spare                  |              |x|Not used
|==============================================================================

The special value of 81.91 for air draught is probably a drafting
error in <<IMO289>>, as the scaled field does not have the precision
required to represent it. The actual special value is unknown.

The 2-bit _state fields describe the operational state of various sorts of
SOLAS-required navigational equipment.  GNSS systems may include GPS, Loran-C, or GLONASS. BNWAS is the Bridge Navigational Watch Alarm System.  THD is a
Transmitting Heading Device.  Paper Nautical Chart state is officially
"ECDIS/Paper Nautical Chart" state in <<IMO289>>.  Status codes should be
interpreted according to the following table:

.SOLAS Status
[width="50%",frame="topbot",options="header"]
|=============================================================================
|Code |Meaning
|0    |Not available or requested (default)
|1    |Equipment operational
|2    |Equipment not operational
|3    |No data (equipment may or may not be on board/or its status is unknown)
|=============================================================================

.Ice Class
[width="50%",frame="topbot",options="header"]
|=============================================================================
|Code |Meaning
|0    |Not classified
|1    |IACS PC 1
|2    |IACS PC 2
|3    |IACS PC 3
|4    |IACS PC 4
|5    |IACS PC 5
|6    |IACS PC 6 / FSICR IA Super / RS Arc5
|7    |IACS PC 7 / FSICR IA / RS Arc4
|8    |FSICR IB / RS Ice3
|9    |FSICR IC / RS Ice2
|10   |RS Ice1
|11-14|Reserved for future use
|15   |Not available = default
|=============================================================================

ACS = International Association of Classification Societies

PC = Polar Class. For further details, see IACS Req. 2007 Requirements
concerning POLAR CLASS and MSC/Circ.1056 and MEPC/Circ.399 on
Guidelines for ships operating in Arctic ice-covered waters.

FSICR = Finnish-Swedish Ice Class Rules. For further details, see
Finnish Maritime Administration's Bulletin No.10/10.12.2008 Ice class
regulations 2008 (Finnish-Swedish ice class rules). Note: Authorized
classification society equivalents for the Finnish-Swedish Ice Class
Rules should also be recognized, as issued in the Finnish Maritime
Administration's Bulletin No.4/2.4.2007 (as amended). Both bulletins
can be found at www.fma.fi.

RS = Russian Maritime Register of Shipping. For further details see
Rules for the classification and construction of seagoing ships,
Edition 2008.

VHF channel number is encoded according to Recommendation ITU-R M.1084.

The lshiptype field uses Lloyd's Register STATCODE 5 encoding.

==== IMO289 Environmental ====

A message 8 subtype. DAC = 001 FID = 26. Variable length: 168-1008 bits.

//: Type 8(1/26)
.Environmental message header
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member     |T|Units
|0-5     |  6 |Message Type         |type       |u|Constant: 6
|6-7     |  2 |Repeat Indicator     |repeat     |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI          |mmsi       |u|9 decimal digits
|38-39   |  2 |Spare                |           |x|Not used
|40-49   | 10 |DAC                  |dac        |u|DAC = 001
|50-55   |  6 |FID                  |fid        |u|FID = 26
|56      |    |                     |reports    |a5|Sensor records array
|0-3     |  4 |Sensor Report Type   |sensor     |u|See table below
|4-8     |  5 |Day (UTC)            |day        |u|1-31; 0 = N/A (default)
|9-13    |  5 |Hour (UTC)           |hour       |u|0-23; 24 = N/A (default)
|14-19   |  6 |Minute (UTC)         |minute     |u|0-59; 60 = N/A (default)
|20-26   |  7 |Site ID              |site       |u|Binary ID of sensor site
|27-111  | 85 |Sensor payload       |payload    |d|Sensor payload data
|==============================================================================

The fixed header is followed by 1-5 sensor records, each 112 bits
long.  The Sensor Report Type is interpreted as follows, and controls
the interpretation of the sensor payload data.

.Sensor report types
[frame="topbot",options="header"]
|==============================================================================
| 0 | Site location
| 1 | Station ID
| 2 | Wind
| 3 | Water level
| 4 | Current flow (2D)
| 5 | Current flow (3D)
| 6 | Horizontal current flow
| 7 | Sea state
| 8 | Salinity
| 9 | Weather
| 10| Air gap/Air draft
| 11| (reserved for future use)
|==============================================================================

Here are the payload types for each variant:

.Site location payload
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description      |Member   |T|Units
|0-27    | 28 |Longitude        |lon      |I4|As in Common Navigation Block
|28-54   | 27 |Latitude         |lat      |I4|As in Common Navigation Block
|55-65   | 11 |Altitude         |alt      |u|Sensor altitude above MSL,
                                             0-200 in units of 0.1m,
                                             2001 = 200.1 m or higher,
                                             2002 = N/A (default),
                                             2003-2046 reserved.
|66-69   |  4 |Sensor owner     |owner    |e|See "Sensor Owner Codes"
|70-72   |  3 |Data timeout     |timeout  |e|See "Data Timeout Codes"
|73-84   | 12 |Spare            |         |x|Not used
|==============================================================================

.Sensor Owner Codes
[frame="topbot",options="header"]
|==============================================================================
|   0  | Unknown (default)
|   1  | Hydrographic office
|   2  | Inland waterway authority
|   3  | Coastal directorate
|   4  | Meteorological service
|   5  | Port Authority
|   6  | Coast guard
| 7-13 | (reserved for future use)
|  14  | (reserved for regional use)
|==============================================================================

.Data Timeout Codes
[frame="topbot",options="header"]
|==============================================================================
|   0  | No time period (default)
|   1  | 10 minutes
|   2  | 1 hour
|   3  | 6 hours
|   4  | 12 hours
|   5  | 24 hours
|  6-7 | (reserved for future use)
|==============================================================================

.Station ID payload
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member     |T|Units
|  0     | 84 |Name                 |name       |t|14 chars of six-bit ASCII.
|  84    |  1 |Spare                |           |x|Not used
|==============================================================================

.Wind report payload
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member      |T|Units
|0-6     |  7 |Average Wind Speed |wspeed      |u|10-min avg wind speed,
                                                  0-120 in 1-knot units,
                                                  121 = 121 knots or greater,
                                                  122 = N/A (default),
                                                  123-126 = reserved.
|7-13   |  7 |Wind Gust          |wgust       |u|10-min max wind speed,
                                                  0-120 in 1-knot units,
                                                  121 = 121 knots or greater,
                                                  122 = N/A (default),
                                                  123-126 = reserved.
|14-22  |  9 |Wind Direction     |wdir        |u|0-359, degrees fom true north
                                                   >=360 = N/A (default)
|23-31  |  9 |Wind Gust Direction|wgustdir    |u|0-359, degrees fom true north
                                                   >=360 = N/A (default)
|32-34  |  3 |Sensor Description |sensortype  |e|See "Sensor Types"
|35-41  |  7 |Forecast Wind Speed|fwspeed     |u|Predicted average wind speed,
                                                  0-120 in 1-knot units,
                                                  121 = 121 knots or greater,
                                                  122 = N/A (default),
                                                  123-126 = reserved.
|42-48  |  7 |Forecast Wind Gust |fwgust      |u|Predicted max wind speed,
                                                  0-120 in 1-knot units,
                                                  121 = 121 knots or greater,
                                                  122 = N/A (default),
                                                  123-126 = reserved.
|49-57  |  9 |Forecast Wind Direction|fwdir   |u|0-359, degrees fom true north
                                                   >=360 = N/A (default)
|58-62  |  5 |Day (UTC)            |day       |u|1-31; 0 = N/A (default)
|63-67  |  5 |Hour (UTC)           |hour      |u|0-23; 24 = N/A (default)
|68-73  |  6 |Minute (UTC)         |minute    |u|0-59; 60 = N/A (default)
|74-81  |  8 |Duration             |duration  |u|Forecast duration in minutes,
                                                  255 = N/A (default),
                                                  0 = cancel forecast.
|82-84  |  3 |Spare                |          |x|Not used
|==============================================================================

The timestamp group is intended as a valid time of forecast.

.Sensor Types
[frame="topbot",options="header"]
|==============================================================================
|   0  | No data (default)
|   1  | Raw real time
|   2  | Real time with quality control
|   3  | Predicted (based on historical statistics)
|   4  | Forecast (predicted, refined with real-time information)
|   5  | Nowcast (a continuous forecast)
|   6  | (reserved for future use)
|   7  | Sensor not available
|==============================================================================

.Water level report payload
[frame="topbot",options="header"]
|==============================================================================
|0-0     | 1  |Water Level Type         |absolute   |b|False if relative to
                                                       reference datum.
|1-16    | 16 |Water Level              |level      |i|In 0.001 meter steps,
                                                      -327.67 to 327.67,
                                                      -32767 = -327.67m or less,
                                                      32767 = 327.67m or more,
                                                      -32768 = N/A (default).
|17-18   | 2  |Water Level Trend        |leveltrend |u| 0 = increasing,
                                                       1 = decreasing,
                                                       2 = steady,
                                                       3 = N/A (default).
|19-23   | 5  |Vertical Reference Datum |datum      |u|See table below
|24-26   | 3  |Sensor Description       |sensortype |e|See "Sensor Types"
|27-27   | 1  |Forecast Water Level Type|absolute   |b|False if relative to
                                                       reference datum.
|28-43   | 16 |Forecast Water Level     |level      |i|In 0.001 meter steps,
                                                      -327.67 to 327.67,
                                                      -32767 = -327.67m or less,
                                                      32767 = 327.67m or more,
                                                      -32768 = N/A (default).
|44-48  |  5 |Day (UTC)            |day             |u|1-31; 0 = N/A (default)
|49-53  |  5 |Hour (UTC)           |hour            |u|0-23; 24 = N/A (default)
|54-59  |  6 |Minute (UTC)         |minute          |u|0-59; 60 = N/A (default)
|60-67  |  8 |Duration             |duration        |u|Forecast duration in minutes,
                                                       255 = N/A (default),
                                                       0 = cancel forecast.
|68-84  | 17 |Spare                |                |x|Not used
|==============================================================================

IMO289 says water level is in 0.1m steps, but this is incompatible with the
two digits of precision in the range.

The timestamp group is intended as a valid time of forecast.

.Vertical Reference Datum
[frame="topbot",options="header"]
|==============================================================================
|   0  | Mean Lower Low Water (MLLW)
|   1  | International Great Lakes Datum (IGLD-85)
|   2  | Local river datum
|   3  | Station Datum (STND)
|   4  | Mean Higher High Water (MHHW)
|   5  | Mean High Water (MHW)
|   6  | Mean Sea Level (MSL)
|   7  | Mean Low Water (MLW)
|   8  | National Geodetic Vertical Datum (NGVD-29)
|   9  | North American Vertical Datum (NAVD-88)
|   10 | World Geodetic System (WGS-84)
|   11 | Lowest Astronomical Tide (LAT)
|   12 | pool
|   13 | gauge
|   14 | Unknown/not available (default)
| 15-30| Reserved for future use
|==============================================================================

.Current flow (2D) report payload
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member    |T|Units
|0-7     |  8 |Current Speed #1     |cspeed1   |U1|0.0-24.5 knots:
                                                   units 0.1 knots,
                                                   246 = speed >= 24.6 knots,
                                                   247 = N/A (default),
                                                   248-255 (reserved).
|8-16    |  9 |Current Direction #1 |cdir1     |u|0-359: deg from true north,
                                                  >=360 = N/A (default).
|17-25   |  9 |Measurement Depth #1 |cdepth1   |u|0-360m down: units 1m,
                                                   361 = 361m or greater,
                                                   362 = N/A (default),
                                                   363-511 (reserved).
|26-33   |  8 |Current Speed #2     |cspeed2   |U1|0.0-24.5 knots,
                                                   units 0.1 knots,
                                                   246 = speed >= 24.6 knots,
                                                   247 = N/A (default),
                                                   248-255 (reserved).
|34-42   |  9 |Current Direction #2 |cdir2     |u|0-359: deg. fom true north,
                                                  >=360 = N/A (default)
|43-51   |  9 |Measurement Depth #2 |cdepth2   |u|0-360m down: units 1m,
                                                  361 = 361m or greater,
                                                  362 = N/A (default),
                                                  363-511 (reserved).
|52-59   |  8 |Current Speed #3     |cspeed3   |U1|0.0-24.5 knots:
                                                   units 0.1 knots,
                                                   246 = speed >= 24.6 knots,
                                                   247 = N/A (default),
                                                   248-255 (reserved).
|60-68   |  9 |Current Direction #3 |cdir3     |u|0-359: degrees fom true north,
                                                  >=360 = N/A (default).
|69-77   |  9 |Measurement Depth #3 |cdepth3   |u|0-360m down: units 1m,
                                                  361 = 361m or greater,
                                                  362 = N/A (default),
                                                  363-511 (reserved).
|78-80   | 3  |Sensor Description   |sensortype|e|See "Sensor Types"
|81-84   | 4  |Spare                |          |x|Not used
|==============================================================================

.Current flow (3D) payload
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description                          |Member  |T|Units
|0-7     |  8 |Current Vector component North (u) #1|cnorth1 |U1|0.0-24.5 knots:
                                                   units 0.1 knots,
                                                   246 = speed >= 24.6 knots,
                                                   247 = N/A (default),
                                                   248-255 (reserved).
|8-15    |  8 |Current Vector component East (v) #1|ceast1   |U1|0.0-24.5 knots:
                                                   units 0.1 knots,
                                                   246 = speed >= 24.6 knots,
                                                   247 = N/A (default),
                                                   248-255 (reserved).
|16-23   |  8 |Current Vector component Up (z) #1  |cup1     |U1|0.0-24.5 knots:
                                                   units 0.1 knots,
                                                   246 = speed >= 24.6 knots,
                                                   247 = N/A (default),
                                                   248-255 (reserved).
|24-32   |  9 |Measurement Depth #1                |cdepth1 |u|0-360m down:
                                                   units 1m,
                                                   361 = 361m or greater,
                                                   362 = N/A (default),
                                                   363-511 (reserved).
|33-40   |  8 |Current Vector component North (u) #2|cnorth2 |U1|0.0-24.5 knots:
                                                   units 0.1 knots,
                                                   246 = speed >= 24.6 knots,
                                                   247 = N/A (default),
                                                   248-255 (reserved).
|41-48   |  8 |Current Vector component East (v) #2|ceast2   |U1|0.0-24.5 knots:
                                                   units 0.1 knots,
                                                   246 = speed >= 24.6 knots,
                                                   247 = N/A (default),
                                                   248-255 (reserved).
|49-56   |  8 |Current Vector component Up (z) #2  |cup2     |U1|0.0-24.5 knots:
                                                   units 0.1 knots,
                                                   246 = speed >= 24.6 knots,
                                                   247 = N/A (default),
                                                   248-255 (reserved).
|57-65   |  9 |Measurement Depth #2                |cdepth2 |u|0-360m down:
                                                   units 1m,
                                                   361 = 361m or greater,
                                                   362 = N/A (default),
                                                   363-511 (reserved).
|66-68   | 3  |Sensor Description   |sensortype|e|See "Sensor Types"
|69-84   | 16 |Spare                |          |x|Not used
|==============================================================================

.Horizontal current report payload
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member     |T|Units
|0-8     |  9 |Current Bearing #1   |bearing1   |u|0-359: deg from true north,
                                                  >=360 = N/A (default).
|9-15    |  7 |Current Distance #1  |distance1  |u|0-120m:
                                                  121 = 121m or greater,
                                                  122 = N/A (default),
                                                  123-127 (reserved).
|16-23   |  8 |Current Speed #1     |speed1    |U1|0.0-24.5 knots:
                                                   units 0.1 knots,
                                                   246 = speed >= 24.6 knots,
                                                   247 = N/A (default),
                                                   248-255 (reserved).
|24-32   |  9 |Current Direction #1 |direction1|u|0-359: deg from true north,
                                                  >=360 = N/A (default).
|33-41   |  9 |Measurement Depth #1 |depth1    |u|0-360m down: units 1m,
                                                   361 = 361m or greater,
                                                   362 = N/A (default),
                                                   363-511 (reserved).
|42-50   |  9 |Current Bearing #2   |bearing1   |u|0-359: deg from true north,
                                                  >=360 = N/A (default).
|51-57   |  7 |Current Distance #2  |distance1  |u|0-120m:
                                                  121 = 121m or greater,
                                                  122 = N/A (default),
                                                  123-127 (reserved).
|58-65   |  8 |Current Speed #2     |speed1    |U1|0.0-24.5 knots:
                                                   units 0.1 knots,
                                                   246 = speed >= 24.6 knots,
                                                   247 = N/A (default),
                                                   248-255 (reserved).
|66-74   |  9 |Current Direction #2 |direction1|u|0-359: deg from true north,
                                                  >=360 = N/A (default).
|75-83   |  9 |Measurement Depth #2 |depth1    |u|0-360m down: units 1m,
                                                   361 = 361m or greater,
                                                   362 = N/A (default),
                                                   363-511 (reserved).
|84-84   |  1 |Spare                |          |x|Not used
|==============================================================================

.Sea state report payload
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description                |Member     |T|Units
|0-7     |  8 |Swell Height               |swheight   |U1|Units 0.1m: 0.0-24.5m,
                                                         246 = height >= 24,6m,
                                                         247 = N/A (default),
                                                         248-255 reserved,
                                                         else h = (value * 0.5).
|8-13    |  6 |Swell Period               |swperiod   |u|Period in seconds:
                                                         0-60,
                                                         61 = N/A (default),
                                                         62-63 (reserved).
|14-22   |  9 |Swell Direction            |swelldir   |u|0-359 deg:
                                                         0-359 true bearing,
                                                         360 = N/A (default),
                                                         361-511 reserved,
|23-26   |  4 |Sea State                  |seastate   |u|Beaufort scale: 0-12
                                                       >= 13 = N/A (default)
|27-29   |  3 |Swell Sensor Description   |swelltype  |e|See "Sensor Types"
|30-39   | 10 |Water Temperature          |watertemp  |U1|-10.0 to 50.0:
                                                      units 0.1 C,
                                                      >=601 = N/A (default).
                                                      602-1023 reserved,
                                                      else -10.0m after scaling.
|40-46   |  7 |Water Temperature Depth    |distance1  |U1|0.0-12.0m: 0.1m units,
                                                      121 = 12.1m or greater,
                                                      122 = N/A (default),
                                                      123-126 (reserved).
|47-49   |  3 |Depth Sensor Description   |depthtype  |e|See "Sensor Types"

|50-57   |  8 |Wave Height                |waveheight|U1|Height 0.0-24.5m:
                                                         units 0.1m,
                                                         246 = height >= 24.6m,
                                                         247 N/A (default),
                                                         248-255 reserved.
|58-63   |  6 |Wave Period                |waveperiod|u|0-60: units of seconds,
                                                        61 = N/A (default),
                                                        62-63 reserved.
|64-72   |  9 |Wave Direction             |wavedir   |u|0-359: true bearing,
                                                        360 = N/A (default),
                                                        361-511 reserved.
|73-75   |  3 |Wave Sensor Description    |wavetype  |e|See "Sensor Types"
|76-84   |  9 |Salinity                   |salinity  |U1|0.0-50.0%:
                                                         units of 0.1%
                                                         501 = salinity >= 50.1%
                                                         502 = data N/A (default)
                                                         503 - sensor N/A,
                                                         504-511 reserved.
|==============================================================================

The standard does not fix the meaning of a water temperature depth of 127.

.Salinity report payload
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member       |T|Units
|0-9     | 10 |Water Temperature  |watertemp    |U1|-10.0 to 50.0:
                                                    units 0.1 C,
                                                    >=601 = N/A (default).
                                                    602-1023 reserved,
                                                    else -10.0m after scaling.
|10-19   | 10 |Conductivity       |conductivity |U1|In Siemens/m, 0.0-7.0,
                                                    0.1 S/m steps,
                                                    701 = not less than 7.01,
                                                    702 = data N/A,
                                                    703 = sensor N/A (default),
                                                    704-1023 (reserved).
|20-35   | 16 |Water Pressure     |pressure    |U1|Water pressure: 0.0-6000.0,
                                                   0.1 decibar steps,
                                                   60001 = pressure >= 6000.1,
                                                   60002 = data N/A,
                                                   60003 = sensor N/A (default),
                                                   60004-65536 reserved.
|36-44   |  9 |Salinity           |salinity    |U1|0.0-50.0%:
                                                   units of 0.1%
                                                   501 = salinity >= 50.1%
                                                   502 = data N/A (default)
                                                   503 - sensor N/A,
                                                   504-511 reserved.
|45-46   |  2 |Salinity Type      |salinitytype|e|0 = measured,
                                                  1 = calculated using PSS-78,
                                                  2 = calculated using other method,
                                                  3 = reserved.
|47-49   |  3 |Sensor Description |sensortype  |e|See "Sensor Types"
|50-84   | 35 |Spare              |            |x|Not used
|==============================================================================

No default is specified for salinity type.

.Weather report payload
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description          |Member     |T|Units
|0-10    | 11 |Air Temperature      |temperature|i|Dry bulb temp: 0.1 deg C
                                                    -60.0 to +60.0,
                                                    -1024 = data N/A (default),
                                                    601-1023 reserved.
|11-13   |  3 |Temp. Sensor Type    |sensortype |e|See "Sensor Types"
|14-15   |  2 |Precipitation Type   |preciptype |e|0 = rain,
                                                     1 = rain and snow,
                                                     2 = rain and snow,
                                                     3 = other.
|16-23   |  8 |Horiz. Visibility    |visibility |U1|Units of 0.1 nautical miles,
                                                  0.0-24.0,
                                                  241 = visibility >= 24.1nm,
                                                  242 = data N/A,
                                                  243 = sensor N/A (default),
                                                  244-255 reserved.
|24-33   | 10 |Dew Point           |dewpoint    |i|-20.0 to +50.0: 0.1 deg C,
                                                  501 = N/A (default),
                                                  502-511 reserved,
                                                  -511--201 reserved.
|34-36   |  3 |Dewpoint Sensor Type|dewtype     |e|See "Sensor Types".



|37-45   |  9 |Air Pressure        |pressure    |u|0 = pressure <= 800hpA,
                                                   1-401 = 800-1200hPa,
                                                   402 = pressure >= 1201 hPa,
                                                   403 - data N/A (default),
                                                   404-511 reserved.
|46-47   |  2 |Pressure Tendency  |pressuretend |e|0 = steady,
                                                  1 = decreasing,
                                                  2 = increasing,
                                                  3 - N/A (default).
|48-50   |  3 |Pressure Sensor Type|pressuretype|e|See "Sensor Types"
|51-59   |  9 |Salinity            |salinity    |U1|0.0-50.0%:
                                                     units of 0.1%
                                                     501 = salinity >= 50.1%
                                                     502 = data N/A (default)
                                                     503 - sensor N/A,
                                                     504-511 reserved.
|60-84   | 25 |Spare                |           |x|Not used
|==============================================================================

The standard does not specify how to code 'Precipitation Type' when
there is none.

.Air Gap/Air Draft report payload
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description         |Member     |T|Units
|0-12    | 13 |Air Draught         |airdraught |U1|1-81.9m in 0.1m steps,
                                                   8191 = distance >= 81.91m,
                                                   0 = N/A (default).
|13-25   | 13 |Air Gap             |airgap     |U1|1-81.9m in 0.1m steps,
                                                   8191 = distance >= 81.91m,
                                                   0 = N/A (default).
|26-27   |  2 |Air Gap Trend       |gaptrend   |e|0 = steady,
                                                   1 = rising,
                                                   2 = falling,
                                                   3 = N/A (default).
|28-40   | 13 |Forecast Air Gap    |fairgap    |U1|1-81.9m in 0.1m steps,
                                                   8191 = distance >= 81.91m,
                                                   0 = N/A (default).
|41-45  |  5 |Day (UTC)            |day             |u|1-31; 0 = N/A (default)
|46-50  |  5 |Hour (UTC)           |hour            |u|0-23; 24 = N/A (default)
|51-56  |  6 |Minute (UTC)         |minute          |u|0-59; 60 = N/A (default)
|57-84  | 28 |Spare                |                |x|Not used
|==============================================================================

Air draught is the vertical distance measured from the ship's
waterline to the highest point on the ship. Air gap is the vertical
distance measured from the surface of the water to the sensor.

The timestamp is for the forecast air gap.

==== IMO289 Route Information (broadcast) ====

The content of this message is a time and a list of waypoints describing a
course.  It has an addressed equivalent that is a message 6 subtype.

A message 8 subtype. DAC = 001 FID = 27. Variable length: 172-997 bits.

//: Type 8(1/27)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description       |Member   |T|Units
|0-5     |  6 |Message Type      |type     |u|Constant: 8
|6-7     |  2 |Repeat Indicator  |repeat   |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI       |mmsi     |u|9 decimal digits
|38-39   |  2 |Spare             |         |x|Not used
|40-49   | 10 |DAC               |dac      |u|DAC = 001
|50-55   |  6 |FID               |fid      |u|FID = 27
|56-65   | 10 |Message Linkage ID|linkage  |u|Unsigned integer
|66-68   |  3 |Sender Class      |sender   |u|0 = ship (default), 1 = authority,
                                              27 = reserved for future use.
|69-73   |  5 |Route Type        |rtype    |e|See below
|74-77   |  4 |Start month       |month    |u|1-12, 0=N/A (default)
|78-82   |  5 |Start day         |day      |u|1-31, 0=N/A (default)
|83-87   |  5 |Start hour        |hour     |u|0-23, 24=N/A (default)
|88-93   |  6 |Start minute      |minute   |u|0-59, 60=N/A (default)
|94-111  | 18 |Duration          |duration |u|Minutes from start time,
                                              0 = cancel route,
                                              262,143 = not available (default).
|112-116 |  5 |Waypoint count    |waycount |u|1-16, values 17-31 are not used.
|117     |    |                  |waypoints|a^16|Waypoint array
|0-27    | 28 |Longitude         |lon      |I4|Unit = minutes * 0.0001,
                                              181000 = N/A (default),
                                              E positive, W negative.
|28-54   | 27 |Latitude          |lat      |I4|Unit = minutes * 0.001,
                                              91000 = N/A (default),
                                              N positive, S negative.
|==============================================================================

The final pair of fields in the table above is a waypoint.  The message may
end with 1 to 16 waypoints.

For interpretation of the Route Type field, see the table under the "Route
Information (addressed)" message (DAC=1, FID=28).

==== IMO289 Text description (broadcast) ====

A message 8 subtype. DAC = 001 FID = 29. Variable length: 72-1032 bits.

Intended to be used to associate a text annotation with another message
via the Message Linkage ID field.

//: Type 8(1/29)
[frame="topbot",options="header"]
|=============================================================================
|Field   |Len    |Description       |Member     |T|Units
|0-5     |  6    |Message Type      |type       |u|Constant: 8
|6-7     |  2    |Repeat Indicator  |repeat     |u|As in Common Navigation Block
|8-37    | 30    |Source MMSI       |mmsi       |u|9 decimal digits
|38-39   |  2    |Spare             |           |x|Not used
|40-49   | 10    |DAC               |dac        |u|DAC = 001
|50-55   |  6    |FID               |fid        |u|FID = 29
|56-65   | 10    |Message Linkage ID|linkage    |u|Unsigned integer
|66-?    | 6-966 |Description       |description|t|String
|==============================================================================

There is an equivalent subtype of message 6 that is an addressed description.

==== Meteorological and Hydrological Data (IMO289) ===

A message 8 subtype. DAC = 001 FID = 31. Fixed length, 360 bits.
Supersedes an <<IMO236>> message with the same title but FID = 11 and
a different binary layout.  The exact differences are: (a) The
addition of the Position Accuracy field, (b) water level has 12 bits
of precision rather than 9 (units of centimeters rather than
decimeters), and (c) end padding changes from 6 to 10 bits.

//: Type 8(1/31)
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member      |T|Units
|0-5     |  6 |Message Type       |type        |u|Constant: 8
|6-7     |  2 |Repeat Indicator   |repeat      |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI        |mmsi        |u|9 decimal digits
|38-39   |  2 |Spare              |            |x|Not used
|40-49   | 10 |DAC                |dac         |u|DAC = 001
|50-55   |  6 |FID                |fid         |u|FID = 31
|56-80   | 25 |Longitude          |lon         |I3|Unit = minutes * 0.001,
                                                  E positive, We negative,
                                                  181000 = N/A (default).
|81-104  | 24 |Latitude           |lat         |I3|Unit = minutes * 0.001,
                                                  N positive, S negative,
                                                  91000 = N/A (default).
|105-105 |  1 |Fix quality        |accuracy    |b|As in Common Navigation Block
|106-110 |  5 |Day                |day         |u|1-31, 0=N/A (default)
|111-115 |  5 |Hour               |hour        |u|0-23, 24=N/A (default)
|116-121 |  6 |Minute             |minute      |u|0-59, 60=N/A (default)
|122-128 |  7 |Average Wind Speed |wspeed      |u|10-min avg wind speed: knots,
                                                  126 = wind >= 126 knots,
                                                  127 = N/A (default).
|129-135 |  7 |Gust Speed         |wgust       |u|10-min max wind speed: knots,
                                                  126 = wind >= 126 knots,
                                                  127 = N/A (default).
|136-144 |  9 |Wind Direction     |wdir        |u|0-359, true bearing,
                                                  360 = N/A (default).
|145-153 |  9 |Wind Gust Direction|wgustdir    |u|0-359, true bearing,
                                                  360 = N/A (default).
|154-164 | 11 |Air Temperature    |airtemp     |I1|Dry bulb temp: units 0.1C,
                                                -60.0 to +60.0,
                                                -1024 = N/A (default).
|165-171 |  7 |Relative Humidity  |humidity    |u|0-100%: units of 1%,
                                                  101 = N/A (default).
|172-181 | 10 |Dew Point          |dewpoint    |I1|-20.0 to +50.0: units 0.1C,
                                                  501 = N/A (default).
|182-190 |  9 |Air Pressure       |pressure    |u|800-1200hPa, 1hPa,
                                                  0 = pressure <= 799hPa,
                                                  402 = pressure >= 1201 hPa,
                                                  511 = N/A (default).
|191-192 |  2 |Pressure Tendency  |pressuretend|e|0 = steady,
                                                  1 = decreasing,
                                                  2 = increasing,
                                                  3 = N/A (default).
|193-193 |  7 |Max. visibility    |visgreater  |b|Visibility greater than.
|194-200 |  8 |Horiz. Visibility  |visibility  |U1|Units are 0.1 nautical miles,
                                                  127 = N/A (default).
|201-212 | 12 |Water Level        |waterlevel  |I2|-10.0 to +30.0 in 0.01m,
                                                  -10.0m after scaling,
                                                  4001 = N/A (default).
|213-214 |  2 |Water Level Trend  |leveltrend  |e|0 = steady,
                                                  1 = decreasing,
                                                  2 = increasing,
                                                  3 = N/A (default).
|215-222 |  8 |Surface Current Speed  |cspeed  |U1|0.0-25.0: units 0.1 knot,
                                                   251 = speed >= 25.1 knots,
                                                   255 = N/A (default).
|223-231 |  9 |Surface Current Direction |cdir |u|0-359: deg. fom true north,
                                                       360 = N/A (default).
|232-239 |  8 |Current Speed #2     |cspeed2   |U1|0.0-25.0 knots:
                                                   units 0.1 knot,
                                                   251 = speed >= 25.1 knots,
                                                   255 = N/A (default).
|240-248 |  9 |Current Direction #2 |cdir2     |u|0-359: true bearing,
                                                 360 = N/A (default).
|249-253 |  5 |Measurement Depth #2 |cdepth2   |U1|0-30m down: units 0.1m,
                                                 31 = N/A (default).
|254-261 |  8 |Current Speed #3     |cspeed3   |U1|0.0-25.0 knots: units 0.1 knot,
                                                 251 = speed >= 25.1 knots,
                                                 255 = N/A (default).
|262-270 |  9 |Current Direction #3 |cdir3     |u|0-359: true bearing,
                                                 360 = N/A (default).
|271-275 |  5 |Measurement Depth #3 |cdepth3   |u|0-30m down: units 0.1m,
                                                 31 = N/A (default).
|276-283 |  8 |Wave Height          |waveheight|U1|Height 0-25m: units 0.1m,
                                                  251 = height >= 25.1m,
                                                  255 = N/A (default).
|284-289 |  6 |Wave Period          |waveperiod|u|Seconds, 0-60, units 1s,
                                                  63 = N/A (default).
|290-298 |  9 |Wave Direction       |wavedir   |u|0-359: true bearing,
                                                  360 = N/A (default).
|299-306 |  8 |Swell Height         |swellheight|U1|0-25m: units 0.1m,
                                                   251 = height >= 25.1m,
                                                   255 = N/A (default).
|307-312 |  6 |Swell Period         |swellperiod|u|0-60, units 1s
                                                   360 = N/A (default)
|313-321 |  9 |Swell Direction      |swelldir   |u|0-359: true bearing,
                                                   360 = N/A (default)
|322-325 |  4 |Sea State            |seastate   |e|See "Beaufort scale"
|326-335 | 10 |Water Temperature    |watertemp  |I1|-10.0 to 50.0 C:
                                                   units 0.1 deg,
                                                   501 = N/A (default)
|336-338 |  3 |Precipitation        |preciptype  |e|See "Precipitation type"
|339-347 |  9 |Salinity             |salinity   |U1|0.0-50.0%: units of 0.1%
                                                   501 = salinity >= 50.1%
                                                   510 = N/A (default)
                                                   511 = sensor not available
|348-349 |  2 |Ice                  |ice        |u| 0 = No
                                                    1 = Yes
                                                    2 = (reserved for future use)
                                                    3 = not available = default
|350-359 | 10 |Spare                |           |x|Not used
|==============================================================================

Precipitation types and Beaufort scale are as for the <<IMO236>> version.

==== Inland ship static and voyage related data (Inland AIS) ====

A message 8 subtype. DAC = 200 FID = 10. Fixed length, 168 bits.

This message should be used by inland vessels only to broadcast ship
static and voyage related data in addition to message 5. The message
should be sent as soon as possible (from the AIS point of view) after
message 5.

//: Type 8(200/10)
[frame="topbot",options="header"]
|===============================================================================
|Field   |Len |Description            |Member   |T|Units
|0-5     |  6 |Message Type           |type     |u|Constant: 8
|6-7     |  2 |Repeat Indicator       |repeat   |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI            |mmsi     |u|9 decimal digits
|38-39   |  2 |Spare                  |         |x|Not used
|40-49   | 10 |Designated Area Code   |dac      |u|Constant: 200
|50-55   |  6 |Functional ID          |fid      |u|Constant: 10
|56-103  | 48 |European Vessel ID     |vin      |t|8 six-bit characters
|104-116 | 13 |Length of ship         |length   |u|1-8000 * 0.1m, default 0
|117-126 | 10 |Beam of ship           |beam     |u|1-1000 * 0.1m, default 0
|127-140 | 14 |Ship/combination type  |shiptype |e|ERI Classification
|141-143 |  3 |Hazardous cargo        |hazard   |e|See "Hazard Codes" below
|144-154 | 11 |Draught                |draught  |u|1-200 * 0.01m, default 0
|155-156 |  2 |Loaded/Unloaded        |loaded   |e|See "Load Status" below
|157-157 |  1 |Speed inf. quality     |speed_q  |b|0 = low/GNSS (default)
                                                   1 = high
|158-158 |  1 |Course inf. quality    |course_q |b|0 = low/GNSS (default)
                                                   1 = high
|159-159 |  1 |Heading inf. quality   |heading_q|b|0 = low/GNSS (default)
                                                   1 = high
|160-167 |  8 |Spare                  |         |x|Not used
|==============================================================================

OPEN-QUESTION: <<INLAND>> is not explicit whether the
"Ship/combination type" field is to contain full ERI codes with range
8000-8370 or ERI SOLAS codes in the range 1-99.  The tables below
expand both.  Full ERI codes have been observed in the wild.

.ERI Classification
[frame="topbot",options="header"]
|==============================================================================
|Code | SOLAS | Description
|8000 |  99   | Vessel, type unknown
|8010 |  79   | Motor freighter
|8020 |  89   | Motor tanker
|8021 |  80   | Motor tanker, liquid cargo, type N
|8022 |  80   | Motor tanker, liquid cargo, type C
|8023 |  89   | Motor tanker, dry cargo as if liquid (e.g. cement)
|8030 |  79   | Container vessel
|8040 |  80   | Gas tanker
|8050 |  79   | Motor freighter, tug
|8060 |  89   | Motor tanker, tug
|8070 |  79   | Motor freighter with one or more ships alongside
|8080 |  89   | Motor freighter with tanker
|8090 |  79   | Motor freighter pushing one or more freighters
|8100 |  89   | Motor freighter pushing at least one tank-ship
|8110 |  79   | Tug, freighter
|8120 |  89   | Tug, tanker
|8130 |  31   | Tug freighter, coupled
|8140 |  31   | Tug, freighter/tanker, coupled
|8150 |  99   | Freightbarge
|8160 |  99   | Tankbarge
|8161 |  90   | Tankbarge, liquid cargo, type N
|8162 |  90   | Tankbarge, liquid cargo, type C
|8163 |  99   | Tankbarge, dry cargo as if liquid (e.g. cement)
|8170 |  99   | Freightbarge with containers
|8180 |  90   | Tankbarge, gas
|8210 |  79   | Pushtow, one cargo barge
|8220 |  79   | Pushtow, two cargo barges
|8230 |  79   | Pushtow, three cargo barges
|8240 |  79   | Pushtow, four cargo barges
|8250 |  79   | Pushtow, five cargo barges
|8260 |  79   | Pushtow, six cargo barges
|8270 |  79   | Pushtow, seven cargo barges
|8280 |  79   | Pushtow, eight cargo barges
|8290 |  79   | Pushtow, nine or more barges
|8310 |  80   | Pushtow, one tank/gas barge
|8320 |  80   | Pushtow, two barges at least one tanker or gas barge
|8330 |  80   | Pushtow, three barges at least one tanker or gas barge
|8340 |  80   | Pushtow, four barges at least one tanker or gas barge
|8350 |  80   | Pushtow, five barges at least one tanker or gas barge
|8360 |  80   | Pushtow, six barges at least one tanker or gas barge
|8370 |  80   | Pushtow, seven barges at least one tanker or gas barge
|=============================================================================

.SOLAS ship type, first digit
[frame="topbot",options="header"]
|=============================================================================
| 3 | Vessel
| 7 | Cargo ship
| 8 | Tanker
| 9 | Other types of ship
|=============================================================================

.SOLAS ship type, second digit
[frame="topbot",options="header"]
|=============================================================================
| 0 | All ships of this type
| 1 | Towing
| 8 | Tanker
| 9 | No additional information
|=============================================================================

.Hazard code
[frame="topbot",options="header"]
|==============================================================================
| 0 | 0 blue cones/lights
| 1 | 1 blue cone/light
| 2 | 2 blue cones/lights
| 3 | 3 blue cones/lights
| 4 | 4 B-Flag
| 5 | Unknown (default)
|==============================================================================

.Load status
[frame="topbot",options="header"]
|==============================================================================
| 0 | N/A (default)
| 1 | Unloaded
| 2 | Loaded
|==============================================================================

==== EMMA Warning Report (Inland AIS) ====

A message 8 subtype. DAC = 200 FID = 23. Fixed length, 256 bits.

The EMMA warning is sent by base stations to drive shipboard ECDIS
displays of heavy weather conditions. The following message is capable
of transmitting the EMMA data using the AIS channel. It does not
replace the Notices to Skippers warnings.

//: Type 8(200/23)
[frame="topbot",options="header"]
|===============================================================================
|Field   |Len |Description         |Member      |T|Units
|0-5     |  6 |Message Type        |type        |u|Constant: 8
|6-7     |  2 |Repeat Indicator    |repeat      |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI         |mmsi        |u|9 decimal digits
|38-39   |  2 |Spare               |            |x|Not used
|40-49   | 10 |Designated Area Code|dac         |u|Constant: 200
|50-55   |  6 |Functional ID       |fid         |u|Constant: 23
|56-63   |  8 |Start Year          |start_year  |u|1-55, year since 2000
                                                   0 = N/A (default)
|64-67   |  4 |Start Month         |start_month |u|1-12; 0 = N/A (default)
|68-72   |  5 |Start Day           |start_day   |u|1-31; 0 = N/A (default)
|73-80   |  8 |End Year            |end_year    |u|1-55, year since 2000
                                                  0 = N/A (default)
|81-84   |  4 |End Month           |end_month   |u|1-12; 0 = N/A (default)
|85-89   |  5 |End Day             |end_day     |u|1-31; 0 = N/A (default)
|90-94   |  5 |Start Hour          |start_hour  |u|0-23; 24 = N/A (default)
|95-100  |  6 |Start Minute        |start_minute|u|0-59; 60 = N/A (default)
|101-105 |  5 |End Hour            |end_hour    |u|0-23; 24 = N/A (default)
|106-111 |  6 |End Minute          |end_minute  |u|0-59; 60 = N/A (default)
|112-139 | 28 |Start Longitude     |start_lon   |I4|Minutes/10000 (as in CNB)
|140-166 | 27 |Start Latitude      |start_lat   |I4|Minutes/10000 (as in CNB)
|167-194 | 28 |End Longitude       |end_lon     |I4|Minutes/10000 (as in CNB)
|195-221 | 27 |End Latitude        |end_lat     |I4|Minutes/10000 (as in CNB)
|222-225 |  4 |Type                |type        |e|See "EMMA Type Codes" below
|226-234 |  9 |Min value           |min         |i|Signed Integer, see below
|235-243 |  9 |Max value           |max         |i|Signed Integer, see below
|244-245 |  2 |Classification      |intensity   |e|1 = Slight,
                                                   2 = Medium,
                                                   3 = Strong
|246-249 |  4 |Wind Direction      |wind        |e|See "EMMA Winds" below
|250-255 |  6 |Spare               |            |x|Not used
|===============================================================================

OPEN-QUESTION: <<INLAND>> is not explicit about the interpretation of
the longitude and latitude fields; these semantics are assumed here
from 28 and 27-bit fields in other messages.

<<INLAND>> specifies an 8-bit format with 9th leading sign bit for the
min and max fields. Values 0-253 are interpreted as integer data,
modified by the leading sign bit. The values +254 and -254 are
interpreted as "greater that +253" and "less than -253" respectively.
Both values +255 and -255 are interpreted as "unknown" (default).

OPEN-QUESTION: What are the semantics of the min and max values?  To
what parameters do they apply?

OPEN-QUESTION: <<INLAND>> does not specify whether start and end times
are UTC or local.

.EMMA Type Codes
[frame="topbot",options="header"]
|==============================
|  0 | NA | Not Available
|  1 | WI | Wind
|  2 | RA | Rain
|  3 | SN | Snow and ice
|  4 | TH | Thunderstorm
|  5 | FO | Fog
|  6 | LT | Low temperature
|  7 | HT | High temperature
|  8 | FL | Flood
|  9 | FI | Forest Fire
|==============================

.EMMA Winds
[frame="topbot",options="header"]
|==============================
|  1 | N  | North
|  2 | NE | North East
|  3 | E  | East
|  4 | SE | South East
|  5 | S  | South
|  6 | SW | South West
|  7 | W  | West
|  8 | NW | North West
|==============================

==== Water Levels (Inland AIS) ====

A message 6 subtype. DAC = 200 FID = 24. Fixed length, 168 bits.

This message should be used to inform skippers about actual water
levels in their area.  It is additional short-term information to the
water levels distributed via Notices to Skippers. It is possible to
transmit the water levels of more than 4 gauges using multiple
messages.

//: Type 8(200/24)
[frame="topbot",options="header"]
|===============================================================================
|Field   |Len |Description         |Member     |T|Units
|0-5     |  6 |Message Type        |type       |u|Constant: 6
|6-7     |  2 |Repeat Indicator    |repeat     |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI         |mmsi       |u|9 decimal digits
|38-39   |  2 |Spare               |           |x|Not used
|40-49   | 10 |Designated Area Code|dac        |u|Constant: 200
|50-55   |  6 |Functional ID       |fid        |u|Constant: 24
|56-67   | 12 |UN Country Code     |country    |t|2 six-bit characters
|68      |    |                    |gauges     |a4|Gauge measurement array
|0-10    | 11 |Gauge ID            |id         |u|0=unknown (default)
|11-24   | 14 |Water Level         |level      |i|cm, 0=unknown (default)
|===============================================================================

Water levels are relative to the local standard, e.g. GIW in Germany
and RNW on the Danube.

==== Signal Strength (Inland AIS) ====

A message 8 subtype. DAC = 200 FID = 40. Fixed length, 168 bits.

This message should be sent by base stations only, to inform about the
status of different light signals to all vessels in a certain
area. The information should be displayed on an external Inland ECDIS
display as dynamic symbols. The message should be sent with binary
message 8 at regular intervals.

//: Type 8(200/40)
[frame="topbot",options="header"]
|===============================================================================
|Field   |Len |Description         |Member     |T|Units
|0-5     |  6 |Message Type        |type       |u|Constant: 8
|6-7     |  2 |Repeat Indicator    |repeat     |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI         |mmsi       |u|9 decimal digits
|38-39   |  2 |Spare               |           |x|Not used
|40-49   | 10 |Designated Area Code|dac        |u|Constant: 200
|50-55   |  6 |Functional ID       |fid        |u|Constant: 40
|56-83   | 28 |Signal Longitude    |lon        |I4|Minutes/10000 (as in CNB)
|84-110  | 27 |Signal Latitude     |lat        |I4|Minutes/10000 (as in CNB)
|111-114 |  4 |Signal form         |form       |u|Consult <<INLAND>> Annex C
|115-123 |  9 |Signal orientation  |facing     |u|0-39 deg, 511= N/A (default)
|124-126 |  3 |Direction of impact |direction  |e|See "Signal Impact" below
|127-156 | 30 |Light Status        |status     |e|See "Signal Status" below
|157-167 | 11 |Spare               |           |x|Not used
|===============================================================================

OPEN-QUESTION: <<INLAND>> is not explicit about the interpretation of
the longitude and latitude fields; these semantics are assumed here
from 28 and 27-bit fields in other messages.

The Signal Form field describes the physical arrangement of the
signal lights.  Values 0 and 15 indicate the shape is unknown or
unspecified.

//: direction vocabulary
.Direction of Signal Impact
[frame="topbot",options="header"]
|===============================================================================
| 0 | Unknown (default)
| 1 | Upstream
| 2 | Downstream
| 3 | To left bank
| 4 | To right bank
|===============================================================================

The Signal Status field is interpreted as 9 decimal digits describing
the lights as numbered in their Signal Form diagram  - typically left
to right and then top to bottom - with each digit interpreted in the
following way:

//: status vocabulary
.Signal Status
[frame="topbot",options="header"]
|===============================================================================
| 0 | Unknown (default)
| 1 | No light
| 2 | White
| 3 | Yellow
| 4 | Green
| 5 | Red
| 6 | White flashing
| 7 | Yellow flashing.
|===============================================================================

=== Type 9: Standard SAR Aircraft Position Report ===

Tracking information for search-and-rescue aircraft.  Total number of
bits is 168.

//: Type 9
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member     |T|Encoding
|0-5     | 6  |Message Type       |type       |u|Constant: 9
|6-7     | 2  |Repeat Indicator   |repeat     |u|As in Common Navigation Block
|8-37    |30  |MMSI               |mmsi       |u|9 decimal digits
|38-49   |12  |Altitude           |alt        |u|See below
|50-59   |10  |SOG                |speed      |u|See below
|60-60   | 1  |Position Accuracy  |accuracy   |u|See below
|61-88   |28  |Longitude          |lon        |I4|Minutes/10000 (as in CNB)
|89-115  |27  |Latitude           |lat        |I4|Minutes/10000 (as in CNB)
|116-127 |12  |Course Over Ground |course     |U1|True bearing, 0.1 degree units
|128-133 | 6  |Time Stamp         |second     |u|UTC second.
|134-141 | 8  |Regional reserved  |regional   |x|Reserved
|142-142 | 1  |DTE                |dte        |b|0=Data terminal ready,
                                                 1=Data terminal not ready (default)
|143-145 | 3  |Spare              |           |x|Not used
|146-146 | 1  |Assigned           |assigned   |b|Assigned-mode flag
|147-147 | 1  |RAIM flag          |raim       |b|As for common navigation block
|148-167 |20  |Radio status       |radio      |u|See <<IALA>> for details.
|==============================================================================

Altitude is in meters.  The special value 4095 indicates altitude is
not available; 4094 indicates 4094 meters or higher.

Speed over ground is in knots, not deciknots as in the common
navigation block; planes go faster. The special value 1023 indicates
speed not available, 1022 indicates 1022 knots or higher.

Position Accuracy, Longitude, Latitude, and Course over Ground
are encoded identically as in the common navigation block and
are even at the same bit offsets.  Time stamp has the same special
values as in the common navigation block, but is at a different offset.

=== Type 10: UTC/Date Inquiry ===

Request for UTC/Date information from an AIS base station. Total
number of bits is 72.

//: Type 10
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member     |T|Encoding
|0-5     | 6  |Message Type       |type       |u|Constant: 10
|6-7     | 2  |Repeat Indicator   |repeat     |u|As in Common Navigation Block
|8-37    |30  |Source MMSI        |mmsi       |u|9 decimal digits
|38-39   | 2  |Spare              |           |x|Not used
|40-69   |30  |Destination MMSI   |dest_mmsi  |u|9 decimal digits
|70-71   | 2  |Spare              |           |x|Not used
|==============================================================================

=== Type 11: UTC/Date Response ===

Identical to message 4, with the semantics of a response to inquiry.

=== Type 12: Addressed Safety-Related Message ===

This is a point-to-point text message.  The payload is interpreted as
six-bit text.  This message is variable in length up to a maximum of
1008 bits (up to 5 AIVDM sentence payloads).

//: Type 12
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member      |T|Units
|0-5     |  6 |Message Type       |type        |u|Constant: 12
|6-7     |  2 |Repeat Indicator   |repeat      |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI        |mmsi        |u|9 decimal digits
|38-39   |  2 |Sequence Number    |seqno       |u|Unsigned integer 0-3
|40-69   | 30 |Destination MMSI   |dest_mmsi   |u|9 decimal digits
|70      |  1 |Retransmit flag    |retransmit  |b|0 = no retransmit (default),
                                                  1 = retransmitted
|71      |  1 |Spare              |            |x|Not used
|72      |936 |Text               |text        |t|1-156 chars of six-bit text.
                                                  May be shorter than 936 bits.
|==============================================================================

Pragmatic note: On <<<AISHUB>>> the actual content of these messages is
highly variable, ranging from fairly plain English ("PLEASE REPORT TO
JOBOURG TRAFFIC CHANNEL 13") through snippets of tabular data ("PAX
589 FG 36 IX 74 MOTO 10 CREW 108+1" through what look like opaque
commercial codes ("EP285 IX46 FG3 DK8 PL56") to empty strings and
content that looks like line noise ("]XFD5D/\7`>PA!Q DX0??K?8?>D").

Such apparently garbled content does *not* mean there is an error in
your decoder. It may indicate faulty encoders, operator error, or even
the use of private encodings for non-ASCII character sets.

=== Type 13: Safety-Related Acknowledgement ===

Message type 13 is a receipt acknowledgement to senders of
previous messages of type 12.  The message layout is identical to
a type 7 Binary Acknowledge.

=== Type 14: Safety-Related Broadcast Message ===

This is a broadcast text message.  The payload is interpreted as
six-bit text.  This message is variable in length up to a maximum of
1008 bits (up to 5 AIVDM sentence payloads).

//: Type 14
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member    |T|Units
|0-5     |  6 |Message Type       |type      |u|Constant: 14
|6-7     |  2 |Repeat Indicator   |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI        |mmsi      |u|9 decimal digits
|38-39   |  2 |Spare              |          |x|Not used
|40      |968 |Text               |text      |t|1-161 chars of six-bit text.
                                                May be shorter than 968 bits.
|==============================================================================

Note: 161 * 6 = 966. <<IALA>> specifies 968 because over-the-air
messages are required to be padded to an 8-bit byte boundary by
<<<ITU1371>>>.

Also see the pragmatic note on message content attached to type 12; it
applies to type 14 messages as well.

=== Type 15: Interrogation ===

Message type 15 is used by a base station to query one or two other AIS
transceivers for status messages of specified types. "Source MMSI" is
the interrogating station.  88-160 bits depending on the number of queries.

This message is probably not interesting unless you are doing traffic
analysis of information flow in an AIS station network.  The "slot offset"
members are a request for the response to interrogation to occupy
a particular time division in the TDMA packet layer.

//: Type 15
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description         |Member    |T|Units
|0-5     |  6 |Message Type        |type      |u|Constant: 15
|6-7     |  2 |Repeat Indicator    |repeat    |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI         |mmsi      |u|9 decimal digits
|38-39   |  2 |Spare               |          |x|Not used
|40-69   | 30 |Interrogated MMSI   |mmsi1     |u|9 decimal digits
|70-75   |  6 |First message type  |type1_1   |u|Unsigned integer
|76-87   | 12 |First slot offset   |offset1_1 |u|Unsigned integer
|88-89   |  2 |Spare               |          |x|Not used
|90-95   |  6 |Second message type |type1_2   |u|Unsigned integer
|96-107  | 12 |Second slot offset  |offset1_2 |u|Unsigned integer
|108-109 |  2 |Spare               |          |x|Not used
|110-139 | 30 |Interrogated MMSI   |mmsi2     |u|9 decimal digits
|140-145 |  6 |First message type  |type2_1   |u|Unsigned integer
|146-157 | 12 |First slot offset   |offset2_1 |u|Unsigned integer
|158-159 |  2 |Spare               |          |x|Not used
|==============================================================================

There are four use cases for this message.  A decoder must dispatch on
the length of the data packet to determine which it is seeing:

1. One station is interrogated for one message type.  Length is 88 bits.

2. One station is interrogated for two message types, Length is 110
bits. There is a design error in the standard here; according to the
<<<ITU1371>>> requirement for padding to 8 bits, this should have been
112 with a 4-bit trailing spare field, and decoders should be prepared
to handle that length as well. See the discussion of byte alignment
elsewhere in this document for context.

3. Two stations are interrogated for one message type each. Length is
160 bits.  The second message type and second slot offset associated
with the first queried MMSI should be zeroed.

4. One station is interrogated for two message types, and a second for
one message type.  Length is 160 bits.

=== Type 16: Assignment Mode Command ===

Message type 16 is used by a base station with control authority to
configure the scheduling of AIS informational messages from
subordinate stations, either as a frequency per 10-minute interval or
by specifying the TDMA slot(s) offset on which those messages should
be transmitted.  It is probably not of interest unless you are
studying the internal operation of an AIS base station network.
Length may be 96 or 144 bits.

//: Type 16
[frame="topbot",options="header"]
|============================================================================
|Field   |Len |Description         |Member     |T|Units
|0-5     |  6 |Message Type        |type       |u|Constant: 16
|6-7     |  2 |Repeat Indicator    |repeat     |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI         |mmsi       |u|9 decimal digits
|38-39   |  2 |Spare               |           |x|Not used
|40-69   | 30 |Destination A MMSI  |mmsi1      |u|9 decimal digits
|70-81   | 12 |Offset A            |offset1    |u|See <<IALA>>
|82-91   | 10 |Increment A         |increment1 |u|See <<IALA>>
|92-121  | 30 |Destination B MMSI  |mmsi2      |u|9 decimal digits
|122-133 | 12 |Offset B            |offset2    |u|See <<IALA>>
|134-143 | 10 |Increment B         |increment2 |u|See <<IALA>>
|=============================================================================

If the message is 96 bits long, it should be interpreted as an
assignment for a single station (92 bits) followed by 4 bits of
padding reserved for future use. If the message is 144 bits long it
should be interpreted as a channel assignment for two stations; no
padding follows.

When increment is zero, the offset field is interpreted as the
frequency with which the subordinate station should report per
10-minute interval. When increment is nonzero, reporting interval
is specified at the level of TDMA slot numbers; see <<IALA>> for the
detailed specification.

Note: While the 96-bit form of Type 16 is not uncommon, the 144-bit
form is extremely rare. As of March 2010 it has not been observed even
in long-duration samples from AISHub.

=== Type 17: DGNSS Broadcast Binary Message ===

Message type 17 is used to broadcast differential corrections for GPS.
The data in the payload is intended to be passed directly to GPS
receivers capable of accepting such corrections. 80 to 816 bits
depending on payload size.

//: Type 17
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description         |Member     |T|Units
|0-5     |  6 |Message Type        |type       |u|Constant: 17
|6-7     |  2 |Repeat Indicator    |repeat     |u|As in Common Navigation Block
|8-37    | 30 |Source MMSI         |mmsi       |u|9 decimal digits
|38-39   |  2 |Spare               |           |x|Not used
|40-57   | 18 |Longitude           |lon        |I1|Signed: minutes/10
|58-74   | 17 |Latitude            |lat        |I1|Signed: minutes/10
|75-79   |  5 |Spare               |           |x|Not used - reserved
|80-815  |736 |Payload             |data       |d|DGNSS correction data
|==============================================================================

Note that latitude and longitude are in units of a tenth of a minute;
sign interpretation and out-of-band values are as in the Common
Navigation Clock.  (Note, however, that the hex representation of
the out-of-band values differs; it is 181 \* 60 \* 10 = 0x1a838 for
longitude, 91 \* 60 \* 10 = 0xd548 for latitude.)

The <<IALA>> description of the payload portion subfields has been
omitted, as it appears to be tied to the now obsolete RTCM2 protocol.

=== Type 18: Standard Class B CS Position Report ===

A less detailed report than types 1-3 for vessels using Class B
transmitters.  Omits navigational status and rate of turn.  Fields are
encoded as in the common navigation block.  168 bits total.

In <<IALA>> (and <<ITU1371>>) bits 141-145 were designated "Spare"; the
bit-flag semantics given here are from ITU-1371-3 and were
communicated by Kurt Schwehr.  Kurt warns that "the spec does not do a
good job of explaining these fields... I don't think that I totally
understand these fields."

//: Type 18
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description        |Member   |T|Units
|0-5     | 6  |Message Type       |type     |u|Constant: 18
|6-7     | 2  |Repeat Indicator   |repeat   |u|As in Common Navigation Block
|8-37    |30  |MMSI               |mmsi     |u|9 decimal digits
|38-45   | 8  |Regional Reserved  |reserved |x|Not used
|46-55   |10  |Speed Over Ground  |speed    |U1|As in common navigation block
|56-56   | 1  |Position Accuracy  |accuracy |b|See below
|57-84   |28  |Longitude          |lon      |I4|Minutes/10000 (as in CNB)
|85-111  |27  |Latitude           |lat      |I4|Minutes/10000 (as in CNB)
|112-123 |12  |Course Over Ground |course   |U1|0.1 degrees from true north
|124-132 | 9  |True Heading       |heading  |u|0 to 359 degrees, 511 = N/A
|133-138 | 6  |Time Stamp         |second   |u|Second of UTC timestamp.
|139-140 | 2  |Regional reserved  |regional |u|Uninterpreted
|141-141 | 1  |CS Unit            |cs       |b|0=Class B SOTDMA unit
                                               1=Class B CS (Carrier Sense) unit
|142-142 | 1  |Display flag       |display  |b|0=No visual display,
                                               1=Has display,
                                               (Probably not reliable).
|143-143 | 1  |DSC Flag           |dsc      |b|If 1, unit is attached to a VHF
                                               voice radio with DSC capability.
|144-144 | 1  |Band flag          |band     |b|Base stations can command units
                                               to switch frequency. If this flag
                                               is 1, the unit can use any part
                                               of the marine channel.
|145-145 | 1  |Message 22 flag    |msg22    |b|If 1, unit can accept a channel
                                               assignment via Message Type 22.
|146-146 | 1  |Assigned           |assigned |b|Assigned-mode flag:
                                               0 = autonomous mode (default),
                                               1 = assigned mode.
|147-147 | 1  |RAIM flag          |raim     |b|As for common navigation block
|148-167 |20  |Radio status       |radio    |u|See <<IALA>> for details.
|==============================================================================

The radio status is 20 bits rather than 19 because an extra first bit
selects whether it should be interpreted as a SOTDMA or ITDMA state.

=== Type 19: Extended Class B CS Position Report ===

A slightly more detailed report than type 18 for vessels using Class B
transmitters.  Omits navigational status and rate of turn.  Fields are
encoded as in the common navigation block and the Type 5 message.
Note that until just before the reserved field at bit 139 this is
identical to message 18.  312 bits total.

In practice, the information in the ship name and dimension fields is
not reliable, as it has to be hand-entered by humans rather than
gathered automatically from sensors.

//: Type 19
[frame="topbot",options="header"]
|==============================================================================
|Field    |Len |Description            |Member       |T|Units
|0-5      |  6 |Message Type           |type         |u|Constant: 19
|6-7      |  2 |Repeat Indicator       |repeat       |u|As in CNN
|8-37     | 30 |MMSI                   |mmsi         |u|9 digits
|38-45    |  8 |Regional Reserved      |reserved     |u|
|46-55    | 10 |Speed Over Ground      |speed        |U1|As in CNB.
|56-56    |  1 |Position Accuracy      |accuracy     |b|As in CNB.
|57-84    | 28 |Longitude              |lon          |I4|Minutes/10000 (as in CNB)
|85-111   | 27 |Latitude               |lat          |I4|Minutes/10000 (as in CNB)
|112-123  | 12 |Course Over Ground     |course       |U1|Relative to true north,
                                                        units of 0.1 degrees
|124-132  |  9 |True Heading           |heading      |u|0 to 359 degrees,
                                                        511 = N/A
|133-138  |  6 |Time Stamp             |second       |u|Second of UTC timestamp.
|139-142  |  4 |Regional reserved      |regional     |u|Uninterpreted
|143-262  |120 |Name                   |shipname     |s|20 6-bit characters
|263-270  |  8 |Type of ship and cargo |shiptype     |u|As in Message 5
|271-279  |  9 |Dimension to Bow       |to_bow       |u|Meters
|280-288  |  9 |Dimension to Stern     |to_stern     |u|Meters
|289-294  |  6 |Dimension to Port      |to_port      |u|Meters
|295-300  |  6 |Dimension to Starboard |to_starboard |u|Meters
|301-304  |  4 |Position Fix Type      |epfd         |e|See "EPFD Fix Types"
|305-305  |  1 |RAIM flag              |raim         |b|As in CNB.
|306-306  |  1 |DTE                    |dte          |b|0=Data terminal ready,
                                                       1=Not ready (default).
|307-307  |  1 |Assigned mode flag     |assigned     |u|See <<IALA>> for details
|308-311  |  4 |Spare                  |             |x|Unused, should be zero
|==============================================================================

=== Type 20 Data Link Management Message ===

This message is used to pre-allocate TDMA slots within an AIS base
station network.  It contains no navigational information, and is
unlikely to be of interest unless you are implementing or studying
an AIS base station network. Length varies from 72-160 depending on
the number of slot reservations (1 to 4) in the message.

//: Type 20
[frame="topbot",options="header"]
|===============================================================================
|Field    |Len |Description       |Member      |T|Units
|0-5      | 6  |Message Type      |type        |u|Constant: 20
|6-7      | 2  |Repeat Indicator  |repeat      |u|As in CNB
|8-37     |30  |MMSI              |mmsi        |u|9 decimal digits
|38-39    | 2  |Spare             |            |x|Not used
|40-51    |12  |Offset number 1   |offset1     |u|Reserved offset number
|52-55    | 4  |Reserved slots    |number1     |u|Consecutive slots
|56-58    | 3  |Time-out          |timeout1    |u|Allocation timeout in minutes
|59-69    |11  |Increment         |increment1  |u|Repeat increment
|70-81    |12  |Offset number 2   |offset2     |u|Reserved offset number
|82-85    | 4  |Reserved slots    |number2     |u|Consecutive slots
|86-88    | 3  |Time-out          |timeout2    |u|Allocation timeout in minutes
|89-99    |11  |Increment         |increment2  |u|Repeat increment
|100-111  |12  |Offset number 3   |offset3     |u|Reserved offset number
|112-115  | 4  |Reserved slots    |number3     |u|Consecutive slots
|116-118  | 3  |Time-out          |timeout3    |u|Allocation timeout in minutes
|119-129  |11  |Increment         |increment3  |u|Repeat increment
|130-141  |12  |Offset number 4   |offset4     |u|Reserved offset number
|142-145  | 4  |Reserved slots    |number4     |u|Consecutive slots
|146-148  | 3  |Time-out          |timeout4    |u|Allocation timeout in minutes
|149-159  |11  |Increment         |increment4  |u|Repeat increment
|===============================================================================

See <<IALA>> for details on the meaning of these fields.

=== Type 21: Aid-to-Navigation Report ===

Identification and location message to be emitted by aids to
navigation such as buoys and lighthouses.

This message is unusual in that it varies in length depending on the
presence and size of the Name Extension field. May vary between 272
and 360 bits.

//: Type 21
[frame="topbot",options="header"]
|==============================================================================
|Field    |Len |Description            |Member      |T|Units
|0-5      | 6  |Message Type           |type        |u|Constant: 21
|6-7      | 2  |Repeat Indicator       |repeat      |u|As in CNB
|8-37     |30  |MMSI                   |mmsi        |u|9 digits
|38-42    | 5  |Aid type               |aid_type    |e|See "Navaid Types"
|43-162  1|120 |Name                   |name        |t|Name in sixbit chars
|163-163  | 1  |Position Accuracy      |accuracy    |b|As in CNB
|164-191  |28  |Longitude              |lon         |I4|Minutes/10000 (as in CNB)
|192-218  |27  |Latitude               |lat         |I4|Minutes/10000 (as in CNB)
|219-227  | 9  |Dimension to Bow       |to_bow      |u|Meters
|228-236  | 9  |Dimension to Stern     |to_stern    |u|Meters
|237-242  | 6  |Dimension to Port      |to_port     |u|Meters
|243-248  | 6  |Dimension to Starboard |to_starboard|u|Meters
|249-252  | 4  |Type of EPFD           |epfd        |e|As in Message Type 4
|253-258  | 6  |UTC second             |second      |u|As in Message Types 1-3
|259-259  | 1  |Off-Position Indicator |off_position|b|See Below
|260-267  | 8  |Regional reserved      |regional    |u|Uninterpreted
|268-268  | 1  |RAIM flag              |raim        |b|As in CNB
|269-269  | 1  |Virtual-aid flag       |virtual_aid |b|See Below
|270-270  | 1  |Assigned-mode flag     |assigned    |b|See <<IALA>> for details
|271-271  | 1  |Spare                  |            |x|Not used
|272-360  |88  |Name Extension         |            |t|See Below
|==============================================================================

According to <<IALA>>, the aid type field has values 1-15 for fixed
and 16-31 for floating aids to navigation.  The detailed list is as follows:

.Navaid Types
[frame="topbot",options="header"]
|====================================================================
|Code |Definition
|0    |Default, Type of Aid to Navigation not specified
|1    |Reference point
|2    |RACON (radar transponder marking a navigation hazard)
|3    |Fixed structure off shore, such as oil platforms, wind farms,
|      rigs. (Note: This code should identify an obstruction that is
|      fitted with an Aid-to-Navigation AIS station.)
|4    |Spare, Reserved for future use.
|5    |Light, without sectors
|6    |Light, with sectors
|7    |Leading Light Front
|8    |Leading Light Rear
|9    |Beacon, Cardinal N
|10   |Beacon, Cardinal E
|11   |Beacon, Cardinal S
|12   |Beacon, Cardinal W
|13   |Beacon, Port hand
|14   |Beacon, Starboard hand
|15   |Beacon, Preferred Channel port hand
|16   |Beacon, Preferred Channel starboard hand
|17   |Beacon, Isolated danger
|18   |Beacon, Safe water
|19   |Beacon, Special mark
|20   |Cardinal Mark N
|21   |Cardinal Mark E
|22   |Cardinal Mark S
|23   |Cardinal Mark W
|24   |Port hand Mark
|25   |Starboard hand Mark
|26   |Preferred Channel Port hand
|27   |Preferred Channel Starboard hand
|28   |Isolated danger
|29   |Safe Water
|30   |Special Mark
|31   |Light Vessel / LANBY / Rigs
|====================================================================

The name field is up to 20 characters of 6-bit ASCII.  If this field
is full (has no trailing @ characters) the decoder should interpret
the Name Extension field later in the message (no more than 14 6-bit
characters) and concatenate it to this one to obtain the full name.

<<IALA>> describes bits 219-248 As "Dimension/Reference for Position",
implying that it is vessel dimensions as in message type 5.

The Off-Position Indicator is for floating Aids-to-Navigation only: 0
means on position; 1 means off position. Only valid if UTC second is equal to
or below 59.

The Virtual Aid flag is interpreted as follows: 0 = default = real Aid
to Navigation at indicated position; 1 = virtual Aid to
Navigation simulated by nearby AIS station.

If present, the Name Extension consists of packed six-bit ASCII
characters followed by 0-6 bits of padding to an 8-bit boundary. The
<<IALA>> description says "This parameter should be omitted when no
more than 20 characters for the name of the A-to-N are needed in
total. Only the required number of characters should be transmitted,
i.e. no @-character should be used."  A decoder can deduce the bit length
of the name extension field by subtracting 272 from the total message
bit length.

=== Type 22: Channel Management ===

This message is broadcast by a competent authority (an AIS network
control base station) to set VHF parameters for an AIS coverage
region.  Length is 168 bits.

This message contains no navigational information, and is unlikely to be of
interest unless you are implementing or studying an AIS base station
network.

//: Type 22
[frame="topbot",options="header"]
|==============================================================================
|Field    |Len |Description      |Member    |T|Units
|0-5      | 6  |Message Type     |type      |u|Constant: 22
|6-7      | 2  |Repeat Indicator |repeat    |u|As in Common Navigation Block
|8-37     |30  |MMSI             |mmsi      |u|9 decimal digits
|38-39    | 2  |Spare            |          |x|Not used
|40-51    |12  |Channel A        |channel_a |u|Channel number
|52-63    |12  |Channel B        |channel_b |u|Channel number
|64-67    | 4  |Tx/Rx mode       |txrx      |u|Transmit/receive mode
|68-68    | 1  |Power            |power     |b|Low=0, high=1
|69-86    |18  |NE Longitude     |ne_lon    |I1|NE longitude to 0.1 minutes
|87-103   |17  |NE Latitude      |ne_lat    |I1|NE latitude to 0.1 minutes
|104-121  |18  |SW Longitude     |sw_lon    |I1|SW longitude to 0.1 minutes
|122-138  |17  |SW Latitude      |sw_lat    |I1|SW latitude to 0.1 minutes
|69-98    |30  |MMSI1            |dest1     |u|MMSI of destination 1
|104-133  |30  |MMSI2            |dest2     |u|MMSI of destination 2
|139-139  | 1  |Addressed        |addressed |b|0=Broadcast, 1=Addressed
|140-140  | 1  |Channel A Band   |band_a    |b|0=Default, 1=12.5kHz
|141-141  | 1  |Channel B Band   |band_b    |b|0=Default, 1=12.5kHz
|142-144  | 3  |Zone size        |zonesize  |u|Size of transitional zone
|145-167  |23  |Spare            |          |x|Reserved for future use
|==============================================================================

The values of the channel_a and channel_b fields are ITU frequency
designators for channels A and B. Normally these will be 2087 and
2088, the AIS 1 and AIS 2 frequencies of 87B (161.975 MHz) and 88B
(162.025 MHz) respectively. Regional authorities may set different
frequencies.

The txrx field encodes the same information as the 2-bit field txrx
field in message type 23; only the two low bits are used.

The power bit instructs designated receivers which power level to use.

If the message is broadcast (addressed field is 0), the ne_lon,
ne_lat, sw_lon, and sw_lat fields are the corners of a rectangular
jurisdiction area over which control parameters are to be set.  If it
is addressed (addressed field is 1), the same span of data is
interpreted as two 30-bit MMSIs beginning at at bit offsets 69 and 104
respectively.

Yes, the addressed bit is *after* the fields it controls the
interpretation of.

Note that the 'not available' values for longitude and latitudes
match the short ones used in message 17, not the long ones used in the
common navigation block and elsewhere.

The band fields control channel bandwidth for channels A and B, and
the zonesize field describes the size of the transition zone around the
control jurisdiction. The semantics of these fields are complicated,
controlling transmitter behavior as it moves between jurisdictions;
see <<IALA>> for full details.

=== Type 23: Group Assignment Command ===

This message is intended to be broadcast by a competent authority (an
AIS network-control base station) to set operational parameters for
all mobile stations in an AIS coverage region. Length is 160 bits.

This message contains no navigational information, and is unlikely to
be of interest unless you are implementing or studying an AIS base
station network.

//: Type 23
[frame="topbot",options="header"]
|==============================================================================
|Field    |Len |Description      |Member       |T|Units
|0-5      | 6  |Message Type     |type         |u|Unsigned Integer: 23
|6-7      | 2  |Repeat Indicator |repeat       |u|As in Common Navigation Block
|8-37     |30  |MMSI             |mmsi         |u|Unsigned Integer: 9 digits
|38-39    | 2  |Spare            |             |x|Not used
|40-57    |18  |NE Longitude     |ne_lon       |u|Same as broadcast type 22
|58-74    |17  |NE Latitude      |ne_lat       |u|Same as broadcast type 22
|75-92    |18  |SW Longitude     |sw_lon       |u|Same as broadcast type 22
|93-109   |17  |SW Latitude      |sw_lat       |u|Same as broadcast type 22
|110-113  | 4  |Station Type     |station_type |e|See "Station Types"
|114-121  | 8  |Ship Type        |ship_type    |e|See "Ship Types"
|122-143  |22  |Spare            |             |x|Not used
|144-145  | 2  |Tx/Rx Mode       |txrx         |u|See "Tranmit/Recieve Modes"
|146-149  | 4  |Report Interval  |interval     |e|See "Station Intervals"
|150-153  | 4  |Quiet Time       |quiet        |u|0 = none, 1-15 quiet time in minutes
|154-159  | 6  |Spare            |             |x|Not used
|==============================================================================

The target set of mobile stations is specified by the station-type and
ship-type fields. An addressed (non-broadcast) message 22 overrides a
message 23, but a message 23 overrides a broadcast message 22.

Note that the 'not available' values for longitude and latitudes
match the short ones used in messages 17 and 22, not the long ones
used in the common navigation block and elsewhere.

The txrx field tells the affected stations which channel or
channels they may transmit on.  The options refer to the same A and B
VHF channels as in Message Type 22. The field is interpreted as follows:

.Transmit Modes
[width="25%",frame="topbot"]
|===================================
|0 = |TxA/TxB, RxA/RxB (default)
|1 = |TxA, RxA/RxB
|2 = |TxB, RxA/RxB
|3 = |Reserved for Future Use
|===================================

.Station Types
[width="50%",frame="topbot"]
|======================================================
|0     |All types of mobiles (default)
|1     |Reserved for future use
|2     |All types of Class B mobile stations
|3     |SAR airborne mobile station
|4     |Aid to Navigation station
|5     |Class B shipborne mobile station (IEC62287 only)
|6-9   |Regional use and inland waterways
|10-15 |Reserved for future use
|======================================================

<<INLAND>> specifies 6 (only) as the station type value for inland
waterways, reserving 7-9 for (other) regional uses.

Reporting Interval is a 4 bit unsigned integer, how often to report
while within the area specified by this message. When the dual-channel
operation is suspended by Tx/Rx mode command 1 or 2, the reporting
interval is twice the interval given in the table.

.Station Intervals
[width="50%",frame="topbot"]
|======================================================
|0     |As given by the autonomous mode
|1     |10 Minutes
|2     |6 Minutes
|3     |3 Minutes
|4     |1 Minute
|5     |30 Seconds
|6     |15 Seconds
|7     |10 Seconds
|8     |5 Seconds
|9     |Next Shorter Reporting Interval
|10    |Next Longer Reporting Interval
|11-15 |Reserved for future use
|======================================================

Quiet Time is a 4 bit unsigned integer specifying how many minutes
affected stations are to remain silent. If a class B station receives
a quiet time command, it will continue to schedule nominal
transmission time periods, but is not to transmit message 18 or 24
during the quiet period.

=== Type 24: Static Data Report  ===

Equivalent of a Type 5 message for ships using Class B equipment.  Also
used to associate an MMSI with a name on either class A or class B equipment.

A "Type 24" may be in part A or part B format; According to the
standard, parts A and B are expected to be broadcast in adjacent
pairs; in the real world they may (due to quirks in various
aggregation methods) be separated by other sentences or even
interleaved with different Type 24 pairs; decoders must cope with
this.  The interpretation of some fields in Type B format changes
depending on the range of the Type B MMSI field. 160 bits for part A,
168 bits for part B.

According to the standard, both the A and B parts are supposed to
be 168 bits. However, in the wild, A parts are often transmitted
with only 160 bits, omitting the 'spare' 7 bits at the end.
Implementers should be permissive about this.

<<IALA>> does not describe this message type; format information
is thanks to Kurt Schwehr.

//: Type 24
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len |Description            | Member         |T|Units
|0-5     |  6 | Message Type          | type           |u|Constant: 24
|6-7     |  2 | Repeat Indicator      | repeat         |u|As in CNB
|8-37    | 30 | MMSI                  | mmsi           |u|9 digits
|38-39   |  2 | Part Number           | partno         |u|0-1
|40-159  |120 | Vessel Name           | shipname       |t|(Part A) 20 sixbit chars
|160-167 |  8 | Spare                 |                |x|(Part A) Not used
|40-47   |  8 | Ship Type             | shiptype       |e|(Part B) See "Ship Types"
|48-65   | 18 | Vendor ID             | vendorid       |t|(Part B) 3 six-bit chars
|66-69   |  4 | Unit Model Code       | model          |u|(Part B)
|70-89   | 20 | Serial Number         | serial         |u|(Part B)
|90-131  | 42 | Call Sign             | callsign       |t|(Part B) As in Message Type 5
|132-140 |  9 | Dimension to Bow      | to_bow         |u|(Part B) Meters
|141-149 |  9 | Dimension to Stern    | to_stern       |u|(Part B) Meters
|150-155 |  6 | Dimension to Port     | to_port        |u|(Part B) Meters
|156-161 |  6 | Dimension to Starboard| to_starboard   |u|(Part B) Meters
|132-161 | 30 | Mothership MMSI       | mothership_mmsi|u|(Part B) See below
|162-167 |  6 | Spare                 |                |x|(Part B) Not used
|===============================================================================

If the Part Number field is 0, the rest of the message is interpreted
as a Part A; if it is 1, the rest of the message is interpreted
as a Part B; values 2 and 3 are not allowed.

Bits 48-89 are as described in ITU-R 1371-4.  In earlier versions to
1371-3 this was one sixbit-encoded 42-bit (7-character) string field,
the name of the AIS equipment vendor.  The last 4 characters of
the string are reinterpreted as a model/serial numeric pair. It is not
clear that field practice has caught up with this incompatible change.
Implementations would be wise to decode that but span in both ways and
trust human eyes to detect when the final 4 characters of the string
or the model and serial fields are garbage.

Interpretation of the 30 bits 132-162 in Part B is variable. If the
MMSI at 8-37 is that of an auxiliary craft, the entry is taken to
refer to a small attached auxiliary vessel and these 30 bits are read
as the MMSI of the mother ship.  Otherwise the 30 bits describe vessel
dimensions as in Message Type 5.

According to <<MMSI>>, an MMSI is associated with an auxiliary craft
when it is of the form 98XXXYYYY, where (1) the '98' in positions 1
and 2 is required to designate an auxiliary craft, (2) the digits XXX
in the 3, 4 and 5 positions are the MID (the three-digit country code
as described in <<ITU-MID>>) and (3) YYYY is any decimal literal from
0000 to 9999.

=== Type 25: Single Slot Binary Message   ===

Maximum of 168 bits (a single slot). Fields after the Destination
MMSI are at variable offsets depending on that flag and the Destination
Indicator; they always occur in the same order but some may be omitted.

//: Type 25
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len   |Description            | Member      |T|Units
|0-5     |  6   | Message Type          | type        |u|Constant: 25
|6-7     |  2   | Repeat Indicator      | repeat      |u|As in CNB
|8-37    | 30   | MMSI                  | mmsi        |u|9 digits
|38      |  1   | Destination indicator | addressed   |b|0=broadcast,
                                                         1=addressed.
|39      |  1   | Binary data flag      | structured  |b|See below
|40      |0/30  | Destination MMSI      | dest_mmsi   |u|Message destination
|?       |0/16  | Application ID        | app_id      |u|Unsigned integer
|?       |0-128 | Data                  | data        |d|Binary data
|===============================================================================

If the 'addressed' flag is on, 30 bits of data at offset 40 are
interpreted as a destination MMSI.  Otherwise that field span becomes
part of the message payload, with the first 16 bits used as an
Application ID if the 'structured' flag is on.

If the 'structured' flag is on, a 16-bit application identifier is
extracted; this field is to be interpreted as a 10 bit DAC and 6-bit
FID as in message types 6 and 8.  Otherwise that field span becomes
part of the message payload.

The data fields are not, in contrast to message type 26, followed by a
radio status block.

Note: Type 25 is extremely rare. As of April 2011 it has not been
observed even in long-duration samples from AISHub.

=== Type 26: Multiple Slot Binary Message ===

Takes up 60-1064 bits (up to 5 slots).

//: Type 26
[frame="topbot",options="header"]
|==============================================================================
|Field   |Len   |Description           | Member     |T|Units
|0-5     |  6   | Message Type         | type       |u|Constant: 26
|6-7     |  2   | Repeat Indicator     | repeat     |u|As in CNB
|8-37    | 30   | MMSI                 | mmsi       |u|9 digits
|38      |  1   | Destination indicator| addressed  |b|0=broadcast,
                                                       1=addressed.
|39      |  1   | Binary data flag     | structured |b|See below
|40      |0/30  | Destination MMSI     | dest_mmsi  |u|Message destination
|?       |0/16  | Application ID       | app_id     |u|Unsigned integer
|?       |0-1004| Data                 | data       |d|Binary data
|?       |20    | Radio status         | radio      |u|See <<IALA>> for details.
|===============================================================================

The data field may span up to 5 256-bit slots in addition to the tail
end of the base slot.  The application_ID field, if present, is to be
interpreted as a 10 bit DAC and 6-bit FID as in message types 6 and 8.
Documentation says the data length of each slot is 224 and adds the
note "Allows for 32 bits of bit-stuffing."

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 interpreted as a SOTDMA or ITDMA state.

Note: Type 26 is extremely rare. As of April 2011 it has not been
observed even in long-duration samples from AISHub.

=== Type 27: Long Range AIS Broadcast message  ===

ITU-1371-4 says this message is primarily intended for long-range
detection of AIS Class A equipped vessels (typically by
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"]
|==============================================================================
|Field   |Len   |Description         |Member   |u|Units
|0-5     |  6   |Message Type        |type     |u|Constant: 27
|6-7     |  2   |Repeat Indicator    |repeat   |u|As in CNB
|8-37    | 30   |MMSI                |mmsi     |u|9 decimal digits
|38-38   | 1    |Position Accuracy   |accuracy |u|See Common Navigation Block
|39-39   | 1    |RAIM flag           |raim     |u|See Common Navigation Block
|40-43   | 4    |Navigation Status   |status   |u|See Common Navigation Block
|44-61   | 18   |Longitude           |lon      |I4|minutes/10
                                                  East positive, West negative
                                                  181000 = N/A (default)
|62-78   | 17   |Latitude            |lat      |I4|minutes/10
                                                  North positive, South negative
                                                  91000 = N/A (default)
|79-84   | 6    |Speed Over Ground   |speed    |u|Knots (0-62);
                                                  63 = N/A (default)
|85-93   | 9    |Course Over Ground  |course   |u|0 to 359 degrees,
                                                  511 = not available.
|94-94   | 1    |GNSS Position status|gnss     |u|0 = current GNSS position
                                                  1 = not GNSS position (default)
|95-95   | 1    |Spare               |         |x|Not used
|==============================================================================

== Local extensions ==

Some regional authorities extend the AIS message set.

The St. Lawrence Seaway broadcasts hydrological and lock-scheduling
messages using special encodings of the binary data of message types 6
and 8 (described in <<SEAWAY>>, freely available), and safety
information using types 12 and 14.  These message types are listed
under the description of type 8.

The U.S. Coast Guard has a system called PAWSS (Port and Water Safety
System) which uses extended AIS binary formats. <<SEAWAY>> says it's
intercompatible with the St. Lawrence Seaway system and describes three
PAWSS-specific messages in its Appendix A.

Since 2007 the Port Authority of London has operated a Thames AIS
system covering the Thames River; it uses extensions of message types
6 and 8.  It is describes in <<THAMES>>.

Since 2006 there has been some effort to standardize inland-waterway
extensions, described in <<INLAND>>.  It uses different message formats
and identifiers than the PAWS/St. Lawrence systems, which do not conform.
There is an AIS extension called "RIS" (River Information System) that
covers portions of the Danube River and Black Sea which does conform.

<<IMO289>> standardizes some subtypes of messages 6 and 8 similar to
PAWSS messages for DAC 1, the international jurisdiction code. However,
in some cases identically named subtypes are assigned different FIDs.

=== U.S. Coast Guard Extended AIVDM ===

You may occasionally see AIVDM packets with additional comma-separated
fields following the CRC-32 checksum.  This is a semi-obsolescent
logging format used by the USCG, which has never documented it well
and plans to replace it with a new one based on NMEA 4.0.

Here's a sample sentence and field breakdown:

-------------------------------------------------------------------------------
!AIVDM,1,1,,B,15Cjtd0Oj;Jp7ilG7=UkKBoB0<06,0*63,s1234,d-119,T12.34567123,r003669958,1085889680
-------------------------------------------------------------------------------

Following the "*63" checksum are additional fields delimited by commas.
These fields provide additional metadata about the reception of each AIS
broadcast.

The field beginning with the lower case "s" is a Relative Signal
Strength Indicator (RSSI) measurement from the receiver. This
measurement has a range of 0-65535. This is one of the parameters used
internally by the AIS receiver to determine the signal strength value as
reported in the field beginning with the lower case "d". This field only
exists when the AIS receiver provides this data.

The field beginning with a lower case "d" is the signal strength
measurement for this broadcast in dBm. This field only exists when the
AIS receiver provides this data.

The field beginning with the upper case "T" is the Time of Arrival
of the received broadcast in seconds from UTC 0. This field only exists
when the AIS receiver provides this data.

Another optional field not shown is one that begins with an upper
case "S" and represents the slot number in which the reception occurred.
The field would appear after the checksum and before the station
identifier field. This field only exists when the AIS receiver provides
this data. Example: S0042

The field beginning with the lower case "r" is a station identifier
field. This field is always provided, regardless of the type of AIS
equipment.  (Occasionally a base station identifier will be prefixed with
"b" instead.)

The last field is a time tag based on the standard C programming
language time function. Both date and time to the nearest second can be
derived from this field. This field is always provided, regardless of
the type of AIS equipment.

== NMEA Tag Blocks ==

Beginning with NMEA 4.10, the standard describes a way to intersperse
"tag blocks" with AIS sentences in order to supply additional
metadata, usually a Unix timestamp to be associated with a sentence
(or contiguous group of sentences such as an armored AIS Type 5).

The tag block facility is complex, in some respects poorly specified,
and there has been yet much public discussion of it.  This section
should be considered provisional and in need of improvement.

The general format of a tag block is: an opening backslash, followed
by multiple comma-separated fields none of which may contain
backslashes, followed by an asterisk and NMEA checksum, followed by a
closing backslash.

The following is an example of an AIS Type 1 sentence preceded by a
tag block:

-------------------------------------------------------------------------------------------------
\g:1-2-73874,n:157036,s:r003669945,c:1241544035*4A\!AIVDM,1,1,,B,15N4cJ`005Jrek0H@9n`DW5608EP,0*13
-------------------------------------------------------------------------------------------------

Each comma-separated field is expected to be a type key, followed by a
colon, followed by content.  The semantics of the type keys are as
follows (table from <<NMEA-ADVANCE>>):

Confusingly, there is a different standard introduced with NMEA 4.00,
IEC 62320-1, that uses the same tag block format but a slightly
different (overlapping) set of field keys

.NMEA 4.00 Field Types
[frame="topbot",options="header"]
|===========================================================================
| IEC   | NMEA	| Type           | Description
|  c    | c	| int>0          | UNIX time in seconds or milliseconds
|  d    | d	| string         | Destination (at most 15 chars)
| xGy   | g	| int-int-int	 | Sentence grouping
|  x    | n	| int>0          | line count
|       | r	| int>0          | relative time
|  s    | s	| string         | Source / station
|  i    | t	| string         | Text string (at most 15 chars)
|===========================================================================

The IEC 62320-1 and NMEA 4.10 c field is an emission time for the
sentence it precedes. We're not yet sure what the time unit is.

The NMEA 4.10 g value describes a sentence or sentence group to
associate the tag block to. It is a triple of ints separated by
dashes.  The first number is the sentence number, the second is total
number of sentences to make up one group.  The third number is an
identifier for that particular group.  If there is no g value, the tag
block simply applies to the following sentence.

As of May 2014 no NMEA 4.10 relative time fields have been observed in the
wild. It is unknown whether the unit is seconds or milliseconds.

The d, i/t, and s fields are intended to be used for filtering by
station IDs included in them.

Part of the NMEA 4.10 standard describes a configuration message facility by
which AIS message receivers can send queries to AIS senders, and under
some circumstances change the semantics if tag blocks (in particular,
by specifying time units and epoch).

We do not yet have more definite information on the meaning of these
fields or how they are related to nearby AIVDM/AIVDO sentences.  We
hope to add this in a future revision.

== AIS Payload Byte Alignment, Padding, and Bit Stuffing ==

Warning: Here there be dragons. Read with care. Once you get through
it, you will at least not encounter anything more confusing in the
rest of this document.

=== Byte Alignment ===

AIS is a bit-sync protocol.  While some fields within AIS payloads are
8-bit-byte-aligned with preceding padding, most are not. Furthermore,
while most message variants have bit lengths that are a multiple of 8,
some do not.

<<ITU1371>> includes a single sentence, easy to miss, requiring
over-the-air messages to have trailing padding to a 8-bit boundary.
In most cases message lengths are a multiple of 8 with trailing spare
fields added to ensure this; thus, the requirement will not change the
transmitted bitlength of the message from what's described in the
standard. There are, however, two exceptions to this rule.

One is an apparent error in the format design.  The type 15 message
has a variant with 108 data bits and a trailing 2-bit spare field, for
110. This spare should have been 4 bits to guarantee a byte boundary
at 112 bits. Decoders need to be prepared to encounter this length
in case the transmitter has implemented the padding requirement
properly.

The other is messages containing variable-length text packed into
6-bit nibbles: types 6, 12, and 14.  They may have trailing padding
after the last nibble to get to an 8-bit boundary.  Decoders should
be prepared to encounter and ignore this.

The variable-length binary message types 8, 17, 25, and 26 are
constrained to have data payloads of a size such that the payload ends
on a byte boundary, but should not require special handling on this
account. The binary data in message types 8 and 17 is also guaranteed
to *begin* on a byte boundary, but this is not true of the addressed
variants of type 25 and 26.

=== Interaction with AIVDM padding ===

AIVDM armoring introduces a second layer of padding, with confusing
consequences.  The real payload, already padded to a bit length that
is a multiple of 8 by the AIS radio layer, gets armored as a sequence
of ASCII characters encoding 6-bit nibbles.  To capture all of it, the
payload must in effect be padded to the next multiple of 6.

Consider a type 12 message with 5 sixbit characters in it. These will
become bits 72-102 in the over-the-air message. The AIS radio layer will
pad that to 104 bits at transmission to get to an 8-bit boundary.  The
receiver, reporting the data in AIVDM armoring, will pad that to 108
bits to get to a 6-bit boundary, encode the result, and issue a pad
character of '4' to indicate that the low 4 bits of the last 6-bit
nibble should be ignored.

Because these requirements are tricky and poorly documented in the
official standards, receivers not uncommonly get them wrong.  The most
common way to get them wrong seems to be by computing the pad
character incorrectly.

The most common error observed in the wild on AISHub is reporting a
pad 2 bits too small, making the message look like it is 2 bits longer
than it actually is.  This seems for some reason to be most common
on Type 5 messages, which then decode as 426 bits rather than 424.

Accordingly, we recommend that when validating fixed-size messages by
type and bit-length, decoders should accept messages that are up to 5
bits over their theoretically correct length.

For messages with a variable-length trailing payload (6, 8, 12, 14,
17, 25, 26) there is no way to detect that the pad character might
be wrong.  If it is, this will manifest as truncation of the last
nibble or extra trailing zero data.

=== Bit Stuffing ===

The following probably will not affect decoders. Nevertheless we
document it here because it is just the sort of thing that is (a)
likely to confuse implementors reading the public portions of the
standards, and (b) all too likely to become visible if there are
firmware or software errors in the transmission chain.

There are references to "bit-stuffing" in the <<IALA>> clarifications
describing certain payload fields.  <<C2>> reveals the following in
3.2.2.1: "The bitstream is subject to bit stuffing. This means that if
more than 5 consecutive 1s are found in the output bit stream, a zero
is inserted. This applies to all bits except the databits of HDLC
flags."  <<IALA>> clarifies as follows: "On the transmitting side,
this means that if five (5) consecutive ones (1s) are found in the
output bit stream, a zero should be inserted after the five (5)
consecutive ones (1s). This applies to all bits between the HDLC flags
[...] On the receiving side, the first zero after five (5) consecutive
ones (1s) should be removed."

It appears that this bit stuffing is meant to be performed by the AIS
radio link layer at transmission time and undone at reception time,
and should not be visible in AIVDM payloads reported by the
receiver.

== AIS feed sites ==

Most sites that advertise "live" AIS feeds actually give you a map
display through a browser.  Here are a few from which you can get raw
sentence data over a TCP/IP port for testing.  Coverage on these is
not yet very comprehensive; these sites tend to have good coverage in
Europe, the U.S. and a few ports in Asia but to be spotty elsewhere.
See their siting maps for details.

- http://aishub.net[AIS Hub]:
Share alike. You contribute a feed, you get back all feeds.

- http://maritime.ihs.com[AIS Live]:
Subscription access to real-time data. No longer has free access even
to delayed data.

- http://hd-sf.com:9009
Free San Francisco Bay Area AIS feed. For non-commercial use only.

== JSON-AIS encoding ==

Here is an application of the JSON metaformat to present AIS data in a
form more convenient for application use than AIVDM/AIVDO sentences.
This encoding is implemented by GPSD and its client libraries.  It is
described here because (a) the specification is closely tied to the
field encodings, and (b) the author wishes to offer it as an
interoperability standard for other applications.

One previous effort, <<HAM-JSON-AIS>>, has been made to define a
JSON-based standard for exchange of unpacked, human-readable AIS
data. The latest version at time of writing, from December 2008,covers
only a small subset of the most common AIS messages, and many data
fields in the messages it does dump are omitted.  The member names
given in the bit-field tables match the attributes used in HAM-JSON-AIS
when HAM-JSON-AIS includes that field.

The general ground rules for JSON-AIS encoding are as follows:

. Each sentence decodes to a JSON object.

. When multiple kinds of JSON objects may occur in a data stream, AIS
objects have the attribute "class":"AIS".

. Some collections of fields aggregating to a timestamp are dumped in
ISO8601 format.

.Timestamp fields
[frame="topbot",options="header"]
|===========================================================================
|Message| ITU/IMO fields                   | JSON ISO8601 | Format
|   4   | year,month,day,hour,minute,second| timestamp    | %4u-%02u-%02uT%02u:%02u:%02uZ
|   5   | month,day,hour,minute            | eta          | %02u-%02uT%02u:%02uZ
|6(1/12)| lmonth,lday,lhour,lminute        | departure    | %02u-%02uT%02u:%02uZ
|       | nmonth,nday,nhour,nminute        | eta          | %02u-%02uT%02u:%02uZ
|6(1/18)| month,day,hour,minute            | arrival      | %02u-%02uT%02u:%02uZ
|6(1/20)| month,day,hour,minute            | arrival      | %02u-%02uT%02u:%02uZ
|6(1/23)| month,day,hour,minute            | timestamp    | %02u-%02uT%02u:%02uZ
|6(1/28)| month,day,hour,minute            | start        | %02u-%02uT%02u:%02uZ
|8(1/11)| day,hour,minute                  | timestamp    | %02uT%02u:%02uZ
|8(1/11)| day,hour,minute                  | timestamp    | %02uT%02u:%02uZ
|8(1/13)| fmonth,fday,fhour,fminute        | from         | %02u-%02uT%02u:%02uZ
|8(1/13)| tmonth,tday,thour,tminute        | to           | %02u-%02uT%02u:%02uZ
|8(1/22)| month,day,hour,minute            | timestamp    | %02u-%02uT%02u:%02uZ
|8(1/27)| month,day,hour,minute            | start        | %02u-%02uT%02u:%02uZ
|8(200/23)| year,month,day,hour,minute     | start        |%4u-%02u-%02uT%02u:%02u
|8(200/23)| year,month,day,hour,minute     | end          |%4u-%02u-%02uT%02u:%02u
|===========================================================================

. There are two variants of the encoding, one scaled and one
unscaled, which differ in the treatment of float and
controlled-vocabulary fields. An AIS-JSON object may have the optional
attribute "scaled":true to signify that the rest of its fields are
scaled; if this attribute has the value 'false' or is omitted, no
scaling has been performed.  Message types for which the unscaled and
scaled dumps will differ are 1-5, 9, 11, 17-19, 21-24, and 27.

. In unscaled mode, float-valued fields are dumped in their unscaled
integer form. In scaled mode, division or other specified scaling is
applied and the value dumped as a float, *except* that certain extreme
or data-unavailable value as may be dumped as fixed strings; see the
table below.

. Each field in the Controlled Vocabularies list in the following
table is dumped twice: once with its base name as an integer, once
with "_text" appended to the name and the vocabulary item as value.
(This behavior is new in GPSD protocol version 3.9; older versions
made integer or string display dependent on the "scaled" flag.)

.Special fields
[frame="topbot",options="header"]
|===========================================================================
|Message | Float Fields                         | Controlled Vocabularies
| 1-3    | turn, speed, lon, lat                | status
| 4, 11  | lon, lat                             | epfd
| 5      | draught                              | shiptype, epfd
| 6(1/14)| lon, lat, cspeed                     | -
| 6(1/18)| lon, lat                             | -
| 6(1/20)| berth_lon, berth_lat, berth_depth    | position
| 6(1/22)| lon, lat                             | -
| 6(1/25)| code                                 | code*
| 6(1/28)| lon, lat                             | rtype
| 6(1/32)| lon, lat, cspeed                     | -
| 6(235/100) | -                                | racon, light
| 8(1/11)| lon, lat, airtemp, dewpoint,         | preciptype, ice
|        | visibility, waterlevel, cspeed,      |
|        | cspeed2, cspeed3, waveheight,        |
|        | swellheight, watertemp salinity      |
| 8(1/17)| lon, lat                             | idtype*
| 8(1/18)| lon, lat                             | -
| 8(1/19)| -                                    | signal, nextsignal
| 8(1/21)| lon, lat, visibility, airtemp,       | -
|        | watertemp, waveheight,               |
|        | swellheight, speed, pressure, pdelta,|
|        | rwindspeed, mgustspeed, airtemp,     |
|        | surftemp, cloudbase,                 |
|        | swheight1, swheight2                 |
| 8(1/22)| lon, lat                             | -
| 8(1/25)| -                                    | iceclass*
| 8(1/27)| lon, lat                             | rtype
| 8(1/31)| lon, lat, airtemp, dewpoint,         | preciptype
|        | visibility, waterlevel, cspeed,      |
|        | cspeed2, cdepth2, cspeed3,           |
|        | cdepth3, waveheight,                 |
|        | swellheight, watertemp, salinity     |
| 9      | lon, lat, course                     | -
| 17     | lon, lat                             | -
| 18     | lon, lat, course                     | -
| 19     | lon, lat, course                     | shiptype, epfd
| 21     | lon, lat                             | aid_type, epfd
| 22-23  | ne_lon,ne_lat, sw_lon, sw_lat        | shiptype,stationtype
| 24     | -                                    | shiptype
| 27     | lon, lat                             | -
|===========================================================================

This table does not include fields that are scaled by multipliers to integers.
These are reported in the multiplied form in both scaled and unscaled modes.

Asterisked fields are not yet decoded by GPSD, but probably will be in
a future release.

As the Beaufort scale is usually quoted numerically, conforming implementations
should do so rather than expanding to its controlled vocabulary.

.String special values in scaled mode
[frame="topbot",options="header"]
|===========================================================================
|Message | Fieldname | Special values
| 1-3    | turn      |
"nan" = not available, "fastright" = fast right turn (above 5deg/30sec degrees),
"fastleft" = fast left turn (above 5deg/30sec degrees).
| 1-3    | speed     | "nan" = not available, "fast" = speed >= 102.2 knots
|  9     | alt       | "nan" = not available, "high" = alt >= 4094 meters
|  9     | speed     | "nan" = not available, "fast" = speed >= 1023.0 knots
|===========================================================================

. Trailing arrays are dumped as JSON subobject arrays.  The name of the
array item is the name given in the 'a' table entry.  Explicit array count
fields (presently "waycount" in Route Info messages") are not dumped.

. In the VTS-Generated/Synthetic Targets message, the id field is
dumped as the value of an attribute the name of which is specified by
the idtype field.

== Open Questions ==

The AIS standards are not marvels of clear and unambiguous drafting.
We list here some open questions which could usefully be addressed
by governing authorities.

Some of these duplicate material in paragraphs tagged with OPEN-QUESTION.
They are collected here for convenience.

The message type summary table in <<INLAND>> indicates the existence
of a broadcast (unaddressed) variant of Inland Number of Persons On
Board. But no field breakdown is given for this variant. If it
supposed to be identical to the Type 6 layout, what is to be done
with the Destination MMSI field?

Are <<INLAND>> time-of-day fields UTC or local?

In <<INLAND>> RTA at lock/bridge/terminal message, no default is
specified for the Status field.

In Inland Ship Static and Voyage Related Data, which of two possible
ERI numeric codesets are used for the Type field - the 4-digit codes
in the 8000-8073 range, or the AIS codes in the 1-99 range?  Full ERI
codes have been observed in the wild.

In the <<INLAND>> description of Message 5 extensions, footnote 6 is
incomprehensible and not actually referenced in the table.

In the <<INLAND>> EMMA Warning and Signal Strength messages, the
description is not explicit about the interpretation of the longitude
and latitude fields; these semantics are assumed here from 28 and
27-bit fields in other messages.

In the <<INLAND>> EMMA Warning, what are the semantics of the min and
max values?  To what parameters do they apply?

Is the <<IMO236>> versions of Persons On Board, which is supposed to
be Type 6 and thus addressed, erroneous?  There is no destination
address field in the layout.

<<IMO289>> says of the "VTS Generated/Synthetic Targets" message:
"When MMSI or IMO number is used, the least significant bit should
equal bit zero of the Target Identifier."  It is unclear how "bit
zero" is to be interpreted, but it is not possible to reconcile
interpreting it as the leading bit of the field with AIS big-endian
encoding. Settling this awaits live testing.

== References ==

[bibliography]
- [[[AIS]]] http://en.wikipedia.org/wiki/Automatic_Identification_System[Automatic
Identification System]

- [[[SOLAS]]]
  http://www.navcen.uscg.gov/enav/ais/AIS_Regs_SOLAS_MTSA_FR.pdf[SOLAS
  AIS Regulations]

- [[[US-REQUIREMENTS]]]
  http://www.navcen.uscg.gov/enav/AIS/AIS_carriage_reqmts.htm[AIS
  Carriage Requirements]

- [[[ITU1371]]]
  http://www.itu.int/rec/R-REC-M.1371/en
  ITU Recommendation on the Technical Characteristics for a Universal
  Shipborne Automatic Identification System (AIS) using Time Division
  Multiple Access in the Maritime Mobile Band]. All versions are
  available here.

- [[[IALA]]]  http://www.ialathree.org/iala/pages/AIS/IALATech1.5.pdf[IALA
  Technical Clarifications on Recommendation ITU-R M.1371-1]

- [[[NAVCEN]]] http://www.navcen.uscg.gov/enav/ais/[NAVCEN AIS pages]

- [[[NMEA]]] "NMEA Revealed" This document collects information from
  public sources on the proprietary NMEA 0183 standard.  It is widely
  distributed, but due to its hosting site having folded in late 2011,
  its home location is unstable. It is probably best found by typing
  the title into a search engine.

- [[[INLAND]]] http://www.unece.org/fileadmin/DAM/trans/doc/finaldocs/sc3/ECE-TRANS-SC3-176e.pdf[International Standard for tracking and tracing on Inland Waterways]

- [[[SEAWAY]]] http://www.greatlakes-seaway.com/en/pdf/aisdata.pdf[St. Lawrence
  Seaway AIS Data Messaging Formats and Specifications]

- [[[THAMES]]] http://www.pla.co.uk/pdfs/maritime/APPENDIX_I__II_amendment_for_2012_byelaws_FINAL.pdf[Thames AIS - Technical Requirements Specification]

- [[[IMO236]]] http://www.imo.org/includes/blastData.asp/doc_id=4503&filename=236.pdf[IMO
  Circular 236: Guidance on the Application of AIS Binary Messages (May 2004)]

- [[[IMO289]]]
  http://vislab-ccom.unh.edu/~schwehr/papers/2010-IMO-SN.1-Circ.289.pdf[IMO
  289: Guidance on the Use of AIS Application-Specific Messages
  (June 2010)]

- [[IALA-A126]]
  http://www.ialathree.org/chapo/publications/documentspdf/doc_235_eng.pdf[IALA
  Recommendation A-126 On The Use of the Automatic Identification System (AIS)
  in Marine Aids to Navigation Services

- [[[Schwehr]]] http://schwehr.org/blog/[Kurt Schwehr's weblog]

- [[[IEC-PAS]]] IEC-PAS 61162-100, "Maritime navigation and
  radiocommunication equipment and systems"  The ASCII armoring
  is described on page 26 of Annex C, Table C-1. Communicated by
  Kurt Schwehr; I have not looked at it.

- [[[IEC-62287]]] "Maritime Navigation and Radiocommunication
  Equipment and Systems – Class B Shipborne Equipment of the
  Automatic Identification System (AIS)" Communicated by Mike Greene;
  I have not looked at it.

- [[[ITU-MID]]] http://www.itu.int/cgi-bin/htsh/glad/cga_mids.sh?lng=E[Table
  of Maritime Identification Digits]

- [[[RAIM]]] http://en.wikipedia.org/wiki/RAIM[Receiver Autonomous
  Integrity Monitoring]

- [[[C2]]] http://www.uais.org/AISspecificationCorrigendum2.pdf[AIS
  Specification Corrigendum 2]

- [[[MMSI]]] http://www.navcen.uscg.gov/marcomms/gmdss/mmsi.htm#format[MMSI
  Format]

- [[[HAM-JSON-AIS]]] http://wiki.ham.fi/JSON_AIS.en[JSON AIS transmission protocol]

- [[[AISHUB]]] http://www.aishub.net/[AIS Hub, the AIS data sharing center]

- [[[PILOTPLUG]]] http://www.pilotplug.com/

- [[[IALA-A126]]] http://www.iala-aism.org/iala/publications/documentspdf/doc_299_eng.pdf[]

- [[[AIS-SART]]] http://www.navcen.uscg.gov/?pageName=AISMessagesA

- [[[SART]]] http://en.wikipedia.org/wiki/AIS-SART

- [[[PATREON]]] https://www.patreon.com/esr

- [[NMEA-ADVANCE]] http://www.nmea.org/Assets/0183_advancements_nmea_oct_1_2010%20(2).pdf

== Change history ==

Version 1.0 was the initial release covering messages 1-3, 4, and 5.

Version 1.1 adds message breakdowns for 9 and 18, explanation of the
Repeat Indicator feld, and the explanation of USCG extended AIVDM.

Version 1.2 adds information on the ITU1371 edition 3 maneuver field,
and the RAIM flag. It also adds an important clarification about
six-bit decoding.

Version 1.3 adds information on message types 6, 7, 12, and 13, and
attempts to demystify bit-stuffing.

Version 1.4 adds explicit decoding tables for ASCII armoring and
six-bit ASCII.

Version 1.5 corrects the interpretation of field 7 in AIVDM
ASCII-armored sentences.

Version 1.6 corrects some minor errors in the interpretation of Type
5 messages.

Version 1.7 adds descriptions for Type 10, 11, 19, 21, and 24
messages, information about ITU-1371-3 flags in message type 18,
and the new section on Improving This Document.

Version 1.8 fixes some broken markup and adds information about JSON-AIS.

Version 1.9 adds more information on JSON and the member names.

Version 1.10 fixes a typo in the formula for undoing 6-bit armoring.

Version 1.11 describes message types 15, 16, and 17.

Version 1.12 describes messages 20 and 22, and adds navigation aid
type codes.

Version 1.13 documents more out-of-band values and treats radio status
blocks more uniformly.

Version 1.14 documents message 23.

Version 1.15 corrects an incorrect member name in message 5. It didn't
match my C code, but had no effect on conformance with the standard. I
corrected it because it confused someone working on a Python decoder.

Version 1.16 incorporated various minor fixes and corrections from
Neal Arundale.  One 'standard' fieldname changed, in message type 21:
type -> aid_type.

Version 1.17 clarifies the role of @ as a terminator in 6-bit text.

Version 1.18 notes a possible off-by-two error in the standards'
description of type 14, and noted that type 25 and 26 have not
been observed in the wild.  It also adds a more complete description
of AIS data types and some pragmatics about spare and reserved fields.

Version 1.19 adds a description of AIS Hub.

Version 1.20 adds a list of AIS feed sites - just two, so far.

Version 1.21 describes JSON-AIS more completely.  It adds descriptions
for AIS messages type 25 and 26, not yet observed in the wild.

Version 1.22 describes the problem with message length checks.
Notes on EPFD value 15 and shiptype values > 99 are added.  Added
another AIS feed. Corrections and more details on message 22.

Version 1.23 corrects some typos and numbering errors in the
description of message 19 (field widths were correct, though).
Also, AISLive no longer offers free delayed access.

Version 1.24 breaks the Type 6 and 8 application_id field into
DAC and FID and adds tables for known DAC/FID pairs and their sources.
Unspecified fields are now omitted in JSON dumps.  A new section
"AIS byte alignment, bit stuffing, and padding", reveals some
particularly black magic.

Version 1.25 adds clarifications and more message subtypes for
U.S. Coast Guard PAWSS messages.

Version 1.26 corrects an error in describing rate-of-turn decoding in
AIS Type 1, 2, and 3 messages,

Version 1.27 describes the sometime U.S. practice of omitting the leading
'3' region code from MMSIs.

Version 1.28 merges updates from IMO 289, communicated by Kurt Schwehr.

Version 1.29 added much information on WMO special message formats in
types 6 and 8.

Version 1.30 was revised because M.1371-4 is now a free download.
Also, we describe "pilot plugs" and AIS message type 27.  We get
much more explicit about defaults in IMO236 and IMO289 messages.

Version 1.31 shortened some C names in the Meteorological/Hydrological
messages and fixed typos.

Version 1.32 adds descriptions of IMO Area Notice and Environmental
messages.  It adds explicit type information to the tables.

Version 1.33 notes that the home location of "NMEA Revealed" became
unstable in late 2011.

Version 1.34 fixes a typo in the MMSI 2 field offset of message 7.

Version 1.35 notes that 24A and 24B messages don't necessarily come
in neat adjacent pairs and that decoders need to handle this.

Version 1.36 corrects erroneous scale factors in the IMO 289 Area
Notice and Time to Enter Port descriptions.

Version 1.36 adds breakdowns of Aid to Navigation monitoring messages
used in the UK and the Republic of Ireland.

Version 1.37 corrects a field signedness error in the IMO236 and
IMO289 Met/Hydro messages.

Version 1.38 corrects a minor bug in the description of the Navigation
Message ROT field. Adds information on AIS-SART.

Version 1.39 corrects signedness errors in the description of the Air
Temperature and Water Temperature fields in the IMO289 Weather Report
From Ship message.

Version 1.40 notes that AIS channel codes '1' and '2' may be
encountered in the wild.

Version 1.41 has been slightly amended because type 27s have started
showing up  on satellite feeds.

Version 1.42 fixes a typo in the Type 4 message description.

Version 1.43 describes the ITU-R 1371-4 breakdown of the Type 24
Vendor ID field and adds information on AIS standards for inland
waterways. Also Inland AIS standard messages are now covered.

Version 1.44 adds substantial new information on MMSIs and updates
the <<MMSI link>>, which was stale.

Version 1.45 adds a description of variant AIS talker IDs and NMEA
4.10 tag blocks.

Version 1.46 corrects an error in the specification on Inland AIS Type
10s. It also adds a bit more information on AIS tag blocks.

Version 1.47 corrects some minor field type errors in Type 18 and Type
19 speed fields.  Also corrected Type 9 radio field length.

Version 1.48 corrects two typos in the WMO289 Area Notice and Weather
Report From Ship definitions.

Version 1.49 adds a technical detail about non-AIS encapsulated
sentences.

Version 1.50 fixes a couple of typos in the ISO289 Berthing Data and
Tidal Window message descriptions.

Version 1.51 fixes an incorrect bit length in the IMO289 Hydrological
Data message.

Version 1.52 fixes many small typos. Change Gratipay to Patreon.

// end