aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Gt06FrameDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/Gt06FrameDecoder.java')
-rw-r--r--src/org/traccar/protocol/Gt06FrameDecoder.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/Gt06FrameDecoder.java b/src/org/traccar/protocol/Gt06FrameDecoder.java
index ed0d8d548..67f42efb4 100644
--- a/src/org/traccar/protocol/Gt06FrameDecoder.java
+++ b/src/org/traccar/protocol/Gt06FrameDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2014 - 2016 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,9 +24,7 @@ public class Gt06FrameDecoder extends FrameDecoder {
@Override
protected Object decode(
- ChannelHandlerContext ctx,
- Channel channel,
- ChannelBuffer buf) throws Exception {
+ ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception {
// Check minimum length
if (buf.readableBytes() < 5) {
@@ -37,6 +35,12 @@ public class Gt06FrameDecoder extends FrameDecoder {
if (buf.getByte(buf.readerIndex()) == 0x78) {
length += 1 + buf.getUnsignedByte(buf.readerIndex() + 2);
+
+ int type = buf.getUnsignedByte(buf.readerIndex() + 3);
+ if (type == Gt06ProtocolDecoder.MSG_STATUS && length == 13) {
+ length += 2; // workaround for #1727
+ }
+
} else {
length += 2 + buf.getUnsignedShort(buf.readerIndex() + 2);
}