diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-06-06 20:59:54 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-06 20:59:54 +1200 |
commit | 35bef1115f73da97b15ae3c1de03db1cd6d733c5 (patch) | |
tree | 97e5414d9eeb41fc0c4545c26b5098ac727c2de7 /src/org/traccar/protocol/TeltonikaProtocolEncoder.java | |
parent | eb6475d5087345b7f355fcd55362b955ba5df715 (diff) | |
parent | e091e61f54cabd2442927700d9c689f81fc1ed8b (diff) | |
download | trackermap-server-35bef1115f73da97b15ae3c1de03db1cd6d733c5.tar.gz trackermap-server-35bef1115f73da97b15ae3c1de03db1cd6d733c5.tar.bz2 trackermap-server-35bef1115f73da97b15ae3c1de03db1cd6d733c5.zip |
Merge pull request #3912 from Abyss777/netty4_gl200_teltonika
Migrate gl200 and teltonika to netty 4
Diffstat (limited to 'src/org/traccar/protocol/TeltonikaProtocolEncoder.java')
-rw-r--r-- | src/org/traccar/protocol/TeltonikaProtocolEncoder.java | 13 |
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; } |