Closed ftence closed 6 years ago
Thanks for the contribution! Changes in this area needs particular care - so I will review it as soon as I get time and either merge or give my feeback.
I do agree, these a changes have many implications. I noticed the problem looking at the SOG value with should be -128 when the information is unavailable.
After some reflection I think it should be better to keep Integer.parseInt instead of Integer.parseUnsignedInt.
In message type 1, 2 and 3 SOG must be 102.3 when not available. Where do you get -128 from? One of the other message types?
Why do you think it is better to "keep Integer.parseInt instead of Integer.parseUnsignedInt." ?
Some of the unit tests are failing when your changes are applied. I am trying to look into this.
Sorry, I meant ROT, not SOG. Taken from https://www.navcen.uscg.gov/?pageName=AISMessagesA: "-128 (80 hex) indicates no turn information available (default)."
About my remark on the usage of parseInt or parseUnsignedInt. I was concerned that INTEGER_DECODER could be used to decode string of length 33 without error because parseUnsignedInt can accept a string with 32 "1" for instance. Upon reflection, parseUnsignedInt should be kept but a check should be added to INTEGER_DECODER to avoid decoding strings of length 33.
Great thanks. And this has not been forgotten - I will resume to it as soon as time permits!
Thank you for this contribution which fixed a subtle bug involving ROT and other numeric values derived from a bitstring.
Apply two's complement for INTEGER_DECODER.
Changes from INTEGER_DECODER to UNSIGNED_INTEGER_DECODER have to be checked as I'm not an expert on NMEA/AIS messages.