aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/OsmAndProtocolDecoder.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-08-29 17:06:14 +0500
committerAbyss777 <abyss@fox5.ru>2017-08-29 17:06:14 +0500
commit72d35d6c63ff80353eae1559d5c5d71c94d137bb (patch)
tree22550a31fad86f044633af278c731173d63398eb /src/org/traccar/protocol/OsmAndProtocolDecoder.java
parenteef6dcea77898d5a917b225cfc8260ed88309a34 (diff)
downloadtrackermap-server-72d35d6c63ff80353eae1559d5c5d71c94d137bb.tar.gz
trackermap-server-72d35d6c63ff80353eae1559d5c5d71c94d137bb.tar.bz2
trackermap-server-72d35d6c63ff80353eae1559d5c5d71c94d137bb.zip
Move common speed converting code to BaseProtocolDecoder
Diffstat (limited to 'src/org/traccar/protocol/OsmAndProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/OsmAndProtocolDecoder.java19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
index 222369f58..c06582a15 100644
--- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java
+++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
@@ -25,9 +25,7 @@ import org.jboss.netty.handler.codec.http.HttpVersion;
import org.jboss.netty.handler.codec.http.QueryStringDecoder;
import org.joda.time.format.ISODateTimeFormat;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.Context;
import org.traccar.DeviceSession;
-import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -40,11 +38,8 @@ import java.util.Map;
public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
- private String speedUnits;
-
public OsmAndProtocolDecoder(OsmAndProtocol protocol) {
super(protocol);
- speedUnits = Context.getConfig().getString("osmand.speedUnits", "kn");
}
private void sendResponse(Channel channel, HttpResponseStatus status) {
@@ -115,19 +110,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(Double.parseDouble(location[1]));
break;
case "speed":
- switch (speedUnits) {
- case "kph":
- position.setSpeed(UnitsConverter.knotsFromKph(Double.parseDouble(value)));
- break;
- case "mps":
- position.setSpeed(UnitsConverter.knotsFromMps(Double.parseDouble(value)));
- break;
- case "mph":
- position.setSpeed(UnitsConverter.knotsFromMph(Double.parseDouble(value)));
- break;
- default:
- position.setSpeed(Double.parseDouble(value));
- }
+ position.setSpeed(convertSpeed(Double.parseDouble(value), "kn"));
break;
case "bearing":
case "heading":