aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/AstraProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/ContinentalProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Mta6ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/MxtProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/VtfmsProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/XirgoProtocolDecoder.java2
10 files changed, 15 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java
index 79dcac72a..e649b52a6 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -549,7 +549,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
}
if ((selector & 0x0020) != 0) {
- position.set(Position.KEY_HOURS, buf.readUnsignedInt());
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(buf.readUnsignedInt()));
position.set("serviceDistance", buf.readInt());
position.set("driverActivity", buf.readUnsignedByte());
position.set(Position.KEY_THROTTLE, buf.readUnsignedByte());
diff --git a/src/org/traccar/protocol/AstraProtocolDecoder.java b/src/org/traccar/protocol/AstraProtocolDecoder.java
index 79c7eba3f..7f247251d 100644
--- a/src/org/traccar/protocol/AstraProtocolDecoder.java
+++ b/src/org/traccar/protocol/AstraProtocolDecoder.java
@@ -106,7 +106,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(status, 8)) {
position.set(Position.KEY_DRIVER_UNIQUE_ID, buf.readBytes(7).toString(StandardCharsets.US_ASCII));
position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium() * 1000);
- position.set(Position.KEY_HOURS, buf.readUnsignedShort());
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(buf.readUnsignedShort()));
}
if (BitUtil.check(status, 6)) {
diff --git a/src/org/traccar/protocol/ContinentalProtocolDecoder.java b/src/org/traccar/protocol/ContinentalProtocolDecoder.java
index 37913b657..5ea1d3246 100644
--- a/src/org/traccar/protocol/ContinentalProtocolDecoder.java
+++ b/src/org/traccar/protocol/ContinentalProtocolDecoder.java
@@ -94,7 +94,7 @@ public class ContinentalProtocolDecoder extends BaseProtocolDecoder {
}
if (buf.readableBytes() > 4) {
- position.set(Position.KEY_HOURS, buf.readUnsignedInt());
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(buf.readUnsignedInt()));
}
return position;
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
index abced9ac3..1c7fe4688 100644
--- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -609,7 +609,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_THROTTLE, Integer.parseInt(values[index - 1]));
}
if (BitUtil.check(reportMask, 11)) {
- position.set(Position.KEY_HOURS, (long) Double.parseDouble(values[index++]) * 3600000);
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(Double.parseDouble(values[index++])));
}
if (BitUtil.check(reportMask, 12)) {
position.set("drivingHours", Double.parseDouble(values[index++]));
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 43481889a..3d31326ae 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -21,6 +21,7 @@ import org.traccar.DeviceSession;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
+import org.traccar.helper.UnitsConverter;
import org.traccar.model.CellTower;
import org.traccar.model.Network;
import org.traccar.model.Position;
@@ -253,7 +254,10 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ODOMETER, parser.nextInt(0));
parser.nextDouble(0); // instant fuel consumption
position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble(0));
- position.set(Position.KEY_HOURS, parser.nextInt());
+ Integer hours = parser.nextInt();
+ if (hours != null) {
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(hours));
+ }
position.set(Position.KEY_OBD_SPEED, parser.nextInt(0));
position.set(Position.KEY_ENGINE_LOAD, parser.next());
position.set(Position.KEY_COOLANT_TEMP, parser.nextInt());
diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
index c26e00c56..13b187e80 100644
--- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
@@ -29,6 +29,7 @@ import org.traccar.Protocol;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Log;
+import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -231,7 +232,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(flags, 1)) {
position.set(Position.KEY_FUEL_CONSUMPTION, new FloatReader().readFloat(buf));
- position.set(Position.KEY_HOURS, new FloatReader().readFloat(buf));
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(new FloatReader().readFloat(buf)));
position.set("tank", buf.readUnsignedByte() * 0.4);
}
diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java
index 9fe1924c0..a97ae380d 100644
--- a/src/org/traccar/protocol/MxtProtocolDecoder.java
+++ b/src/org/traccar/protocol/MxtProtocolDecoder.java
@@ -145,7 +145,7 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(infoGroups, 4)) {
- position.set(Position.KEY_HOURS, buf.readUnsignedInt());
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromMinutes(buf.readUnsignedInt()));
}
if (BitUtil.check(infoGroups, 5)) {
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index b739e699b..efaf19b93 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -239,7 +239,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
if (hbm) {
if (index < values.length) {
- position.set(Position.KEY_HOURS, Integer.parseInt(values[index++]));
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromMinutes(Integer.parseInt(values[index++])));
}
if (index < values.length) {
diff --git a/src/org/traccar/protocol/VtfmsProtocolDecoder.java b/src/org/traccar/protocol/VtfmsProtocolDecoder.java
index dc2171022..736a27a64 100644
--- a/src/org/traccar/protocol/VtfmsProtocolDecoder.java
+++ b/src/org/traccar/protocol/VtfmsProtocolDecoder.java
@@ -133,7 +133,7 @@ public class VtfmsProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));
- position.set(Position.KEY_HOURS, parser.nextInt());
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(parser.nextInt()));
position.set("idleHours", parser.nextInt());
position.set(Position.KEY_ODOMETER, parser.nextInt() * 100);
position.set(Position.KEY_CHARGE, parser.next().equals("1"));
diff --git a/src/org/traccar/protocol/XirgoProtocolDecoder.java b/src/org/traccar/protocol/XirgoProtocolDecoder.java
index 461503af1..5cda4aed3 100644
--- a/src/org/traccar/protocol/XirgoProtocolDecoder.java
+++ b/src/org/traccar/protocol/XirgoProtocolDecoder.java
@@ -232,7 +232,7 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_OUT + 1, parser.nextInt());
position.set(Position.PREFIX_ADC + 1, parser.nextDouble());
position.set(Position.KEY_FUEL_LEVEL, parser.nextDouble());
- position.set(Position.KEY_HOURS, parser.nextInt());
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(parser.nextInt()));
position.set("oilPressure", parser.nextInt());
position.set("oilLevel", parser.nextInt());
position.set("oilTemp", parser.nextInt());