From c9e760c301fb2867769d842d35e5c51e3bb843d6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 19 Jan 2020 18:42:06 -0800 Subject: Decode fuel data --- .../org/traccar/protocol/HuabaoProtocolDecoder.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/main/java/org') diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index f425ec86f..bf5b6d89a 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -251,6 +251,26 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { case 0xD3: position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.1); break; + case 0xEB: + while (buf.readerIndex() < endIndex) { + int tenetLength = buf.readUnsignedShort(); + int tenetType = buf.readUnsignedShort(); + switch (tenetType) { + case 0x0001: + position.set("fuel1", buf.readUnsignedShort() * 0.1); + buf.readUnsignedByte(); // unused + break; + case 0x0023: + buf.skipBytes(4); // unused + position.set("fuel2", Double.parseDouble( + buf.readCharSequence(2, StandardCharsets.US_ASCII).toString())); + break; + default: + buf.skipBytes(tenetLength - 2); + break; + } + } + break; default: break; } -- cgit v1.2.3