diff options
author | Abyss777 <abyss@fox5.ru> | 2018-05-29 15:53:57 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2018-05-29 15:53:57 +0500 |
commit | b41af1b39cdaa511dbf53769342ebca5b0348931 (patch) | |
tree | aab63db2a8c0ba29de5cd073770abd9bcad1936a /src/org | |
parent | 03b3ab6adfc0083ae51f6274abc280668553bc58 (diff) | |
download | trackermap-server-b41af1b39cdaa511dbf53769342ebca5b0348931.tar.gz trackermap-server-b41af1b39cdaa511dbf53769342ebca5b0348931.tar.bz2 trackermap-server-b41af1b39cdaa511dbf53769342ebca5b0348931.zip |
Store engine hours in milliseconds for the rest of protocols
Diffstat (limited to 'src/org')
8 files changed, 11 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 79dcac72a..c713399ea 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, buf.readUnsignedInt() * 3600000); 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..e45c51246 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, buf.readUnsignedShort() * 3600000); } if (BitUtil.check(status, 6)) { diff --git a/src/org/traccar/protocol/ContinentalProtocolDecoder.java b/src/org/traccar/protocol/ContinentalProtocolDecoder.java index 37913b657..780a23b72 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, buf.readUnsignedInt() * 3600000); } return position; diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 43481889a..f7baddfbd 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -253,7 +253,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, hours * 3600000); + } 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..8cbe9eee8 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -231,7 +231,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, (long) (new FloatReader().readFloat(buf) * 3600000)); 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..d9dcd9e93 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, buf.readUnsignedInt() * 60000); } if (BitUtil.check(infoGroups, 5)) { diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java index b739e699b..c6b755770 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, Integer.parseInt(values[index++]) * 60000); } if (index < values.length) { diff --git a/src/org/traccar/protocol/XirgoProtocolDecoder.java b/src/org/traccar/protocol/XirgoProtocolDecoder.java index 461503af1..8a5e9ee12 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, parser.nextInt() * 3600000); position.set("oilPressure", parser.nextInt()); position.set("oilLevel", parser.nextInt()); position.set("oilTemp", parser.nextInt()); |