diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-05-15 21:52:39 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-05-15 21:52:39 -0700 |
commit | 60eaf3b8dea078acc7a08318e072c335c189043a (patch) | |
tree | 3efad7c77ec993392642bc0daa10408a012cdf15 /src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java | |
parent | c10492f8d2324fa8ba8cdf18f864326b5ca01753 (diff) | |
download | trackermap-server-60eaf3b8dea078acc7a08318e072c335c189043a.tar.gz trackermap-server-60eaf3b8dea078acc7a08318e072c335c189043a.tar.bz2 trackermap-server-60eaf3b8dea078acc7a08318e072c335c189043a.zip |
No line break for binary commands
Diffstat (limited to 'src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java b/src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java index 705d01d07..5380cf3a0 100644 --- a/src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java +++ b/src/main/java/org/traccar/protocol/TeltonikaProtocolEncoder.java @@ -32,14 +32,12 @@ public class TeltonikaProtocolEncoder extends BaseProtocolEncoder { ByteBuf buf = Unpooled.buffer(); buf.writeInt(0); - buf.writeInt(content.length + 10); + buf.writeInt(content.length + 8); buf.writeByte(TeltonikaProtocolDecoder.CODEC_12); buf.writeByte(1); // quantity buf.writeByte(5); // type - buf.writeInt(content.length + 2); + buf.writeInt(content.length); buf.writeBytes(content); - buf.writeByte('\r'); - buf.writeByte('\n'); buf.writeByte(1); // quantity buf.writeInt(Checksum.crc16(Checksum.CRC16_IBM, buf.nioBuffer(8, buf.writerIndex() - 8))); @@ -54,7 +52,7 @@ public class TeltonikaProtocolEncoder extends BaseProtocolEncoder { if (data.matches("(\\p{XDigit}{2})+")) { return encodeContent(DataConverter.parseHex(data)); } else { - return encodeContent(data.getBytes(StandardCharsets.US_ASCII)); + return encodeContent((data + "\r\n").getBytes(StandardCharsets.US_ASCII)); } } else { return null; |