aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Jt600ProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-07 16:48:41 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-07 16:48:41 +1200
commit7e324a9dfb2bcde08d1524a9f3dc5114c0d49bdc (patch)
tree0e5cba2fe3cc600478fb5f536e9abf485ef976d7 /src/org/traccar/protocol/Jt600ProtocolDecoder.java
parenta9be10be1cf3709a6f6eb5d612c2f5485f12749e (diff)
downloadtraccar-server-7e324a9dfb2bcde08d1524a9f3dc5114c0d49bdc.tar.gz
traccar-server-7e324a9dfb2bcde08d1524a9f3dc5114c0d49bdc.tar.bz2
traccar-server-7e324a9dfb2bcde08d1524a9f3dc5114c0d49bdc.zip
Migrate H, I, J, K protocols
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 == '$') {