aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/KhdProtocolDecoder.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java b/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
index 251351a74..371b0f71c 100644
--- a/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
@@ -162,7 +162,13 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
if (type != MSG_ALARM) {
- position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium());
+ int odometer = buf.readUnsignedMedium();
+ if (BitUtil.to(odometer, 16) > 0) {
+ position.set(Position.KEY_ODOMETER, odometer);
+ } else if (odometer > 0) {
+ position.set(Position.KEY_FUEL_LEVEL, BitUtil.from(odometer, 16));
+ }
+
position.set(Position.KEY_STATUS, buf.readUnsignedInt());
buf.readUnsignedShort();