aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorcz-vilda <cz-vilda@users.noreply.github.com>2017-05-10 23:56:56 +0200
committerGitHub <noreply@github.com>2017-05-10 23:56:56 +0200
commita51e0dcf72973054da8abd45296498d6664484e9 (patch)
treecd1e5323c57255fa85d77231526645dab9e3c0f4 /src/org/traccar
parent257fceb3d8d844bdd9edb5f38e90387ab856670a (diff)
downloadtrackermap-server-a51e0dcf72973054da8abd45296498d6664484e9.tar.gz
trackermap-server-a51e0dcf72973054da8abd45296498d6664484e9.tar.bz2
trackermap-server-a51e0dcf72973054da8abd45296498d6664484e9.zip
Extend xexun protocol - kn and kmh
Updated xexun protocol to be able to use kmh as source speed.
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index 4d44c2326..303864c3f 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -109,7 +109,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));