diff options
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index b9b156f93..6d57c3339 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -249,7 +249,21 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { .setSecond(BcdUtil.readInteger(buf, 2)); position.setTime(dateBuilder.getDate()); + if (buf.readableBytes() == 20) { + + buf.skipBytes(4); // remaining battery and mileage + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 1000); + position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.1); + buf.readUnsignedInt(); // area id + position.set(Position.KEY_RSSI, buf.readUnsignedByte()); + buf.skipBytes(3); // reserved + + return position; + + } + while (buf.readableBytes() > 2) { + int subtype = buf.readUnsignedByte(); int length = buf.readUnsignedByte(); int endIndex = buf.readerIndex() + length; |