aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/AutoFonProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-05 23:16:21 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-05 23:16:21 +1200
commit9c99076dc2416c4e0725007af0e5f2f2f444c05c (patch)
tree55068f2ab5dbe99fcd60acc01c1bb05fc365aa43 /src/org/traccar/protocol/AutoFonProtocolDecoder.java
parentb8f4fc8888aaad7fe384c1dc2b80f44c1683bb03 (diff)
downloadtrackermap-server-9c99076dc2416c4e0725007af0e5f2f2f444c05c.tar.gz
trackermap-server-9c99076dc2416c4e0725007af0e5f2f2f444c05c.tar.bz2
trackermap-server-9c99076dc2416c4e0725007af0e5f2f2f444c05c.zip
Migrate more protocols
Diffstat (limited to 'src/org/traccar/protocol/AutoFonProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
index e243b93ea..cb1ddaca9 100644
--- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
@@ -16,11 +16,13 @@
*/
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.NetworkMessage;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.model.CellTower;
@@ -60,7 +62,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
}
}
- private Position decodePosition(DeviceSession deviceSession, ChannelBuffer buf, boolean history) {
+ private Position decodePosition(DeviceSession deviceSession, ByteBuf buf, boolean history) {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
@@ -118,7 +120,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
- ChannelBuffer buf = (ChannelBuffer) msg;
+ ByteBuf buf = (ByteBuf) msg;
int type = buf.readUnsignedByte();
@@ -129,14 +131,14 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // software version
}
- 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 && channel != null) {
- ChannelBuffer response = ChannelBuffers.dynamicBuffer();
+ ByteBuf response = Unpooled.buffer();
response.writeBytes("resp_crc=".getBytes(StandardCharsets.US_ASCII));
response.writeByte(buf.getByte(buf.writerIndex() - 1));
- channel.write(response);
+ channel.write(new NetworkMessage(response, remoteAddress));
}
return null;