aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-05-04 12:00:39 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-05-04 12:00:39 +1200
commit2d920ecec746615281802e068044a3122a0ae90b (patch)
treef93a98faef75654f766b4f54ec46e8d4a1500b22 /src/org
parentd0d7c5a12ca7f9b3af7689c86dff7c7928e86d1d (diff)
downloadtraccar-server-2d920ecec746615281802e068044a3122a0ae90b.tar.gz
traccar-server-2d920ecec746615281802e068044a3122a0ae90b.tar.bz2
traccar-server-2d920ecec746615281802e068044a3122a0ae90b.zip
Support for GT06 command response
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java23
1 files changed, 22 insertions, 1 deletions
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());