aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/Xrb28ProtocolDecoder.java
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2024-08-03 20:52:00 -0600
committerIván Ávalos <avalos@disroot.org>2024-08-03 20:52:00 -0600
commit55f6d92c09a5b1d8566b53633d07be3d31010d3b (patch)
treeb86bed801b0bbadb72c7e839296dae1d28b12bbb /src/main/java/org/traccar/protocol/Xrb28ProtocolDecoder.java
parentc04ad7d48331253c095fc123ded1b00f6ff871d3 (diff)
parent2788174193def918a3a1a5be3bbed24c9613323f (diff)
downloadtrackermap-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/Xrb28ProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/Xrb28ProtocolDecoder.java51
1 files changed, 14 insertions, 37 deletions
diff --git a/src/main/java/org/traccar/protocol/Xrb28ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Xrb28ProtocolDecoder.java
index 6033293c4..4f915af15 100644
--- a/src/main/java/org/traccar/protocol/Xrb28ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Xrb28ProtocolDecoder.java
@@ -119,56 +119,33 @@ public class Xrb28ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
switch (type) {
- case "Q0":
+ case "Q0" -> {
position.set(Position.KEY_BATTERY, Integer.parseInt(values[index++]) * 0.01);
position.set(Position.KEY_BATTERY_LEVEL, Integer.parseInt(values[index++]));
position.set(Position.KEY_RSSI, Integer.parseInt(values[index++]));
- break;
- case "H0":
+ }
+ case "H0" -> {
position.set(Position.KEY_BLOCKED, Integer.parseInt(values[index++]) > 0);
position.set(Position.KEY_BATTERY, Integer.parseInt(values[index++]) * 0.01);
position.set(Position.KEY_RSSI, Integer.parseInt(values[index++]));
position.set(Position.KEY_BATTERY_LEVEL, Integer.parseInt(values[index++]));
- break;
- case "W0":
+ }
+ case "W0" -> {
switch (Integer.parseInt(values[index++])) {
- case 1:
- position.set(Position.KEY_ALARM, Position.ALARM_MOVEMENT);
- break;
- case 2:
- position.set(Position.KEY_ALARM, Position.ALARM_FALL_DOWN);
- break;
- case 3:
- position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
- break;
- default:
- break;
+ case 1 -> position.set(Position.KEY_ALARM, Position.ALARM_MOVEMENT);
+ case 2 -> position.set(Position.KEY_ALARM, Position.ALARM_FALL_DOWN);
+ case 3 -> position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
}
- break;
- case "E0":
+ }
+ case "E0" -> {
position.set(Position.KEY_ALARM, Position.ALARM_FAULT);
position.set("error", Integer.parseInt(values[index++]));
- break;
- case "S1":
- position.set(Position.KEY_EVENT, Integer.parseInt(values[index++]));
- break;
- case "R0":
- case "L0":
- case "L1":
- case "S4":
- case "S5":
- case "S6":
- case "S7":
- case "V0":
- case "G0":
- case "K0":
- case "I0":
- case "M0":
+ }
+ case "S1" -> position.set(Position.KEY_EVENT, Integer.parseInt(values[index++]));
+ case "R0", "L0", "L1", "S4", "S5", "S6", "S7", "V0", "G0", "K0", "I0", "M0" -> {
String[] remaining = Arrays.copyOfRange(values, index, values.length);
position.set(Position.KEY_RESULT, String.join(",", remaining));
- break;
- default:
- break;
+ }
}
return !position.getAttributes().isEmpty() ? position : null;