diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-03-16 19:58:26 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-03-16 19:58:26 +1300 |
commit | 34a5b8ceaff6617a8958ce04fb6c7f65d1d19979 (patch) | |
tree | c66c9280ca6be9ba4501beef7c8469026d1a25fd /src/org/traccar/protocol | |
parent | 0933f39774235641b1f4bdd1e1402b71bf9be9ed (diff) | |
download | traccar-server-34a5b8ceaff6617a8958ce04fb6c7f65d1d19979.tar.gz traccar-server-34a5b8ceaff6617a8958ce04fb6c7f65d1d19979.tar.bz2 traccar-server-34a5b8ceaff6617a8958ce04fb6c7f65d1d19979.zip |
Fix Castel command encoding
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/CastelProtocolEncoder.java | 4 |
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())); |