aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java10
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolDecoderTest.java7
2 files changed, 15 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index d8da7e6de..5c83f9348 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -182,6 +182,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
if (length > 0) {
+ if (length > 12) {
+ length = 12;
+ }
buf.skipBytes(length - 12); // skip reserved
}
@@ -202,7 +205,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(), buf.readUnsignedByte(), buf.readUnsignedShort(), buf.readUnsignedMedium())));
if (length > 0) {
- buf.skipBytes(length - 8);
+ buf.skipBytes(length - (hasLength ? 9 : 8));
}
return true;
@@ -462,6 +465,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
if (hasLbs(type)) {
decodeLbs(position, buf, hasStatus(type));
+ buf.skipBytes(-1);
}
if (hasStatus(type)) {
@@ -573,7 +577,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, position.getDeviceTime());
}
- decodeLbs(position, buf, true);
+ if (decodeLbs(position, buf, true)) {
+ buf.skipBytes(1); //Extended data
+ }
buf.skipBytes(buf.readUnsignedByte()); // additional cell towers
buf.skipBytes(buf.readUnsignedByte()); // wifi access point
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index e449a26d4..4042c3bf0 100644
--- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -161,6 +161,13 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"78780d1f000000000000000200b196a20d0a"));
+ verifyPosition(decoder, binary(
+ "78781f12110819110216d402f250340828924055d4c801944600d300c09501429c830d0a"));
+
+ verifyPosition(decoder, binary(
+ "78782516110819110208d402f264dc08289a4058d4c70901944600d300c0954606040600014057e90d0a"));
+
+
}
}