diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-07-07 20:38:11 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-07-07 20:38:11 -0700 |
commit | c915753bb9490796f3ce27c7b07d50370fdf67e5 (patch) | |
tree | 43413f72353f2ca4355d445237ccd6354325e281 /src/main/java/org/traccar/protocol/KhdProtocolDecoder.java | |
parent | 55b07acf8c94e00dff477c293e51edcd89bf71c5 (diff) | |
download | trackermap-server-c915753bb9490796f3ce27c7b07d50370fdf67e5.tar.gz trackermap-server-c915753bb9490796f3ce27c7b07d50370fdf67e5.tar.bz2 trackermap-server-c915753bb9490796f3ce27c7b07d50370fdf67e5.zip |
Support 900E fuel level
Diffstat (limited to 'src/main/java/org/traccar/protocol/KhdProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/KhdProtocolDecoder.java | 8 |
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(); |