diff options
author | Iván Ávalos <avalos@disroot.org> | 2024-08-03 20:52:00 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2024-08-03 20:52:00 -0600 |
commit | 55f6d92c09a5b1d8566b53633d07be3d31010d3b (patch) | |
tree | b86bed801b0bbadb72c7e839296dae1d28b12bbb /src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java | |
parent | c04ad7d48331253c095fc123ded1b00f6ff871d3 (diff) | |
parent | 2788174193def918a3a1a5be3bbed24c9613323f (diff) | |
download | trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.tar.gz trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.tar.bz2 trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.zip |
Merge tag 'tags/v6.3'
Diffstat (limited to 'src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java | 67 |
1 files changed, 19 insertions, 48 deletions
diff --git a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java index 343d42e09..3e7d53ced 100644 --- a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java @@ -82,31 +82,19 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { .compile(); private String decodeAlarm(String event) { - switch (event) { - case "Z": - return Position.ALARM_LOW_BATTERY; - case "Y": - return Position.ALARM_TOW; - case "X": - return Position.ALARM_GEOFENCE_ENTER; - case "T": - return Position.ALARM_TAMPERING; - case "H": - return Position.ALARM_POWER_OFF; - case "8": - return Position.ALARM_VIBRATION; - case "7": - case "4": - return Position.ALARM_GEOFENCE_EXIT; - case "6": - return Position.ALARM_OVERSPEED; - case "5": - return Position.ALARM_POWER_CUT; - case "3": - return Position.ALARM_SOS; - default: - return null; - } + return switch (event) { + case "Z" -> Position.ALARM_LOW_BATTERY; + case "Y" -> Position.ALARM_TOW; + case "X" -> Position.ALARM_GEOFENCE_ENTER; + case "T" -> Position.ALARM_TAMPERING; + case "H" -> Position.ALARM_POWER_OFF; + case "8" -> Position.ALARM_VIBRATION; + case "7", "4" -> Position.ALARM_GEOFENCE_EXIT; + case "6" -> Position.ALARM_OVERSPEED; + case "5" -> Position.ALARM_POWER_CUT; + case "3" -> Position.ALARM_SOS; + default -> null; + }; } private String decodeEvent(String event, Position position, String model) { @@ -140,30 +128,13 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { String event, String devicePassword, Channel channel, SocketAddress remoteAddress) { String responseCode = null; - switch (event) { - case "3": - responseCode = "d"; - break; - case "M": - responseCode = "m"; - break; - case "S": - case "T": - responseCode = "t"; - break; - case "X": - case "4": - responseCode = "x"; - break; - case "Y": - responseCode = "y"; - break; - case "Z": - responseCode = "z"; - break; - default: - break; + case "3" -> responseCode = "d"; + case "M" -> responseCode = "m"; + case "S", "T" -> responseCode = "t"; + case "X", "4" -> responseCode = "x"; + case "Y" -> responseCode = "y"; + case "Z" -> responseCode = "z"; } if (responseCode != null) { |