From 42af749b78de2d83a3b8ccba6974c8a8c990f77e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 4 Nov 2020 22:18:05 -0800 Subject: Support Carscop CCTR-830G-4G --- .../java/org/traccar/protocol/HuabaoProtocolDecoder.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/main/java/org/traccar') 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; -- cgit v1.2.3