diff options
Diffstat (limited to 'src/main/java/org/traccar/protocol/CguardProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/CguardProtocolDecoder.java | 20 |
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); } } |