diff options
author | Iván Ávalos <avalos@disroot.org> | 2024-08-03 20:52:00 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2024-08-03 20:52:00 -0600 |
commit | 55f6d92c09a5b1d8566b53633d07be3d31010d3b (patch) | |
tree | b86bed801b0bbadb72c7e839296dae1d28b12bbb /src/main/java/org/traccar/protocol/RoboTrackFrameDecoder.java | |
parent | c04ad7d48331253c095fc123ded1b00f6ff871d3 (diff) | |
parent | 2788174193def918a3a1a5be3bbed24c9613323f (diff) | |
download | trackermap-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/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 |