aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnshul Jain <anshuljain1985@gmail.com>2017-08-29 13:22:10 +0530
committerAnshul Jain <anshuljain1985@gmail.com>2017-08-29 13:22:10 +0530
commitac2d2723086b086d8c27a533b6f7c4888d04e63b (patch)
tree169669ec5ea43f530ec86b6913eedeb1b00662d7 /src/org
parenteb96d365786785c6b2d8743c3a57f09bd3021f5f (diff)
downloadtraccar-server-ac2d2723086b086d8c27a533b6f7c4888d04e63b.tar.gz
traccar-server-ac2d2723086b086d8c27a533b6f7c4888d04e63b.tar.bz2
traccar-server-ac2d2723086b086d8c27a533b6f7c4888d04e63b.zip
Move extended LBS data to skip in decodeExtended instead of decodeLBS.
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index cf2b8c928..5c83f9348 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -191,7 +191,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
return true;
}
- private boolean decodeLbs(Position position, ChannelBuffer buf, boolean hasLength, boolean isExtended) {
+ private boolean decodeLbs(Position position, ChannelBuffer buf, boolean hasLength) {
int length = 0;
if (hasLength) {
@@ -205,11 +205,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(), buf.readUnsignedByte(), buf.readUnsignedShort(), buf.readUnsignedMedium())));
if (length > 0) {
- if (hasLength && !isExtended) {
- buf.skipBytes(length - 9);
- } else {
- buf.skipBytes(length - 8);
- }
+ buf.skipBytes(length - (hasLength ? 9 : 8));
}
return true;
@@ -468,7 +464,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
if (hasLbs(type)) {
- decodeLbs(position, buf, hasStatus(type), false);
+ decodeLbs(position, buf, hasStatus(type));
+ buf.skipBytes(-1);
}
if (hasStatus(type)) {
@@ -580,7 +577,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, position.getDeviceTime());
}
- decodeLbs(position, buf, true, 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