aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Jt600ProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/Jt600ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index 5a53f362a..f65a95352 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.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.ByteBufUtil;
+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.BitBuffer;
import org.traccar.helper.BitUtil;
@@ -49,7 +50,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
return degrees + minutes / 60;
}
- private void decodeStatus(Position position, ChannelBuffer buf) {
+ private void decodeStatus(Position position, ByteBuf buf) {
int value = buf.readUnsignedByte();
@@ -84,7 +85,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
}
- private List<Position> decodeBinary(ChannelBuffer buf, Channel channel, SocketAddress remoteAddress) {
+ private List<Position> decodeBinary(ByteBuf buf, Channel channel, SocketAddress remoteAddress) {
List<Position> positions = new LinkedList<>();
@@ -92,7 +93,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
boolean longFormat = buf.getUnsignedByte(buf.readerIndex()) == 0x75;
- String id = String.valueOf(Long.parseLong(ChannelBuffers.hexDump(buf.readBytes(5))));
+ String id = String.valueOf(Long.parseLong(ByteBufUtil.hexDump(buf.readBytes(5))));
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id);
if (deviceSession == null) {
return null;
@@ -332,9 +333,9 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
if (channel != null) {
if (type.equals("U01") || type.equals("U02") || type.equals("U03")) {
- channel.write("(S39)");
+ channel.write(new NetworkMessage("(S39)", remoteAddress));
} else if (type.equals("U06")) {
- channel.write("(S20)");
+ channel.write(new NetworkMessage("(S20)", remoteAddress));
}
}
@@ -345,7 +346,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
- ChannelBuffer buf = (ChannelBuffer) msg;
+ ByteBuf buf = (ByteBuf) msg;
char first = (char) buf.getByte(0);
if (first == '$') {