Mode S and ADS-B Decoder for Java
The java-adsb library is a decoder library for Mode S and ADS-B messages. It provides a convenient interface for Java programmers for decoding Mode S messages including the Extended Squitter (DF 17/18) formats. It implements algorithms such as the local and global CPR algorithm for position decoding. The source and examples can be found at https://github.com/openskynetwork/java-adsb. The project is published under the GNU General Public License Version 3.
Supported ADS-B Message Formats
Currently it supports the following ADS-B message formats:
- Identification messages
- Velocity over ground messages
- Airborne Position messages (including global and local CPR)
- Surface Position messages (including global and local CPR)
- Operational status reports (airborne and surface)
- Aircraft status reports (emergency/priority, TCAS RA)
The formats are implemented according to RTCA DO-260B, i.e. ADS-B Version 2. Most message formats of ADS-B Version 1 are upward compatible. Please check the API documentation of the message formats for differences. The ADS-B version of transponders can be obtained in Aircraft Operational Status reports. It is woth noting that format type code 29 (target state and status information) is missing since it's virtually non-existent in the current ADS-B deployment.
Supported Mode S Downlink Formats
The only Mode S format implemented so far is the Extended Squitter (downlink format 17). However, we plan to extend the library with decoders for all Mode S downlink formats soon. This will in particular include decoders for BDS registers. Therefore, we will implement a variety of reasonableness tests to be able to identify the BDS register.
A generic decoder is implemented in org.opensky.libasdb.Decoder. It is a top down decoder which means, it simply takes a raw Mode S message in hex representation and returns a ModeSReply object. This object is already an instance of all possible specialized classes. For instance, org.opensky.libasdb.Decoder.genericDecoder("8dc0ffee58b986d0b3bd25000000") returns an instance of AirbornePositionMsg. The ModeSReply class also implements the cyclic redundancy check (CRC) used by Mode S and the genericDecoder throws an exception in case the CRC fails. Note that a CRC==0 is also accepted by genericDecoder, since many receivers already perform CRC on the hardware and set the CRC field to zero.
Position Reasonableness Test
The SurfacePositionMsg and AirbornePositionMsg classes both implement the compact position reporting (CPR) algorithm which is used in ADS-B. As there are transponders which sometimes report erroneous positions and since unexperienced programmers might apply the CPR algorithm in a wrong way, we implemented org.opensky.libasdb.PositionDecoder, a position decoder with a simplified interface. In addition to simple decoding, it also performs various reasonableness checks on the positions in order to detect erroneous positions or decoding errors. Also, the position decoder allows mixing airborne and surface position messages and takes care of correct use. It is strongly recommended to use this decoder as well as check all positions returned by the decoder with position.isReasonable().