From a51e0dcf72973054da8abd45296498d6664484e9 Mon Sep 17 00:00:00 2001 From: cz-vilda Date: Wed, 10 May 2017 23:56:56 +0200 Subject: Extend xexun protocol - kn and kmh Updated xexun protocol to be able to use kmh as source speed. --- src/org/traccar/protocol/XexunProtocolDecoder.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/org/traccar/protocol') 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)); -- cgit v1.2.3