aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/AdmProtocolDecoder.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/AdmProtocolDecoder.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/AdmProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/AdmProtocolDecoder.java41
1 files changed, 11 insertions, 30 deletions
diff --git a/src/main/java/org/traccar/protocol/AdmProtocolDecoder.java b/src/main/java/org/traccar/protocol/AdmProtocolDecoder.java
index 1f940f7e2..3eab90988 100644
--- a/src/main/java/org/traccar/protocol/AdmProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/AdmProtocolDecoder.java
@@ -108,38 +108,19 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder {
int endIndex = buf.readerIndex() + buf.readUnsignedByte();
while (buf.readerIndex() < endIndex) {
int mask = buf.readUnsignedByte();
- long value;
- switch (BitUtil.from(mask, 6)) {
- case 3:
- value = buf.readLongLE();
- break;
- case 2:
- value = buf.readUnsignedIntLE();
- break;
- case 1:
- value = buf.readUnsignedShortLE();
- break;
- default:
- value = buf.readUnsignedByte();
- break;
- }
+ long value = switch (BitUtil.from(mask, 6)) {
+ case 3 -> buf.readLongLE();
+ case 2 -> buf.readUnsignedIntLE();
+ case 1 -> buf.readUnsignedShortLE();
+ default -> buf.readUnsignedByte();
+ };
int index = BitUtil.to(mask, 6);
switch (index) {
- case 1:
- position.set(Position.PREFIX_TEMP + 1, value);
- break;
- case 2:
- position.set("humidity", value);
- break;
- case 3:
- position.set("illumination", value);
- break;
- case 4:
- position.set(Position.KEY_BATTERY, value);
- break;
- default:
- position.set("can" + index, value);
- break;
+ case 1 -> position.set(Position.PREFIX_TEMP + 1, value);
+ case 2 -> position.set("humidity", value);
+ case 3 -> position.set("illumination", value);
+ case 4 -> position.set(Position.KEY_BATTERY, value);
+ default -> position.set("can" + index, value);
}
}
}