aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-03-16 19:58:26 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-03-16 19:58:26 +1300
commit34a5b8ceaff6617a8958ce04fb6c7f65d1d19979 (patch)
treec66c9280ca6be9ba4501beef7c8469026d1a25fd /src/org
parent0933f39774235641b1f4bdd1e1402b71bf9be9ed (diff)
downloadtrackermap-server-34a5b8ceaff6617a8958ce04fb6c7f65d1d19979.tar.gz
trackermap-server-34a5b8ceaff6617a8958ce04fb6c7f65d1d19979.tar.bz2
trackermap-server-34a5b8ceaff6617a8958ce04fb6c7f65d1d19979.zip
Fix Castel command encoding
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/CastelProtocolEncoder.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/CastelProtocolEncoder.java b/src/org/traccar/protocol/CastelProtocolEncoder.java
index d69fc62cf..7ba33ca6d 100644
--- a/src/org/traccar/protocol/CastelProtocolEncoder.java
+++ b/src/org/traccar/protocol/CastelProtocolEncoder.java
@@ -28,7 +28,7 @@ import java.nio.charset.StandardCharsets;
public class CastelProtocolEncoder extends BaseProtocolEncoder {
- private ChannelBuffer encodeContent(long deviceId, int type, ChannelBuffer content) {
+ private ChannelBuffer encodeContent(long deviceId, short type, ChannelBuffer content) {
ChannelBuffer buf = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 0);
String uniqueId = Context.getIdentityManager().getById(deviceId).getUniqueId();
@@ -42,7 +42,7 @@ public class CastelProtocolEncoder extends BaseProtocolEncoder {
buf.writeBytes(uniqueId.getBytes(StandardCharsets.US_ASCII));
buf.writeZero(20 - uniqueId.length());
- buf.writeShort(type);
+ buf.writeShort(ChannelBuffers.swapShort(type));
buf.writeBytes(content);
buf.writeShort(Checksum.crc16(Checksum.CRC16_X25, buf.toByteBuffer()));