aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-06 10:01:35 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-06 10:02:39 +1200
commitd14cef37937fb64aa54cb497d51afd47b2798fb3 (patch)
treebbf386c4047c5209f978c0c00e71b69108a2df8c
parentbcc20a915c61d7a86fd19b03ec1ab55ac5cf8527 (diff)
downloadtrackermap-server-d14cef37937fb64aa54cb497d51afd47b2798fb3.tar.gz
trackermap-server-d14cef37937fb64aa54cb497d51afd47b2798fb3.tar.bz2
trackermap-server-d14cef37937fb64aa54cb497d51afd47b2798fb3.zip
Fix HuaSheng acknowledgement message
-rw-r--r--src/org/traccar/protocol/HuaShengProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/HuaShengProtocolDecoderTest.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/HuaShengProtocolDecoder.java b/src/org/traccar/protocol/HuaShengProtocolDecoder.java
index ef23f9fc4..6743db47d 100644
--- a/src/org/traccar/protocol/HuaShengProtocolDecoder.java
+++ b/src/org/traccar/protocol/HuaShengProtocolDecoder.java
@@ -41,8 +41,8 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer response = ChannelBuffers.dynamicBuffer();
response.writeByte(0xC0);
response.writeShort(0x0100);
- response.writeShort(response.capacity()); // TODO: length
- response.writeByte(type);
+ response.writeShort(12 + content.readableBytes());
+ response.writeShort(type);
response.writeShort(0);
response.writeInt(1);
response.writeBytes(content);
diff --git a/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java b/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java
index 09fa353b5..269064b02 100644
--- a/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class HuaShengProtocolDecoderTest extends ProtocolTest {
HuaShengProtocolDecoder decoder = new HuaShengProtocolDecoder(new HuaShengProtocol());
verifyNothing(decoder, binary(
+ "c000000077aa0200000000000e000100143347315f48312e315f56312e30372e54000300133335353835353035303434303635380004000b3531323030303000050005010006000400070004000800050000090018383936313032353431343533333239313833360d000a000f796573696e7465726e6574c0"));
+
+ verifyNothing(decoder, binary(
"c0010c003e0002000000000010020012a0014f42445f3347315f56312e302e330013a0043335353835353035303434303635380006a08701000006a0a1035fc0"));
verifyNothing(decoder, binary(