aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-08-29 20:30:58 +1200
committerGitHub <noreply@github.com>2017-08-29 20:30:58 +1200
commit2ff8f21543727590a0f66adc9fc72b0dd6b5e2c9 (patch)
tree1350de42db8122ba3095468e313439dc8520dca5
parent6285adfbc85ada862b4d2d3f8a0621a2f32cb29f (diff)
parentac2d2723086b086d8c27a533b6f7c4888d04e63b (diff)
downloadtrackermap-server-2ff8f21543727590a0f66adc9fc72b0dd6b5e2c9.tar.gz
trackermap-server-2ff8f21543727590a0f66adc9fc72b0dd6b5e2c9.tar.bz2
trackermap-server-2ff8f21543727590a0f66adc9fc72b0dd6b5e2c9.zip
Merge pull request #3481 from AnshulJain1985/GT06_Alarm
GT06 alarm packet issue
-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"));
+
+
}
}