aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-05-31 11:01:33 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-05-31 11:01:33 +1200
commit4176894097bb9f3d06ff339e9e845c4969ca6874 (patch)
treeadc2f19957d2371621222476cdb4a766a55a227d /src/org
parentd3e34416e9825833fa1db02112c56981999df039 (diff)
downloadtraccar-server-4176894097bb9f3d06ff339e9e845c4969ca6874.tar.gz
traccar-server-4176894097bb9f3d06ff339e9e845c4969ca6874.tar.bz2
traccar-server-4176894097bb9f3d06ff339e9e845c4969ca6874.zip
Support more speed units for TK103
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 9512910f2..36378d088 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -170,10 +170,16 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(parser.nextCoordinate());
position.setLongitude(parser.nextCoordinate());
- if (Context.getConfig().getBoolean(getProtocolName() + ".mph")) {
- position.setSpeed(UnitsConverter.knotsFromMph(parser.nextDouble()));
- } else {
- position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
+ switch (Context.getConfig().getString(getProtocolName() + ".speed", "kmh")) {
+ case "kn":
+ position.setSpeed(parser.nextDouble());
+ break;
+ case "mph":
+ position.setSpeed(UnitsConverter.knotsFromMph(parser.nextDouble()));
+ break;
+ default:
+ position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
+ break;
}
dateBuilder.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());