From 5b56c2cc17fa23251b1985aa4d8f56dd6552b970 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 19 Jul 2017 21:23:48 +1200 Subject: Implement JV200 ignition support --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') 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); -- cgit v1.2.3