aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/OmnicommFrameDecoder.java7
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;
}
}