From 06e3bd8b16da12baafc9a97ba5949b3f7ffb5e07 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 2 Jun 2018 22:12:44 +1200 Subject: Start Netty 4 migration --- src/org/traccar/protocol/Gt02ProtocolDecoder.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/org/traccar/protocol/Gt02ProtocolDecoder.java') diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java index a4f1a4161..3eb3e193a 100644 --- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java @@ -15,9 +15,10 @@ */ package org.traccar.protocol; -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.jboss.netty.channel.Channel; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufUtil; +import io.netty.buffer.Unpooled; +import io.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; import org.traccar.helper.BitUtil; @@ -42,7 +43,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder { protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { - ChannelBuffer buf = (ChannelBuffer) msg; + ByteBuf buf = (ByteBuf) msg; buf.skipBytes(2); // header buf.readByte(); // size @@ -53,7 +54,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder { int power = buf.readUnsignedByte(); int gsm = buf.readUnsignedByte(); - String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1); + String imei = ByteBufUtil.hexDump(buf.readBytes(8)).substring(1); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei); if (deviceSession == null) { return null; @@ -73,7 +74,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder { if (channel != null) { byte[] response = {0x54, 0x68, 0x1A, 0x0D, 0x0A}; - channel.write(ChannelBuffers.wrappedBuffer(response)); + channel.write(Unpooled.wrappedBuffer(response)); } } else if (type == MSG_DATA) { -- cgit v1.2.3