From 520aae604878a1237fde5c99a3dd8d2e97cc19e9 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 30 Jun 2015 09:22:33 +1200 Subject: Add TK103 speed unit parameter --- src/org/traccar/protocol/Tk103ProtocolDecoder.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java index ded23da26..3c2466543 100644 --- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java @@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.BaseProtocolDecoder; +import org.traccar.Context; import org.traccar.helper.UnitsConverter; import org.traccar.model.Event; import org.traccar.model.Position; @@ -121,7 +122,11 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(longitude); // Speed - position.setSpeed(UnitsConverter.knotsFromKph(Double.valueOf(parser.group(index++)))); + if (Boolean.valueOf(Context.getProps().getProperty(getProtocolName() + ".mph"))) { + position.setSpeed(UnitsConverter.knotsFromKph(Double.valueOf(parser.group(index++)))); + } else { + position.setSpeed(UnitsConverter.knotsFromMph(Double.valueOf(parser.group(index++)))); + } // Time time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++))); -- cgit v1.2.3