aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/UproProtocolDecoder.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2018-06-07 15:38:00 +0500
committerAbyss777 <abyss@fox5.ru>2018-06-07 15:38:00 +0500
commit757cdb82c9109541ee5e7dc8d8ddca31c8507ca3 (patch)
tree2a6a6ad9018e1de675fdadaadc6929f1163e37f7 /src/org/traccar/protocol/UproProtocolDecoder.java
parent7e324a9dfb2bcde08d1524a9f3dc5114c0d49bdc (diff)
downloadtrackermap-server-757cdb82c9109541ee5e7dc8d8ddca31c8507ca3.tar.gz
trackermap-server-757cdb82c9109541ee5e7dc8d8ddca31c8507ca3.tar.bz2
trackermap-server-757cdb82c9109541ee5e7dc8d8ddca31c8507ca3.zip
Migrate U,V protocols
Diffstat (limited to 'src/org/traccar/protocol/UproProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/UproProtocolDecoder.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/UproProtocolDecoder.java b/src/org/traccar/protocol/UproProtocolDecoder.java
index 28f3d0249..9bbf6eb93 100644
--- a/src/org/traccar/protocol/UproProtocolDecoder.java
+++ b/src/org/traccar/protocol/UproProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 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,9 +15,9 @@
*/
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.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
import org.traccar.helper.BitUtil;
@@ -92,7 +92,7 @@ public class UproProtocolDecoder extends BaseProtocolDecoder {
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
- ChannelBuffer buf = (ChannelBuffer) msg;
+ ByteBuf buf = (ByteBuf) msg;
if (buf.getByte(buf.readerIndex()) != '*') {
throw new ParseException(null, 0);
@@ -126,7 +126,7 @@ public class UproProtocolDecoder extends BaseProtocolDecoder {
channel.write("*MG20Y" + type + subtype + "#");
}
- while (buf.readable()) {
+ while (buf.isReadable()) {
buf.readByte(); // skip delimiter
@@ -137,7 +137,7 @@ public class UproProtocolDecoder extends BaseProtocolDecoder {
delimiterIndex = buf.writerIndex();
}
- ChannelBuffer data = buf.readBytes(delimiterIndex - buf.readerIndex());
+ ByteBuf data = buf.readBytes(delimiterIndex - buf.readerIndex());
switch (dataType) {
case 'A':
@@ -148,7 +148,7 @@ public class UproProtocolDecoder extends BaseProtocolDecoder {
break;
case 'C':
long odometer = 0;
- while (data.readable()) {
+ while (data.isReadable()) {
odometer <<= 4;
odometer += data.readByte() - (byte) '0';
}
@@ -162,13 +162,13 @@ public class UproProtocolDecoder extends BaseProtocolDecoder {
Integer.parseInt(data.readBytes(4).toString(StandardCharsets.US_ASCII), 16))));
break;
case 'Q':
- position.set("obd-pid", ChannelBuffers.hexDump(data));
+ position.set("obd-pid", ByteBufUtil.hexDump(data));
break;
case 'R':
- position.set("odb-travel", ChannelBuffers.hexDump(data));
+ position.set("odb-travel", ByteBufUtil.hexDump(data));
break;
case 'S':
- position.set("obd-traffic", ChannelBuffers.hexDump(data));
+ position.set("obd-traffic", ByteBufUtil.hexDump(data));
break;
default:
break;