aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-09-02 20:33:09 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2014-09-02 20:33:09 +1200
commit1f56f881365fbe31736c26c3b5ba848c2fda4f64 (patch)
tree1a4c6a0c77f3e9868c92cb9c79f2dd6779f9f57b /src/org/traccar
parent5601a825b55eedd78e2a95263db7731ff67ed861 (diff)
downloadtraccar-server-1f56f881365fbe31736c26c3b5ba848c2fda4f64.tar.gz
traccar-server-1f56f881365fbe31736c26c3b5ba848c2fda4f64.tar.bz2
traccar-server-1f56f881365fbe31736c26c3b5ba848c2fda4f64.zip
Fix coordinates decoding
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/OrionProtocolDecoder.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/OrionProtocolDecoder.java b/src/org/traccar/protocol/OrionProtocolDecoder.java
index fa04c6dca..1846bba23 100644
--- a/src/org/traccar/protocol/OrionProtocolDecoder.java
+++ b/src/org/traccar/protocol/OrionProtocolDecoder.java
@@ -25,7 +25,6 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.ServerManager;
-import org.traccar.helper.Crc;
import org.traccar.helper.Log;
import org.traccar.model.ExtendedInfoFormatter;
import org.traccar.model.Position;
@@ -49,6 +48,12 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder {
}
}
+ private static double convertCoordinate(int value) {
+ double degrees = value / 1000000;
+ double minutes = (Math.abs(value) % 1000000) / 10000.0;
+ return degrees + minutes / 60;
+ }
+
@Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, Object msg)
@@ -91,8 +96,8 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("flag2", buf.readUnsignedByte());
// Location
- position.setLatitude(buf.readInt() / 10000.0);
- position.setLongitude(buf.readInt() / 10000.0);
+ position.setLatitude(convertCoordinate(buf.readInt()));
+ position.setLongitude(convertCoordinate(buf.readInt()));
position.setAltitude(buf.readShort()/ 10.0);
position.setCourse((double) buf.readUnsignedShort());
position.setSpeed(buf.readUnsignedShort() * 0.0539957);