openskynetwork / java-adsb

Mode S and ADS-B decoding library for Java
GNU General Public License v3.0
103 stars 41 forks source link

Operational status messages (tc=31) with version > 2 cause BadFormatException #27

Closed wiseman closed 5 years ago

wiseman commented 5 years ago

I have observed multiple aircraft send several hundred operational status messages (tc=31) with a version number of 3. In the current code this causes a BadFormatException.

Since messages with an unexpected version number are observed in the wild and don't seem to be the result of garbled reception, I think the strategy of throwing an exception should be reconsidered. Instead of providing different classes for each version of message, perhaps it would work better to have a single class that would provide whatever information was available in the message, possibly in the form of key/value pairs.

E.g., instead of decoding as an AirborneOperationalStatusV1Msg with hasOperationalTCAS and has1090ESIn methods, a message would decode as an AirborneOperationalStatusMsg, and users would call getProperty(HAS_OPERATIONAL_TCAS) and getProperty(HAS_1090_ES_IN).

More information is available in this post: https://aviation.stackexchange.com/questions/60182/received-ads-b-tc-31-message-with-non-existent-version-3

fixje commented 5 years ago

The decoder aims for compliance with the latest ADS-B standard DO-260B where a value for the version other than 0, 1 and 2 are not allowed (reserved). To the best of my knowledge there isn't even a draft of DO-260C.

If a transponder obviously violates the standard we can not be sure if other bits in the message still have the same semantics.

wiseman commented 5 years ago

Sounds reasonable.