Skip to content

Commit fe333b7

Browse files
committed
throw exception when receiving a mode A/C reply, they can be ignored for now
1 parent 9a1b9bf commit fe333b7

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GROUP=aero.t2s
2-
VERSION_NAME=0.2.4-SNAPSHOT
2+
VERSION_NAME=0.2.5-SNAPSHOT
33

44
POM_ARTIFACT_ID=mode-s
55
POM_NAME=Mode-S/ADS-B (1090Mhz)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package aero.t2s.modes;
2+
3+
public class ModeAcMessageException extends Exception implements DownlinkException {
4+
5+
}

src/main/java/aero/t2s/modes/ModeSHandler.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ public void onMessage(Consumer<DownlinkFormat> onMessage) {
3030
public abstract DownlinkFormat handleSync(String data);
3131

3232

33-
protected short[] toData(final String input) throws EmptyMessageException {
33+
protected short[] toData(final String input) throws EmptyMessageException, ModeAcMessageException {
34+
if(input.length() == 6) {
35+
// example mode A/C: *21D2; *0200; *0101;
36+
throw new ModeAcMessageException();
37+
}
3438
if (input.startsWith("*0000")) {
3539
throw new EmptyMessageException();
3640
}

src/main/java/aero/t2s/modes/ModeSMessageHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public DownlinkFormat handleSync(final String input) {
3838
}
3939

4040
return df;
41-
} catch (EmptyMessageException ignored) {
41+
} catch (ModeAcMessageException | EmptyMessageException ignored) {
4242
} catch (InvalidExtendedSquitterTypeCodeException | UnknownDownlinkFormatException e) {
4343
LOGGER.error(e.getMessage());
4444
} catch (Throwable throwable) {

src/main/java/aero/t2s/modes/ModeSTrackHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public DownlinkFormat handleSync(final String input) {
8585
}
8686

8787
return df;
88-
} catch (EmptyMessageException ignored) {
88+
} catch (ModeAcMessageException | EmptyMessageException ignored) {
8989
} catch (InvalidExtendedSquitterTypeCodeException | UnknownDownlinkFormatException e) {
9090
LOGGER.error(e.getMessage());
9191
} catch (Throwable throwable) {

0 commit comments

Comments
 (0)