aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java10
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java4
2 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index 8d83638a0..b222cbf58 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -253,6 +253,16 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
if (hasLength) {
length = buf.readUnsignedByte();
if (length == 0) {
+ boolean zeroedData = true;
+ for (int i = buf.readerIndex() + 9; i < buf.readerIndex() + 45 && i < buf.writerIndex(); i++) {
+ if (buf.getByte(i) != 0) {
+ zeroedData = false;
+ break;
+ }
+ }
+ if (zeroedData) {
+ buf.skipBytes(Math.min(buf.readableBytes(), 45));
+ }
return false;
}
}
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index cb0b9330d..22544e596 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -18,6 +18,10 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
"78780D01086471700328358100093F040D0A"));
verifyAttribute(decoder, binary(
+ "78784A1614051C150204EC02777E560C2A2A2A5314AF000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000007E061B0982004B24C00D0A"),
+ Position.KEY_BATTERY_LEVEL, 100);
+
+ verifyAttribute(decoder, binary(
"7979000e941b02084277efef350303eadaed0d0a"),
Position.KEY_DRIVER_UNIQUE_ID, "4277efef");