From 2d920ecec746615281802e068044a3122a0ae90b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 4 May 2016 12:00:39 +1200 Subject: Support for GT06 command response --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index e83ced668..d55ff1f83 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -16,6 +16,7 @@ package org.traccar.protocol; import java.net.SocketAddress; +import java.nio.charset.Charset; import java.util.TimeZone; import org.jboss.netty.buffer.ChannelBuffer; @@ -203,7 +204,27 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } else if (hasDeviceId()) { - if (isSupported(type)) { + if (type == MSG_STRING) { + + Position position = new Position(); + position.setDeviceId(getDeviceId()); + position.setProtocol(getProtocolName()); + + getLastLocation(position, null); + + int commandLength = buf.readUnsignedByte(); + + buf.readUnsignedByte(); // server flag (reserved) + + position.set("command", buf.readBytes(commandLength - 1).toString(Charset.defaultCharset())); + + buf.readUnsignedShort(); // language + + sendResponse(channel, type, buf.readUnsignedShort()); + + return position; + + } else if (isSupported(type)) { Position position = new Position(); position.setDeviceId(getDeviceId()); -- cgit v1.2.3