aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-05-12 16:48:15 +1200
committerGitHub <noreply@github.com>2017-05-12 16:48:15 +1200
commit1a55e3903412bf35a0063307efe5458231c65b77 (patch)
tree3fc0c6971f6f2873c75c850475387f20ea74494c /src/org
parent832d448a68eaed31e8a86c7b0d4fce169b51bc4d (diff)
parent48d43ff2b9bb35515e96527bb55b48498dd77dcf (diff)
downloadtrackermap-server-1a55e3903412bf35a0063307efe5458231c65b77.tar.gz
trackermap-server-1a55e3903412bf35a0063307efe5458231c65b77.tar.bz2
trackermap-server-1a55e3903412bf35a0063307efe5458231c65b77.zip
Merge pull request #3157 from cz-vilda/patch-1
Extend xexun protocol - kn and kmh
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index 4d44c2326..2b31f414e 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -17,11 +17,13 @@ package org.traccar.protocol;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.Context;
import org.traccar.DeviceSession;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.model.Position;
+import org.traccar.helper.UnitsConverter;
import java.net.SocketAddress;
import java.util.regex.Pattern;
@@ -109,7 +111,16 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
position.setValid(parser.next().equals("A"));
position.setLatitude(parser.nextCoordinate());
position.setLongitude(parser.nextCoordinate());
- position.setSpeed(parser.nextDouble(0));
+
+ switch (Context.getConfig().getString(getProtocolName() + ".speed", "kn")) {
+ case "kmh":
+ position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));
+ break;
+ default:
+ position.setSpeed(parser.nextDouble(0));
+ break;
+ }
+
position.setCourse(parser.nextDouble(0));
dateBuilder.setDateReverse(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));