From d0536ccbc1b7234784c5e48288bbac00a60ef821 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 7 Jul 2024 07:33:16 -0700 Subject: Update switch statements --- .../traccar/protocol/OwnTracksProtocolDecoder.java | 38 ++++++---------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'src/main/java/org/traccar/protocol/OwnTracksProtocolDecoder.java') diff --git a/src/main/java/org/traccar/protocol/OwnTracksProtocolDecoder.java b/src/main/java/org/traccar/protocol/OwnTracksProtocolDecoder.java index e54d07fa7..f04c4a295 100644 --- a/src/main/java/org/traccar/protocol/OwnTracksProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/OwnTracksProtocolDecoder.java @@ -167,31 +167,15 @@ public class OwnTracksProtocolDecoder extends BaseHttpProtocolDecoder { private void setEventOrAlarm(Position position, String trigger, Integer reportType) { switch (trigger) { - case "9": - position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); - break; - case "1": - position.set(Position.KEY_ALARM, Position.ALARM_POWER_ON); - break; - case "i": - position.set(Position.KEY_IGNITION, true); - break; - case "I": - position.set(Position.KEY_IGNITION, false); - break; - case "E": - position.set(Position.KEY_ALARM, Position.ALARM_POWER_RESTORED); - break; - case "e": - position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT); - break; - case "!": - position.set(Position.KEY_ALARM, Position.ALARM_TOW); - break; - case "s": - position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED); - break; - case "h": + case "9" -> position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); + case "1" -> position.set(Position.KEY_ALARM, Position.ALARM_POWER_ON); + case "i" -> position.set(Position.KEY_IGNITION, true); + case "I" -> position.set(Position.KEY_IGNITION, false); + case "E" -> position.set(Position.KEY_ALARM, Position.ALARM_POWER_RESTORED); + case "e" -> position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT); + case "!" -> position.set(Position.KEY_ALARM, Position.ALARM_TOW); + case "s" -> position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED); + case "h" -> { switch (reportType) { case 0: case 3: @@ -207,9 +191,7 @@ public class OwnTracksProtocolDecoder extends BaseHttpProtocolDecoder { position.set(Position.KEY_ALARM, Position.ALARM_CORNERING); break; } - break; - default: - break; + } } } } -- cgit v1.2.3