Skip to content

Commit

Permalink
throw exception when receiving a mode A/C reply, they can be ignored …
Browse files Browse the repository at this point in the history
…for now
  • Loading branch information
filipjonckers committed Jan 8, 2022
1 parent 9a1b9bf commit fe333b7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GROUP=aero.t2s
VERSION_NAME=0.2.4-SNAPSHOT
VERSION_NAME=0.2.5-SNAPSHOT

POM_ARTIFACT_ID=mode-s
POM_NAME=Mode-S/ADS-B (1090Mhz)
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/aero/t2s/modes/ModeAcMessageException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package aero.t2s.modes;

public class ModeAcMessageException extends Exception implements DownlinkException {

}
6 changes: 5 additions & 1 deletion src/main/java/aero/t2s/modes/ModeSHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ public void onMessage(Consumer<DownlinkFormat> onMessage) {
public abstract DownlinkFormat handleSync(String data);


protected short[] toData(final String input) throws EmptyMessageException {
protected short[] toData(final String input) throws EmptyMessageException, ModeAcMessageException {
if(input.length() == 6) {
// example mode A/C: *21D2; *0200; *0101;
throw new ModeAcMessageException();
}
if (input.startsWith("*0000")) {
throw new EmptyMessageException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/aero/t2s/modes/ModeSMessageHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public DownlinkFormat handleSync(final String input) {
}

return df;
} catch (EmptyMessageException ignored) {
} catch (ModeAcMessageException | EmptyMessageException ignored) {
} catch (InvalidExtendedSquitterTypeCodeException | UnknownDownlinkFormatException e) {
LOGGER.error(e.getMessage());
} catch (Throwable throwable) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/aero/t2s/modes/ModeSTrackHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public DownlinkFormat handleSync(final String input) {
}

return df;
} catch (EmptyMessageException ignored) {
} catch (ModeAcMessageException | EmptyMessageException ignored) {
} catch (InvalidExtendedSquitterTypeCodeException | UnknownDownlinkFormatException e) {
LOGGER.error(e.getMessage());
} catch (Throwable throwable) {
Expand Down

0 comments on commit fe333b7

Please sign in to comment.