From c915753bb9490796f3ce27c7b07d50370fdf67e5 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 7 Jul 2021 20:38:11 -0700 Subject: Support 900E fuel level --- src/main/java/org/traccar/protocol/KhdProtocolDecoder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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(); -- cgit v1.2.3