From 82a47eee96b4098ebfffa1cea4e1cd7895511564 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 27 Aug 2014 22:12:52 +1200 Subject: Fix GT06 protocol decoder --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index 8851c0f3e..fef3e2f5b 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -62,6 +62,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { private static final int MSG_LBS_STATUS = 0x19; private static final int MSG_GPS_PHONE = 0x1A; private static final int MSG_GPS_LBS_EXTEND = 0x1E; + private static final int MSG_COMMAND_0 = 0x80; + private static final int MSG_COMMAND_1 = 0x81; + private static final int MSG_COMMAND_2 = 0x82; private static void sendResponse(Channel channel, int type, int index) { if (channel != null) { @@ -88,7 +91,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { return null; } - int length = buf.readByte(); // size + int length = buf.readUnsignedByte(); // size int dataLength = length - 5; int type = buf.readUnsignedByte(); @@ -213,10 +216,12 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { position.setExtendedInfo(extendedInfo.toString()); return position; } - + else { buf.skipBytes(dataLength); - sendResponse(channel, type, buf.readUnsignedShort()); + if (type != MSG_COMMAND_0 && type != MSG_COMMAND_1 && type != MSG_COMMAND_2) { + sendResponse(channel, type, buf.readUnsignedShort()); + } } return null; -- cgit v1.2.3