aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-08-23 11:03:31 +0500
committerAbyss777 <abyss@fox5.ru>2016-08-23 11:03:31 +0500
commit16ae4c2e1b03c38f9f21791d844959764892f8d0 (patch)
tree217530ae767235624a6f8ff37c27e6d470086aa2 /src/org/traccar/protocol
parent6c6b62351aadd68928b9bd3e39e2bf96d78695e8 (diff)
downloadtrackermap-server-16ae4c2e1b03c38f9f21791d844959764892f8d0.tar.gz
trackermap-server-16ae4c2e1b03c38f9f21791d844959764892f8d0.tar.bz2
trackermap-server-16ae4c2e1b03c38f9f21791d844959764892f8d0.zip
- Fixed units of KEY_ODOMETER to meters in some protocols
- Fixed some wrong using of odometer and distance - Waiting meters in ReportUtils.calculateDistance
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/AtrackProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/BoxProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/DishaProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/EasyTrackProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Mta6ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/NavisProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/RitiProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/WondexProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/XirgoProtocolDecoder.java4
15 files changed, 19 insertions, 20 deletions
diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java
index 60d5244a0..cb89f9438 100644
--- a/src/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -227,7 +227,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(buf.readUnsignedShort());
position.set(Position.KEY_TYPE, buf.readUnsignedByte());
- position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 0.1);
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 100);
position.set(Position.KEY_HDOP, buf.readUnsignedShort() * 0.1);
position.set(Position.KEY_INPUT, buf.readUnsignedByte());
diff --git a/src/org/traccar/protocol/BoxProtocolDecoder.java b/src/org/traccar/protocol/BoxProtocolDecoder.java
index f0a90ad97..55d3142b2 100644
--- a/src/org/traccar/protocol/BoxProtocolDecoder.java
+++ b/src/org/traccar/protocol/BoxProtocolDecoder.java
@@ -92,7 +92,7 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
position.setCourse(parser.nextDouble());
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_DISTANCE, parser.nextDouble() * 1000);
position.set(Position.KEY_EVENT, parser.next());
int status = parser.nextInt();
diff --git a/src/org/traccar/protocol/DishaProtocolDecoder.java b/src/org/traccar/protocol/DishaProtocolDecoder.java
index fb540c8d3..eb00700d8 100644
--- a/src/org/traccar/protocol/DishaProtocolDecoder.java
+++ b/src/org/traccar/protocol/DishaProtocolDecoder.java
@@ -97,7 +97,7 @@ public class DishaProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_ADC + 1, parser.nextInt());
position.set(Position.PREFIX_ADC + 2, parser.nextInt());
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
position.set(Position.KEY_INPUT, parser.next());
return position;
diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
index 41f395fd9..cec68b967 100644
--- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
@@ -105,7 +105,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
position.set("signal", parser.next());
position.set(Position.KEY_POWER, parser.nextDouble());
position.set("oil", parser.nextInt(16));
- position.set(Position.KEY_ODOMETER, parser.nextInt(16));
+ position.set(Position.KEY_ODOMETER, parser.nextInt(16) * 100);
position.setAltitude(parser.nextDouble());
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index 88c247253..af9f9bbab 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -114,7 +114,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_CHARGE, parser.next());
position.set("tpl", parser.next());
position.set("axle", parser.next());
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_OBD_ODOMETER, parser.next());
return position;
}
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index 372b4cac1..b7193d24b 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -110,7 +110,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
int fuel = buf.readUnsignedByte() << 8;
position.set(Position.KEY_STATUS, buf.readUnsignedInt());
- position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 1000);
fuel += buf.readUnsignedByte();
position.set(Position.KEY_FUEL, fuel);
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index d20532faa..71aae6ca3 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -305,7 +305,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble());
position.setAltitude(parser.nextDouble());
- position.set(Position.KEY_ODOMETER, parser.nextDouble());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
position.set(Position.KEY_MCC, parser.nextInt());
position.set(Position.KEY_MNC, parser.nextInt());
position.set(Position.KEY_LAC, parser.nextInt(16));
diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
index b6aea9092..1da55f715 100644
--- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
@@ -155,7 +155,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(flags, 3)) {
- position.set(Position.KEY_ODOMETER, buf.readUnsignedShort());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedShort() * 1000);
}
if (BitUtil.check(flags, 4)) {
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java
index 72c5f53c3..03e578fe9 100644
--- a/src/org/traccar/protocol/NavisProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavisProtocolDecoder.java
@@ -147,9 +147,8 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readFloat());
position.setCourse(buf.readUnsignedShort());
- position.set(Position.KEY_ODOMETER, buf.readFloat());
-
- position.set("segment", buf.readFloat()); // last segment
+ position.set(Position.KEY_ODOMETER, buf.readFloat() * 1000);
+ position.set(Position.KEY_DISTANCE, buf.readFloat());
// Segment times
buf.readUnsignedShort();
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
index 1436eb5ac..d925e1b4d 100644
--- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -106,7 +106,7 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
}
}
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
position.set(Position.KEY_RFID, parser.next());
if (parser.hasNext()) {
diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java
index bf041554f..455c1387a 100644
--- a/src/org/traccar/protocol/RitiProtocolDecoder.java
+++ b/src/org/traccar/protocol/RitiProtocolDecoder.java
@@ -73,8 +73,8 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort();
buf.readUnsignedShort();
- position.set("distance", buf.readUnsignedInt());
- position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_DISTANCE, buf.readUnsignedInt());
+ position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedInt());
// Parse GPRMC
int end = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '*');
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index 72c0f6306..e7a689a8b 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -252,7 +252,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
}
position.set(Position.PREFIX_TEMP + 1, parser.next());
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
} else if (pattern == PATTERN3) {
if (parser.hasNext()) {
@@ -314,7 +314,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
position.set(Position.KEY_HDOP, parser.nextDouble());
- position.set(Position.KEY_ODOMETER, parser.nextInt());
+ position.set(Position.KEY_ODOMETER, parser.nextInt() * 1000);
position.setValid(true);
position.setLatitude(parser.nextCoordinate());
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index 2733a568b..7b5dc5ffe 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -49,7 +49,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
switch (type) {
case 2:
- position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium());
+ position.set(Position.KEY_TRIP_ODOMETER, buf.readUnsignedMedium());
break;
case 5:
position.set(Position.KEY_INPUT, buf.readUnsignedByte());
diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java
index d048b9b31..97426d78c 100644
--- a/src/org/traccar/protocol/WondexProtocolDecoder.java
+++ b/src/org/traccar/protocol/WondexProtocolDecoder.java
@@ -115,7 +115,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_EVENT, parser.next());
position.set(Position.KEY_BATTERY, parser.next());
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
position.set(Position.KEY_INPUT, parser.next());
position.set(Position.PREFIX_ADC + 1, parser.next());
position.set(Position.PREFIX_ADC + 2, parser.next());
diff --git a/src/org/traccar/protocol/XirgoProtocolDecoder.java b/src/org/traccar/protocol/XirgoProtocolDecoder.java
index df5665992..830caf6d9 100644
--- a/src/org/traccar/protocol/XirgoProtocolDecoder.java
+++ b/src/org/traccar/protocol/XirgoProtocolDecoder.java
@@ -133,7 +133,7 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_HDOP, parser.next());
if (newFormat) {
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1609.34);
position.set(Position.KEY_FUEL_CONSUMPTION, parser.next());
}
@@ -141,7 +141,7 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_GSM, parser.next());
if (!newFormat) {
- position.set(Position.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1609.34);
}
position.setValid(parser.nextInt() == 1);