aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-08-27 22:12:52 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2014-08-27 22:12:52 +1200
commit82a47eee96b4098ebfffa1cea4e1cd7895511564 (patch)
tree64b27823a23c9ed54934f04d4e8a68a72b4706f1 /src/org/traccar
parent2ba8c5218542ff71ff4087ddaefffa0fb572024d (diff)
downloadtrackermap-server-82a47eee96b4098ebfffa1cea4e1cd7895511564.tar.gz
trackermap-server-82a47eee96b4098ebfffa1cea4e1cd7895511564.tar.bz2
trackermap-server-82a47eee96b4098ebfffa1cea4e1cd7895511564.zip
Fix GT06 protocol decoder
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java11
1 files changed, 8 insertions, 3 deletions
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;