aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java4
-rw-r--r--src/test/java/org/traccar/protocol/OmnicommFrameDecoderTest.java4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java b/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java
index 1caf6ceb9..314f19757 100644
--- a/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java
+++ b/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java
@@ -27,11 +27,11 @@ public class OmnicommFrameDecoder extends BaseFrameDecoder {
protected Object decode(
ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception {
- if (buf.readableBytes() < 10) {
+ if (buf.readableBytes() < 6) {
return null;
}
- int endIndex = buf.getUnsignedShortLE(2) + buf.readerIndex() + 6;
+ int endIndex = buf.getUnsignedShortLE(buf.readerIndex() + 2) + buf.readerIndex() + 6;
if (buf.writerIndex() < endIndex) {
return null;
}
diff --git a/src/test/java/org/traccar/protocol/OmnicommFrameDecoderTest.java b/src/test/java/org/traccar/protocol/OmnicommFrameDecoderTest.java
index 06c6e24eb..ae21de107 100644
--- a/src/test/java/org/traccar/protocol/OmnicommFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OmnicommFrameDecoderTest.java
@@ -11,6 +11,10 @@ public class OmnicommFrameDecoderTest extends ProtocolTest {
OmnicommFrameDecoder decoder = new OmnicommFrameDecoder();
verifyFrame(
+ binary("c08600004566"),
+ decoder.decode(null, null, binary("c08600004566")));
+
+ verifyFrame(
binary("c080080061a61915340100001dec"),
decoder.decode(null, null, binary("c080080061a61915340100001dec")));