aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/GatorProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-07 15:53:12 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-07 15:53:12 +1200
commita9be10be1cf3709a6f6eb5d612c2f5485f12749e (patch)
tree8ec498f994dc16855093f8ef575ceeb12cb400a3 /src/org/traccar/protocol/GatorProtocolDecoder.java
parent6520327938582d5e4928d78fc70f95c60e9ac909 (diff)
downloadtrackermap-server-a9be10be1cf3709a6f6eb5d612c2f5485f12749e.tar.gz
trackermap-server-a9be10be1cf3709a6f6eb5d612c2f5485f12749e.tar.bz2
trackermap-server-a9be10be1cf3709a6f6eb5d612c2f5485f12749e.zip
Migrate G protocols
Diffstat (limited to 'src/org/traccar/protocol/GatorProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/GatorProtocolDecoder.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java
index b38214457..5841f6fad 100644
--- a/src/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/GatorProtocolDecoder.java
@@ -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.BcdUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
@@ -58,7 +59,7 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
private void sendResponse(Channel channel, SocketAddress remoteAddress, byte calibration) {
if (channel != null) {
- ChannelBuffer response = ChannelBuffers.dynamicBuffer();
+ ByteBuf response = Unpooled.buffer();
response.writeByte(0x24); response.writeByte(0x24); // header
response.writeByte(MSG_HEARTBEAT); // size
response.writeShort(5);
@@ -67,7 +68,7 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
response.writeByte(0); // slave order
response.writeByte(1); // calibration
response.writeByte(0x0D);
- channel.write(response, remoteAddress);
+ channel.write(new NetworkMessage(response, remoteAddress));
}
}
@@ -75,7 +76,7 @@ public class GatorProtocolDecoder 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
int type = buf.readUnsignedByte();