aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-09-15 18:49:35 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-09-15 18:49:35 +1200
commit059e040546df731827a455cefd5b293c3b14694c (patch)
tree0f740c76eb2ccd9c31c7146c1063f1156d5f2c09
parent24ed72ab26fd31769e334b928316b038b4d8b647 (diff)
downloadtrackermap-server-059e040546df731827a455cefd5b293c3b14694c.tar.gz
trackermap-server-059e040546df731827a455cefd5b293c3b14694c.tar.bz2
trackermap-server-059e040546df731827a455cefd5b293c3b14694c.zip
Update GT06 commands format
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolEncoder.java9
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolEncoderTest.java2
2 files changed, 5 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/org/traccar/protocol/Gt06ProtocolEncoder.java
index c96e49558..09773cc45 100644
--- a/src/org/traccar/protocol/Gt06ProtocolEncoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolEncoder.java
@@ -18,7 +18,6 @@ package org.traccar.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.traccar.BaseProtocolEncoder;
-import org.traccar.helper.ChannelBufferTools;
import org.traccar.helper.Crc;
import org.traccar.model.Command;
@@ -39,13 +38,13 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder {
buf.writeInt(0);
buf.writeBytes(content.getBytes()); // command
- buf.writeShort(0); // message index
+ buf.writeShort(1); // message index
buf.writeShort(Crc.crc16Ccitt(buf.toByteBuffer(2, buf.writerIndex() - 2)));
buf.writeByte('\r');
buf.writeByte('\n');
-
+
return buf;
}
@@ -54,9 +53,9 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder {
switch (command.getType()) {
case Command.TYPE_ENGINE_STOP:
- return encodeContent("DYD,000000#");
+ return encodeContent("DYD#");
case Command.TYPE_ENGINE_RESUME:
- return encodeContent("HFYD,000000#");
+ return encodeContent("HFYD#");
}
return null;
diff --git a/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java b/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java
index 0a79bfca7..b4cee7789 100644
--- a/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java
@@ -18,7 +18,7 @@ public class Gt06ProtocolEncoderTest {
command.setType(Command.TYPE_ENGINE_STOP);
Assert.assertEquals(encoder.encodeCommand(command), ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString(
- "787815800b000000004459442c303030303030230000f5010d0a")));
+ "78780e80040000000044594423000190b10d0a")));
}