diff options
author | Anton Tananaev <anton@traccar.org> | 2024-07-07 07:33:16 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-07-07 07:33:16 -0700 |
commit | d0536ccbc1b7234784c5e48288bbac00a60ef821 (patch) | |
tree | 29ba8e1349eb9a5990f564edad7ddc7b5e24d7f7 /src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java | |
parent | 864872b2df3e26c94d3a5826f4df504de3cf6c62 (diff) | |
download | trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.tar.gz trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.tar.bz2 trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.zip |
Update switch statements
Diffstat (limited to 'src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java index 2a6a81a65..2e88186b8 100644 --- a/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java @@ -66,28 +66,18 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder { .compile(); private String decodeAlarm(String value) { - switch (value) { - case "IN1": - return Position.ALARM_SOS; - case "GOF": - return Position.ALARM_GEOFENCE; - case "TOW": - return Position.ALARM_TOW; - case "HDA": - return Position.ALARM_ACCELERATION; - case "HDB": - return Position.ALARM_BRAKING; - case "FDA": - return Position.ALARM_FATIGUE_DRIVING; - case "SKA": - return Position.ALARM_VIBRATION; - case "PMA": - return Position.ALARM_MOVEMENT; - case "CPA": - return Position.ALARM_POWER_CUT; - default: - return null; - } + return switch (value) { + case "IN1" -> Position.ALARM_SOS; + case "GOF" -> Position.ALARM_GEOFENCE; + case "TOW" -> Position.ALARM_TOW; + case "HDA" -> Position.ALARM_ACCELERATION; + case "HDB" -> Position.ALARM_BRAKING; + case "FDA" -> Position.ALARM_FATIGUE_DRIVING; + case "SKA" -> Position.ALARM_VIBRATION; + case "PMA" -> Position.ALARM_MOVEMENT; + case "CPA" -> Position.ALARM_POWER_CUT; + default -> null; + }; } private Position decodePosition(Channel channel, SocketAddress remoteAddress, String sentence) { |