diff options
author | cz-vilda <cz-vilda@users.noreply.github.com> | 2017-05-10 23:56:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-10 23:56:56 +0200 |
commit | a51e0dcf72973054da8abd45296498d6664484e9 (patch) | |
tree | cd1e5323c57255fa85d77231526645dab9e3c0f4 /src/org | |
parent | 257fceb3d8d844bdd9edb5f38e90387ab856670a (diff) | |
download | traccar-server-a51e0dcf72973054da8abd45296498d6664484e9.tar.gz traccar-server-a51e0dcf72973054da8abd45296498d6664484e9.tar.bz2 traccar-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')
-rw-r--r-- | src/org/traccar/protocol/XexunProtocolDecoder.java | 11 |
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)); |