From d88699c8610e1dd57025e2f512e1d0c415b6ff5e Mon Sep 17 00:00:00 2001 From: Markus Fuchs Date: Mon, 8 Jun 2020 13:38:25 +0200 Subject: [PATCH] Better decoding and documentation for airborne/ground status - Added `isAirborne()` method to selective DFs - Evaluate airborne/ground status in DF11 - Improved javadoc for airborne/ground status --- .../opensky/libadsb/msgs/AllCallReply.java | 19 +++++++++++++++++++ .../opensky/libadsb/msgs/AltitudeReply.java | 14 ++++++++++++-- .../libadsb/msgs/CommBAltitudeReply.java | 14 ++++++++++++-- .../libadsb/msgs/CommBIdentifyReply.java | 14 ++++++++++++-- .../opensky/libadsb/msgs/IdentifyReply.java | 14 ++++++++++++-- 5 files changed, 67 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/opensky/libadsb/msgs/AllCallReply.java b/src/main/java/org/opensky/libadsb/msgs/AllCallReply.java index c236a13..fb48d92 100644 --- a/src/main/java/org/opensky/libadsb/msgs/AllCallReply.java +++ b/src/main/java/org/opensky/libadsb/msgs/AllCallReply.java @@ -83,6 +83,25 @@ public byte getCapabilities() { return capabilities; } + /** + * @return whether capabilities indicate that aircraft is on the ground. + * Note that returning false does not indicate that the aircraft is airborne as status might be unknown! + * See also {@link #isAirborne()}. + */ + public boolean isOnGround() { + return capabilities == 4; + } + + /** + * @return whether capabilities indicate that aircraft is airborne. + * Note that returning false does not indicate that the aircraft is on ground as status might be unknown! + * See also {@link #isOnGround()}. + */ + public boolean isAirborne() { + return capabilities == 5; + } + + /** * Some receivers already subtract the crc checksum * from the parity field right after reception. diff --git a/src/main/java/org/opensky/libadsb/msgs/AltitudeReply.java b/src/main/java/org/opensky/libadsb/msgs/AltitudeReply.java index e388677..694e441 100644 --- a/src/main/java/org/opensky/libadsb/msgs/AltitudeReply.java +++ b/src/main/java/org/opensky/libadsb/msgs/AltitudeReply.java @@ -111,13 +111,23 @@ public boolean hasSPI() { } /** - * @return whether flight status indicates that aircraft is - * airborne or on the ground; For flight status >= 4, this flag is unknown + * @return whether flight status indicates that aircraft is on the ground. + * For flight status >= 4, this flag is unknown. Thus, a return value of false + * does not indicate that the aircraft is airborne! See also {@link #isAirborne()}. */ public boolean isOnGround() { return flight_status==1 || flight_status==3; } + /** + * @return whether flight status indicates that aircraft is airborne. + * For flight status >= 4, this flag is unknown. Thus, a return value of false + * does not indicate that the aircraft is on ground! See also {@link #isOnGround()} . + */ + public boolean isAirborne() { + return flight_status == 0 || flight_status == 2; + } + /** * indicator for downlink requests * @return the 5 bits downlink request. The coding is:
diff --git a/src/main/java/org/opensky/libadsb/msgs/CommBAltitudeReply.java b/src/main/java/org/opensky/libadsb/msgs/CommBAltitudeReply.java index 73b759f..408bef1 100644 --- a/src/main/java/org/opensky/libadsb/msgs/CommBAltitudeReply.java +++ b/src/main/java/org/opensky/libadsb/msgs/CommBAltitudeReply.java @@ -118,13 +118,23 @@ public boolean hasSPI() { } /** - * @return whether flight status indicates that aircraft is - * airborne or on the ground; For flight status >= 4, this flag is unknown + * @return whether flight status indicates that aircraft is on the ground. + * For flight status >= 4, this flag is unknown. Thus, a return value of false + * does not indicate that the aircraft is airborne! See also {@link #isAirborne()}. */ public boolean isOnGround() { return flight_status==1 || flight_status==3; } + /** + * @return whether flight status indicates that aircraft is airborne. + * For flight status >= 4, this flag is unknown. Thus, a return value of false + * does not indicate that the aircraft is on ground! See also {@link #isOnGround()} . + */ + public boolean isAirborne() { + return flight_status == 0 || flight_status == 2; + } + /** * indicator for downlink requests * @return the 5 bits downlink request. The coding is:
diff --git a/src/main/java/org/opensky/libadsb/msgs/CommBIdentifyReply.java b/src/main/java/org/opensky/libadsb/msgs/CommBIdentifyReply.java index 2b4a39d..fe345d7 100644 --- a/src/main/java/org/opensky/libadsb/msgs/CommBIdentifyReply.java +++ b/src/main/java/org/opensky/libadsb/msgs/CommBIdentifyReply.java @@ -118,13 +118,23 @@ public boolean hasSPI() { } /** - * @return whether flight status indicates that aircraft is - * airborne or on the ground; For flight status >= 4, this flag is unknown + * @return whether flight status indicates that aircraft is on the ground. + * For flight status >= 4, this flag is unknown. Thus, a return value of false + * does not indicate that the aircraft is airborne! See also {@link #isAirborne()}. */ public boolean isOnGround() { return flight_status==1 || flight_status==3; } + /** + * @return whether flight status indicates that aircraft is airborne. + * For flight status >= 4, this flag is unknown. Thus, a return value of false + * does not indicate that the aircraft is on ground! See also {@link #isOnGround()} . + */ + public boolean isAirborne() { + return flight_status == 0 || flight_status == 2; + } + /** * indicator for downlink requests * @return the 5 bits downlink request. The coding is:
diff --git a/src/main/java/org/opensky/libadsb/msgs/IdentifyReply.java b/src/main/java/org/opensky/libadsb/msgs/IdentifyReply.java index 75c5d4c..0e42ac4 100644 --- a/src/main/java/org/opensky/libadsb/msgs/IdentifyReply.java +++ b/src/main/java/org/opensky/libadsb/msgs/IdentifyReply.java @@ -111,13 +111,23 @@ public boolean hasSPI() { } /** - * @return whether flight status indicates that aircraft is - * airborne or on the ground; For flight status >= 4, this flag is unknown + * @return whether flight status indicates that aircraft is on the ground. + * For flight status >= 4, this flag is unknown. Thus, a return value of false + * does not indicate that the aircraft is airborne! See also {@link #isAirborne()}. */ public boolean isOnGround() { return flight_status==1 || flight_status==3; } + /** + * @return whether flight status indicates that aircraft is airborne. + * For flight status >= 4, this flag is unknown. Thus, a return value of false + * does not indicate that the aircraft is on ground! See also {@link #isOnGround()} . + */ + public boolean isAirborne() { + return flight_status == 0 || flight_status == 2; + } + /** * indicator for downlink requests * @return the 5 bits downlink request. The coding is: