aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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")));
}