aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/RoboTrackFrameDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-07-07 07:33:16 -0700
committerAnton Tananaev <anton@traccar.org>2024-07-07 07:33:16 -0700
commitd0536ccbc1b7234784c5e48288bbac00a60ef821 (patch)
tree29ba8e1349eb9a5990f564edad7ddc7b5e24d7f7 /src/main/java/org/traccar/protocol/RoboTrackFrameDecoder.java
parent864872b2df3e26c94d3a5826f4df504de3cf6c62 (diff)
downloadtrackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.tar.gz
trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.tar.bz2
trackermap-server-d0536ccbc1b7234784c5e48288bbac00a60ef821.zip
Update switch statements
Diffstat (limited to 'src/main/java/org/traccar/protocol/RoboTrackFrameDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/RoboTrackFrameDecoder.java25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/main/java/org/traccar/protocol/RoboTrackFrameDecoder.java b/src/main/java/org/traccar/protocol/RoboTrackFrameDecoder.java
index 85ed6c76f..237519a23 100644
--- a/src/main/java/org/traccar/protocol/RoboTrackFrameDecoder.java
+++ b/src/main/java/org/traccar/protocol/RoboTrackFrameDecoder.java
@@ -23,22 +23,15 @@ import org.traccar.BaseFrameDecoder;
public class RoboTrackFrameDecoder extends BaseFrameDecoder {
private int messageLength(ByteBuf buf) {
- switch (buf.getUnsignedByte(buf.readerIndex())) {
- case RoboTrackProtocolDecoder.MSG_ID:
- return 69;
- case RoboTrackProtocolDecoder.MSG_ACK:
- return 3;
- case RoboTrackProtocolDecoder.MSG_GPS:
- case RoboTrackProtocolDecoder.MSG_GSM:
- case RoboTrackProtocolDecoder.MSG_IMAGE_START:
- return 24;
- case RoboTrackProtocolDecoder.MSG_IMAGE_DATA:
- return 8 + buf.getUnsignedShortLE(buf.readerIndex() + 1);
- case RoboTrackProtocolDecoder.MSG_IMAGE_END:
- return 6;
- default:
- return Integer.MAX_VALUE;
- }
+ return switch (buf.getUnsignedByte(buf.readerIndex())) {
+ case RoboTrackProtocolDecoder.MSG_ID -> 69;
+ case RoboTrackProtocolDecoder.MSG_ACK -> 3;
+ case RoboTrackProtocolDecoder.MSG_GPS, RoboTrackProtocolDecoder.MSG_GSM,
+ RoboTrackProtocolDecoder.MSG_IMAGE_START -> 24;
+ case RoboTrackProtocolDecoder.MSG_IMAGE_DATA -> 8 + buf.getUnsignedShortLE(buf.readerIndex() + 1);
+ case RoboTrackProtocolDecoder.MSG_IMAGE_END -> 6;
+ default -> Integer.MAX_VALUE;
+ };
}
@Override