openskynetwork / java-adsb

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

AirborneOperationalStatusV1Msg: supportsTargetChangeReport() is always false #31

Closed mrksngl closed 4 years ago

mrksngl commented 4 years ago

In AirborneOperationalStatusV1Msg.java there is computation

byte target_change_report_capability = (byte) (capability_class_code & 0xC0);
return target_change_report_capability == 1 | target_change_report_capability == 2;

which is never true: the lowest two bits of target_change_report_capability will always be 0 after logical conjunction with 0xc0. Also, the disjunction in the return statement should be logical, i.e. ||, rather than bitwise.

fixje commented 4 years ago

Thanks. There are two problems (i) missing bit shift, (ii) wrong operator as you already mentioned. Should rather be:

byte target_change_report_capability = (byte) ((capability_class_code & 0xC0) >>> 6);
return target_change_report_capability == 1 || target_change_report_capability == 2;
fixje commented 4 years ago

fixed in v3.2.0