aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/PricolProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/PricolProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/PricolProtocolDecoder.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/PricolProtocolDecoder.java b/src/org/traccar/protocol/PricolProtocolDecoder.java
index 577665dcc..b76e5f27f 100644
--- a/src/org/traccar/protocol/PricolProtocolDecoder.java
+++ b/src/org/traccar/protocol/PricolProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 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,11 +15,12 @@
*/
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.Unpooled;
+import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
@@ -37,12 +38,12 @@ public class PricolProtocolDecoder extends BaseProtocolDecoder {
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
- ChannelBuffer buf = (ChannelBuffer) msg;
+ ByteBuf buf = (ByteBuf) msg;
buf.readUnsignedByte(); // header
DeviceSession deviceSession = getDeviceSession(
- channel, remoteAddress, buf.readBytes(7).toString(StandardCharsets.US_ASCII));
+ channel, remoteAddress, buf.readSlice(7).toString(StandardCharsets.US_ASCII));
if (deviceSession == null) {
return null;
}
@@ -86,7 +87,8 @@ public class PricolProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_RPM, buf.readUnsignedShort());
if (channel != null) {
- channel.write(ChannelBuffers.copiedBuffer("ACK", StandardCharsets.US_ASCII), remoteAddress);
+ channel.writeAndFlush(new NetworkMessage(
+ Unpooled.copiedBuffer("ACK", StandardCharsets.US_ASCII), remoteAddress));
}
return position;