aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/TeltonikaProtocolEncoder.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2018-06-06 11:01:59 +0500
committerAbyss777 <abyss@fox5.ru>2018-06-06 11:01:59 +0500
commite091e61f54cabd2442927700d9c689f81fc1ed8b (patch)
tree97e5414d9eeb41fc0c4545c26b5098ac727c2de7 /src/org/traccar/protocol/TeltonikaProtocolEncoder.java
parenteb6475d5087345b7f355fcd55362b955ba5df715 (diff)
downloadtrackermap-server-e091e61f54cabd2442927700d9c689f81fc1ed8b.tar.gz
trackermap-server-e091e61f54cabd2442927700d9c689f81fc1ed8b.tar.bz2
trackermap-server-e091e61f54cabd2442927700d9c689f81fc1ed8b.zip
Migrate gl200 and teltonika to netty 4
Diffstat (limited to 'src/org/traccar/protocol/TeltonikaProtocolEncoder.java')
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolEncoder.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolEncoder.java b/src/org/traccar/protocol/TeltonikaProtocolEncoder.java
index fd6eae744..f2680c27c 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolEncoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,20 +15,21 @@
*/
package org.traccar.protocol;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.Checksum;
import org.traccar.helper.Log;
import org.traccar.model.Command;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+
import java.nio.charset.StandardCharsets;
public class TeltonikaProtocolEncoder extends BaseProtocolEncoder {
- private ChannelBuffer encodeContent(String content) {
+ private ByteBuf encodeContent(String content) {
- ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ ByteBuf buf = Unpooled.buffer();
buf.writeInt(0);
buf.writeInt(content.length() + 10);
@@ -40,7 +41,7 @@ public class TeltonikaProtocolEncoder extends BaseProtocolEncoder {
buf.writeByte('\r');
buf.writeByte('\n');
buf.writeByte(1); // quantity
- buf.writeInt(Checksum.crc16(Checksum.CRC16_IBM, buf.toByteBuffer(8, buf.writerIndex() - 8)));
+ buf.writeInt(Checksum.crc16(Checksum.CRC16_IBM, buf.nioBuffer(8, buf.writerIndex() - 8)));
return buf;
}