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