aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-03-24 11:45:19 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-03-24 11:45:19 +1300
commit799fb0de7dd7fae0d307985f6b2975c077c262d3 (patch)
tree70e58e4c90e96a0e0dbe99bc890dcc48c9153178
parent2fa162dd6043fb8b329d3ec7b306ade76d5007b8 (diff)
downloadtraccar-server-799fb0de7dd7fae0d307985f6b2975c077c262d3.tar.gz
traccar-server-799fb0de7dd7fae0d307985f6b2975c077c262d3.tar.bz2
traccar-server-799fb0de7dd7fae0d307985f6b2975c077c262d3.zip
Fix Castel commands encoding
-rw-r--r--src/org/traccar/protocol/CastelProtocolEncoder.java4
-rw-r--r--test/org/traccar/protocol/CastelProtocolEncoderTest.java2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/CastelProtocolEncoder.java b/src/org/traccar/protocol/CastelProtocolEncoder.java
index 7ba33ca6d..806dac19e 100644
--- a/src/org/traccar/protocol/CastelProtocolEncoder.java
+++ b/src/org/traccar/protocol/CastelProtocolEncoder.java
@@ -35,9 +35,9 @@ public class CastelProtocolEncoder extends BaseProtocolEncoder {
buf.writeByte('@');
buf.writeByte('@');
- buf.writeShort(2 + 2 + 1 + 20 + content.readableBytes()); // length
+ buf.writeShort(2 + 2 + 1 + 20 + 2 + content.readableBytes() + 2 + 2); // length
- buf.writeByte(4); // protocol version
+ buf.writeByte(1); // protocol version
buf.writeBytes(uniqueId.getBytes(StandardCharsets.US_ASCII));
buf.writeZero(20 - uniqueId.length());
diff --git a/test/org/traccar/protocol/CastelProtocolEncoderTest.java b/test/org/traccar/protocol/CastelProtocolEncoderTest.java
index fc0a92c86..bcb93a010 100644
--- a/test/org/traccar/protocol/CastelProtocolEncoderTest.java
+++ b/test/org/traccar/protocol/CastelProtocolEncoderTest.java
@@ -15,7 +15,7 @@ public class CastelProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
- verifyCommand(encoder, command, binary("40401a00043132333435363738393031323334350000000000458301fe6a0d0a"));
+ verifyCommand(encoder, command, binary("40402000013132333435363738393031323334350000000000458301a94a0d0a"));
}