aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/CguardProtocolDecoder.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/CguardProtocolDecoder.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/CguardProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/CguardProtocolDecoder.java20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/main/java/org/traccar/protocol/CguardProtocolDecoder.java b/src/main/java/org/traccar/protocol/CguardProtocolDecoder.java
index 90f8e0caf..fef90dbb5 100644
--- a/src/main/java/org/traccar/protocol/CguardProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/CguardProtocolDecoder.java
@@ -94,25 +94,17 @@ public class CguardProtocolDecoder extends BaseProtocolDecoder {
String key = data[i * 2];
String value = data[i * 2 + 1];
switch (key) {
- case "CSQ1":
- position.set(Position.KEY_RSSI, Integer.parseInt(value));
- break;
- case "NSQ1":
- position.set(Position.KEY_SATELLITES, Integer.parseInt(value));
- break;
- case "BAT1":
+ case "CSQ1" -> position.set(Position.KEY_RSSI, Integer.parseInt(value));
+ case "NSQ1" -> position.set(Position.KEY_SATELLITES, Integer.parseInt(value));
+ case "BAT1" -> {
if (value.contains(".")) {
position.set(Position.KEY_BATTERY, Double.parseDouble(value));
} else {
position.set(Position.KEY_BATTERY_LEVEL, Integer.parseInt(value));
}
- break;
- case "PWR1":
- position.set(Position.KEY_POWER, Double.parseDouble(value));
- break;
- default:
- position.set(key.toLowerCase(), value);
- break;
+ }
+ case "PWR1" -> position.set(Position.KEY_POWER, Double.parseDouble(value));
+ default -> position.set(key.toLowerCase(), value);
}
}