aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/RecodaProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-08 23:57:59 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-08 23:57:59 +1200
commitfb543fb413652f4cb0408a6caafbdd7f4a4ca369 (patch)
treebda13c8001013f586ec7062608addf1b7e5a83ed /src/org/traccar/protocol/RecodaProtocolDecoder.java
parentecb7bb33fcec52491f917dbc65a82990dcddb808 (diff)
downloadtrackermap-server-fb543fb413652f4cb0408a6caafbdd7f4a4ca369.tar.gz
trackermap-server-fb543fb413652f4cb0408a6caafbdd7f4a4ca369.tar.bz2
trackermap-server-fb543fb413652f4cb0408a6caafbdd7f4a4ca369.zip
Migrate R and S protocols
Diffstat (limited to 'src/org/traccar/protocol/RecodaProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/RecodaProtocolDecoder.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/org/traccar/protocol/RecodaProtocolDecoder.java b/src/org/traccar/protocol/RecodaProtocolDecoder.java
index 7bd4d3dae..c948ff1b7 100644
--- a/src/org/traccar/protocol/RecodaProtocolDecoder.java
+++ b/src/org/traccar/protocol/RecodaProtocolDecoder.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,8 +15,8 @@
*/
package org.traccar.protocol;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.channel.Channel;
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
import org.traccar.helper.BitUtil;
@@ -43,14 +43,14 @@ public class RecodaProtocolDecoder extends BaseProtocolDecoder {
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
- ChannelBuffer buf = (ChannelBuffer) msg;
+ ByteBuf buf = (ByteBuf) msg;
- int type = buf.readInt();
- buf.readUnsignedInt(); // length
+ int type = buf.readIntLE();
+ buf.readUnsignedIntLE(); // length
if (type != MSG_HEARTBEAT) {
- buf.readUnsignedShort(); // version
- buf.readUnsignedShort(); // index
+ buf.readUnsignedShortLE(); // version
+ buf.readUnsignedShortLE(); // index
}
if (type == MSG_SIGNAL_LINK_REGISTRATION) {
@@ -67,21 +67,21 @@ public class RecodaProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
- position.setTime(new Date(buf.readLong()));
+ position.setTime(new Date(buf.readLongLE()));
int flags = buf.readUnsignedByte();
if (BitUtil.check(flags, 0)) {
- buf.readUnsignedShort(); // declination
+ buf.readUnsignedShortLE(); // declination
- position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
+ position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShortLE()));
position.setLongitude(buf.readUnsignedByte() + buf.readUnsignedByte() / 60.0);
position.setLatitude(buf.readUnsignedByte() + buf.readUnsignedByte() / 60.0);
- position.setLongitude(position.getLongitude() + buf.readUnsignedInt() / 3600.0);
- position.setLatitude(position.getLatitude() + buf.readUnsignedInt() / 3600.0);
+ position.setLongitude(position.getLongitude() + buf.readUnsignedIntLE() / 3600.0);
+ position.setLatitude(position.getLatitude() + buf.readUnsignedIntLE() / 3600.0);
int status = buf.readUnsignedByte();