aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/NavisFrameDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol/NavisFrameDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/NavisFrameDecoder.java24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/main/java/org/traccar/protocol/NavisFrameDecoder.java b/src/main/java/org/traccar/protocol/NavisFrameDecoder.java
index 8a0bb0b9a..9d560d19c 100644
--- a/src/main/java/org/traccar/protocol/NavisFrameDecoder.java
+++ b/src/main/java/org/traccar/protocol/NavisFrameDecoder.java
@@ -57,17 +57,12 @@ public class NavisFrameDecoder extends BaseFrameDecoder {
String type = buf.toString(buf.readerIndex(), 2, StandardCharsets.US_ASCII);
switch (type) {
// FLEX 1.0
- case "~A":
- length = flexDataSize * buf.getByte(buf.readerIndex() + FLEX_HEADER_LENGTH) + 1 + 1;
- break;
- case "~T":
- length = flexDataSize + 4 + 1;
- break;
- case "~C":
- length = flexDataSize + 1;
- break;
+ case "~A" -> length = flexDataSize * buf.getByte(buf.readerIndex() + FLEX_HEADER_LENGTH) + 1 + 1;
+ case "~T" -> length = flexDataSize + 4 + 1;
+ case "~C" -> length = flexDataSize + 1;
+
// FLEX 2.0 (Extra packages)
- case "~E":
+ case "~E" -> {
length++;
for (int i = 0; i < buf.getByte(buf.readerIndex() + FLEX_HEADER_LENGTH); i++) {
if (buf.readableBytes() > FLEX_HEADER_LENGTH + length + 1) {
@@ -77,12 +72,11 @@ public class NavisFrameDecoder extends BaseFrameDecoder {
}
}
length++;
- break;
- case "~X":
- length = buf.getUnsignedShortLE(buf.readerIndex() + FLEX_HEADER_LENGTH) + 4 + 1;
- break;
- default:
+ }
+ case "~X" -> length = buf.getUnsignedShortLE(buf.readerIndex() + FLEX_HEADER_LENGTH) + 4 + 1;
+ default -> {
return null;
+ }
}
if (buf.readableBytes() >= FLEX_HEADER_LENGTH + length) {