diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-01-04 16:27:56 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-01-04 16:27:56 -0800 |
commit | d0a7032d6e391fc2148d8d91baf1543ac403af96 (patch) | |
tree | 9703855001d6a11b1458952786dcbf9a61750172 /src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java | |
parent | 02c799327874a238e7d514a7f050695f53c2c06b (diff) | |
download | trackermap-server-d0a7032d6e391fc2148d8d91baf1543ac403af96.tar.gz trackermap-server-d0a7032d6e391fc2148d8d91baf1543ac403af96.tar.bz2 trackermap-server-d0a7032d6e391fc2148d8d91baf1543ac403af96.zip |
Fix frame decoder
Diffstat (limited to 'src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java b/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java index d6fedc40e..1caf6ceb9 100644 --- a/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java +++ b/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java @@ -31,14 +31,14 @@ public class OmnicommFrameDecoder extends BaseFrameDecoder { return null; } - int endIndex = buf.getUnsignedShortLE(2) + buf.readerIndex() + 5; + int endIndex = buf.getUnsignedShortLE(2) + buf.readerIndex() + 6; if (buf.writerIndex() < endIndex) { return null; } ByteBuf result = Unpooled.buffer(); result.writeByte(buf.readUnsignedByte()); - while (buf.readerIndex() <= endIndex) { + while (buf.readerIndex() < endIndex) { int b = buf.readUnsignedByte(); if (b == 0xDB) { int ext = buf.readUnsignedByte(); @@ -47,11 +47,12 @@ public class OmnicommFrameDecoder extends BaseFrameDecoder { } else if (ext == 0xDD) { result.writeByte(0xDB); } + endIndex += 1; } else { result.writeByte(b); } } - return result; + return result; } } |