aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-08-23 11:23:31 +0500
committerAbyss777 <abyss@fox5.ru>2016-08-23 11:23:31 +0500
commitf9065826c7855d1344ba75a4eb46da325eb91cab (patch)
tree8b07a5f6c4e272eb3d574ad2398442b07c848fe6
parent16ae4c2e1b03c38f9f21791d844959764892f8d0 (diff)
downloadtrackermap-server-f9065826c7855d1344ba75a4eb46da325eb91cab.tar.gz
trackermap-server-f9065826c7855d1344ba75a4eb46da325eb91cab.tar.bz2
trackermap-server-f9065826c7855d1344ba75a4eb46da325eb91cab.zip
- Fixed GL200 odometer units
- Fixed ReportUtilsTest
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java10
-rw-r--r--test/org/traccar/reports/ReportUtilsTest.java2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 148fc6357..385039399 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -308,7 +308,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
parser.skip(4); // alternative networks
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
}
private Object decodeObd(Channel channel, SocketAddress remoteAddress, String sentence) {
@@ -392,7 +392,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_POWER, power);
}
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
position.set(Position.KEY_BATTERY, parser.next());
position.set(Position.KEY_ODOMETER, parser.next());
@@ -446,7 +446,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
decodeLocation(position, parser);
position.set(Position.KEY_HOURS, parser.next());
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
if (parser.hasNext(6)) {
DateBuilder dateBuilder = new DateBuilder()
@@ -479,7 +479,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
decodeLocation(position, parser);
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
if (parser.hasNext(6)) {
DateBuilder dateBuilder = new DateBuilder()
@@ -518,7 +518,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ODOMETER, parser.next());
position.set(Position.KEY_BATTERY, parser.next());
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
// workaround for wrong location time
if (parser.hasNext(6)) {
diff --git a/test/org/traccar/reports/ReportUtilsTest.java b/test/org/traccar/reports/ReportUtilsTest.java
index 2e01505db..9a30ce3a7 100644
--- a/test/org/traccar/reports/ReportUtilsTest.java
+++ b/test/org/traccar/reports/ReportUtilsTest.java
@@ -14,7 +14,7 @@ public class ReportUtilsTest {
endPosition.set(Position.KEY_TOTAL_DISTANCE, 700.0);
Assert.assertEquals(ReportUtils.calculateDistance(startPosition, endPosition), 200.0, 10);
startPosition.set(Position.KEY_ODOMETER, 50000);
- endPosition.set(Position.KEY_ODOMETER, 50001);
+ endPosition.set(Position.KEY_ODOMETER, 51000);
Assert.assertEquals(ReportUtils.calculateDistance(startPosition, endPosition), 1000.0, 10);
}