diff options
author | Anshul Jain <anshuljain1985@gmail.com> | 2017-08-29 13:22:10 +0530 |
---|---|---|
committer | Anshul Jain <anshuljain1985@gmail.com> | 2017-08-29 13:22:10 +0530 |
commit | ac2d2723086b086d8c27a533b6f7c4888d04e63b (patch) | |
tree | 169669ec5ea43f530ec86b6913eedeb1b00662d7 /src/org/traccar/protocol/Gt06ProtocolDecoder.java | |
parent | eb96d365786785c6b2d8743c3a57f09bd3021f5f (diff) | |
download | trackermap-server-ac2d2723086b086d8c27a533b6f7c4888d04e63b.tar.gz trackermap-server-ac2d2723086b086d8c27a533b6f7c4888d04e63b.tar.bz2 trackermap-server-ac2d2723086b086d8c27a533b6f7c4888d04e63b.zip |
Move extended LBS data to skip in decodeExtended instead of decodeLBS.
Diffstat (limited to 'src/org/traccar/protocol/Gt06ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gt06ProtocolDecoder.java | 15 |
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 |