diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-07-19 21:23:48 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-07-19 21:23:48 +1200 |
commit | 5b56c2cc17fa23251b1985aa4d8f56dd6552b970 (patch) | |
tree | e46015396235f9d391ab78106ccdf8703b554fb1 /src | |
parent | 73fb44dfb7dea5cdddcb3ab939e9b7a64ae49abb (diff) | |
download | traccar-server-5b56c2cc17fa23251b1985aa4d8f56dd6552b970.tar.gz traccar-server-5b56c2cc17fa23251b1985aa4d8f56dd6552b970.tar.bz2 traccar-server-5b56c2cc17fa23251b1985aa4d8f56dd6552b970.zip |
Implement JV200 ignition support
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/Gt06ProtocolDecoder.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index 24bedcabf..aea3a29f4 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -336,7 +336,6 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1); buf.readUnsignedShort(); // type - // Timezone offset if (dataLength > 10) { int extensionBits = buf.readUnsignedShort(); int hours = (extensionBits >> 4) / 100; @@ -405,7 +404,6 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { int mcc = buf.readUnsignedShort(); int mnc = buf.readUnsignedByte(); - Network network = new Network(); for (int i = 0; i < 7; i++) { network.addCellTower(CellTower.from( @@ -441,10 +439,16 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { decodeStatus(position, buf); } - if (type == MSG_GPS_LBS_1 && buf.readableBytes() == 4 + 6) { + if (type == MSG_GPS_LBS_1 && buf.readableBytes() >= 4 + 6) { position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); } + if (type == MSG_GPS_LBS_2 && buf.readableBytes() >= 3 + 6) { + position.set(Position.KEY_IGNITION, buf.readUnsignedByte() > 0); + position.set(Position.KEY_EVENT, buf.readUnsignedByte()); // reason + position.set(Position.KEY_ARCHIVE, buf.readUnsignedByte() > 0); + } + } else { buf.skipBytes(dataLength); |