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/EelinkProtocolDecoder.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/EelinkProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/EelinkProtocolDecoder.java | 58 |
1 files changed, 18 insertions, 40 deletions
diff --git a/src/main/java/org/traccar/protocol/EelinkProtocolDecoder.java b/src/main/java/org/traccar/protocol/EelinkProtocolDecoder.java index db1b365c3..f1cc43394 100644 --- a/src/main/java/org/traccar/protocol/EelinkProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/EelinkProtocolDecoder.java @@ -67,35 +67,21 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_CAMERA_DATA = 0x1F; private String decodeAlarm(Short value) { - switch (value) { - case 0x01: - return Position.ALARM_POWER_OFF; - case 0x02: - return Position.ALARM_SOS; - case 0x03: - return Position.ALARM_LOW_BATTERY; - case 0x04: - return Position.ALARM_VIBRATION; - case 0x08: - case 0x09: - return Position.ALARM_GPS_ANTENNA_CUT; - case 0x25: - return Position.ALARM_REMOVING; - case 0x81: - return Position.ALARM_LOW_SPEED; - case 0x82: - return Position.ALARM_OVERSPEED; - case 0x83: - return Position.ALARM_GEOFENCE_ENTER; - case 0x84: - return Position.ALARM_GEOFENCE_EXIT; - case 0x85: - return Position.ALARM_ACCIDENT; - case 0x86: - return Position.ALARM_FALL_DOWN; - default: - return null; - } + return switch (value) { + case 0x01 -> Position.ALARM_POWER_OFF; + case 0x02 -> Position.ALARM_SOS; + case 0x03 -> Position.ALARM_LOW_BATTERY; + case 0x04 -> Position.ALARM_VIBRATION; + case 0x08, 0x09 -> Position.ALARM_GPS_ANTENNA_CUT; + case 0x25 -> Position.ALARM_REMOVING; + case 0x81 -> Position.ALARM_LOW_SPEED; + case 0x82 -> Position.ALARM_OVERSPEED; + case 0x83 -> Position.ALARM_GEOFENCE_ENTER; + case 0x84 -> Position.ALARM_GEOFENCE_EXIT; + case 0x85 -> Position.ALARM_ACCIDENT; + case 0x86 -> Position.ALARM_FALL_DOWN; + default -> null; + }; } private void decodeStatus(Position position, int status) { @@ -407,17 +393,9 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { int pid = buf.readUnsignedByte(); int value = buf.readInt(); switch (pid) { - case 0x89: - position.set(Position.KEY_FUEL_CONSUMPTION, value); - break; - case 0x8a: - position.set(Position.KEY_ODOMETER, value * 1000L); - break; - case 0x8b: - position.set(Position.KEY_FUEL_LEVEL, value / 10); - break; - default: - break; + case 0x89 -> position.set(Position.KEY_FUEL_CONSUMPTION, value); + case 0x8a -> position.set(Position.KEY_ODOMETER, value * 1000L); + case 0x8b -> position.set(Position.KEY_FUEL_LEVEL, value / 10); } } |