ttlappalainen / NMEA2000

NMEA2000 library for Arduino
508 stars 211 forks source link

AIS PGN 129038/39 Communication State Issue #409

Open lsoltero opened 3 days ago

lsoltero commented 3 days ago

As it turns out the 19 bit Communication State can be important to application developers since for AIS types 1,2 (Class A) and 18 (Class B non "CS") the UTC Hour:Min for the position report is encoded in it.

In SetN2K... routines the default value of 0x07ffff seems incorrect.

For Class B "CS" transmissions where communication state selector flag is 1 the default value must be 1100000000000000110.

For Type 18 Class B (non "CS") and for Type 1, 2 the value should be ??? 0x0 seems to be a better default option although not clear from the docs.

For type 3 again 0x0 seems to a better option.

Type 1, 2, and 18 ( non CS) use SOTDMA transmissions and tables 18 and 19 apply for Communication State type 3 uses ITDMA and table 20 applies.

Here is a link to the documentation.

https://www.itu.int/dms_pubrec/itu-r/rec/m/R-REC-M.1371-5-201402-I!!PDF-E.pdf

I will be applying fixes to code and will log a pull request when ready... Just thought I would document the issue here.

--Luis