aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-30 09:22:33 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-30 09:22:33 +1200
commit520aae604878a1237fde5c99a3dd8d2e97cc19e9 (patch)
tree2c6700f755a24f12e01079db4df94f1d360300e8
parenta8c29ae1508ef9b099860938b2b6911691cba567 (diff)
downloadtrackermap-server-520aae604878a1237fde5c99a3dd8d2e97cc19e9.tar.gz
trackermap-server-520aae604878a1237fde5c99a3dd8d2e97cc19e9.tar.bz2
trackermap-server-520aae604878a1237fde5c99a3dd8d2e97cc19e9.zip
Add TK103 speed unit parameter
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java7
1 files changed, 6 insertions, 1 deletions
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++)));