aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-06-22 06:41:05 -0700
committerAnton Tananaev <anton@traccar.org>2023-06-22 06:41:12 -0700
commitd2909b90af2344176d2018bdbb2f410ea6e44465 (patch)
treee8f1875dca29870ac0c04915460f7977998cbbd3
parent55573d0c27373ca8fd76b46b97cfcf6bc8a87e69 (diff)
downloadtrackermap-server-d2909b90af2344176d2018bdbb2f410ea6e44465.tar.gz
trackermap-server-d2909b90af2344176d2018bdbb2f410ea6e44465.tar.bz2
trackermap-server-d2909b90af2344176d2018bdbb2f410ea6e44465.zip
Decode Fifotrack engine hours
-rw-r--r--src/main/java/org/traccar/model/Position.java2
-rw-r--r--src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/model/Position.java b/src/main/java/org/traccar/model/Position.java
index 3ed340703..6685cab95 100644
--- a/src/main/java/org/traccar/model/Position.java
+++ b/src/main/java/org/traccar/model/Position.java
@@ -42,7 +42,7 @@ public class Position extends Message {
public static final String KEY_ODOMETER = "odometer"; // meters
public static final String KEY_ODOMETER_SERVICE = "serviceOdometer"; // meters
public static final String KEY_ODOMETER_TRIP = "tripOdometer"; // meters
- public static final String KEY_HOURS = "hours";
+ public static final String KEY_HOURS = "hours"; // milliseconds
public static final String KEY_STEPS = "steps";
public static final String KEY_HEART_RATE = "heartRate";
public static final String KEY_INPUT = "input";
diff --git a/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
index e0dd1d62d..14b33b67f 100644
--- a/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
@@ -64,7 +64,7 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder {
.number("(d+),") // course
.number("(-?d+),") // altitude
.number("(d+),") // odometer
- .number("d+,") // runtime
+ .number("(d+),") // engine hours
.number("(x+),") // status
.number("(x+)?,") // input
.number("(x+)?,") // output
@@ -290,6 +290,7 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(parser.nextInt());
position.set(Position.KEY_ODOMETER, parser.nextLong());
+ position.set(Position.KEY_HOURS, parser.nextLong() * 1000);
long status = parser.nextHexLong();
position.set(Position.KEY_RSSI, BitUtil.between(status, 3, 8));