diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-06-06 23:14:56 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-06 23:14:56 +1200 |
commit | 6520327938582d5e4928d78fc70f95c60e9ac909 (patch) | |
tree | e9c8e8e14d5e8db8271475fdd0d511adc320aee6 /src/org/traccar/protocol/WatchFrameDecoder.java | |
parent | 681b8f42633d7c6741e6fbac4308ba25c4aff9fa (diff) | |
parent | c8028d9b85dd9a5cf6f75de6be64a7aadf56e9a6 (diff) | |
download | trackermap-server-6520327938582d5e4928d78fc70f95c60e9ac909.tar.gz trackermap-server-6520327938582d5e4928d78fc70f95c60e9ac909.tar.bz2 trackermap-server-6520327938582d5e4928d78fc70f95c60e9ac909.zip |
Merge pull request #3913 from Abyss777/netty4_yxw
Migrate Y, X, W protocols
Diffstat (limited to 'src/org/traccar/protocol/WatchFrameDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/WatchFrameDecoder.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/WatchFrameDecoder.java b/src/org/traccar/protocol/WatchFrameDecoder.java index 0009ef30f..1e2f0cea3 100644 --- a/src/org/traccar/protocol/WatchFrameDecoder.java +++ b/src/org/traccar/protocol/WatchFrameDecoder.java @@ -15,19 +15,20 @@ */ package org.traccar.protocol; -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.ChannelHandlerContext; -import org.jboss.netty.handler.codec.frame.FrameDecoder; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandlerContext; import java.nio.charset.StandardCharsets; -public class WatchFrameDecoder extends FrameDecoder { +import org.traccar.BaseFrameDecoder; + +public class WatchFrameDecoder extends BaseFrameDecoder { @Override protected Object decode( - ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception { + ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception { int idIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '*') + 1; if (idIndex <= 0) { @@ -56,7 +57,7 @@ public class WatchFrameDecoder extends FrameDecoder { int length = Integer.parseInt( buf.toString(lengthIndex, payloadIndex - lengthIndex, StandardCharsets.US_ASCII), 16); if (buf.readableBytes() >= payloadIndex + 1 + length + 1) { - ChannelBuffer frame = ChannelBuffers.dynamicBuffer(); + ByteBuf frame = Unpooled.buffer(); int endIndex = buf.readerIndex() + payloadIndex + 1 + length + 1; while (buf.readerIndex() < endIndex) { byte b = buf.readByte(); |