diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-23 10:50:10 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-23 10:50:10 +1200 |
commit | 7de3f92aed50668bca4187a3b9fb784923be1b34 (patch) | |
tree | f9886533ebda2b1f8518affe7f7d035dbf26e151 | |
parent | f70d8c57d354438192357c3a0435a8f48183aafe (diff) | |
download | trackermap-server-7de3f92aed50668bca4187a3b9fb784923be1b34.tar.gz trackermap-server-7de3f92aed50668bca4187a3b9fb784923be1b34.tar.bz2 trackermap-server-7de3f92aed50668bca4187a3b9fb784923be1b34.zip |
Fix GT06 commands encoder
-rw-r--r-- | src/org/traccar/protocol/Gt06ProtocolEncoder.java | 3 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gt06ProtocolEncoderTest.java | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/org/traccar/protocol/Gt06ProtocolEncoder.java index 09773cc45..22d62e9e5 100644 --- a/src/org/traccar/protocol/Gt06ProtocolEncoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolEncoder.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.traccar.BaseProtocolEncoder; +import org.traccar.Context; import org.traccar.helper.Crc; import org.traccar.model.Command; @@ -34,7 +35,7 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder { buf.writeByte(0x80); // message type - buf.writeByte(content.length()); // command length + buf.writeByte(4 + content.length()); // command length buf.writeInt(0); buf.writeBytes(content.getBytes()); // command diff --git a/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java b/test/org/traccar/protocol/Gt06ProtocolEncoderTest.java index b4cee7789..586fb0859 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( - "78780e80040000000044594423000190b10d0a"))); + "78780e800800000000445944230001d09e0d0a"))); } |