From ac2d2723086b086d8c27a533b6f7c4888d04e63b Mon Sep 17 00:00:00 2001 From: Anshul Jain Date: Tue, 29 Aug 2017 13:22:10 +0530 Subject: Move extended LBS data to skip in decodeExtended instead of decodeLBS. --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/org/traccar') 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 -- cgit v1.2.3