aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-07-07 20:38:11 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-07-07 20:38:11 -0700
commitc915753bb9490796f3ce27c7b07d50370fdf67e5 (patch)
tree43413f72353f2ca4355d445237ccd6354325e281 /src/main/java
parent55b07acf8c94e00dff477c293e51edcd89bf71c5 (diff)
downloadtrackermap-server-c915753bb9490796f3ce27c7b07d50370fdf67e5.tar.gz
trackermap-server-c915753bb9490796f3ce27c7b07d50370fdf67e5.tar.bz2
trackermap-server-c915753bb9490796f3ce27c7b07d50370fdf67e5.zip
Support 900E fuel level
Diffstat (limited to 'src/main/java')
-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();