aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index c280ee9b2..9f54c8486 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -493,7 +493,18 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
break;
case 0xD5:
- position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
+ if (length == 2) {
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
+ } else {
+ int count = buf.readUnsignedByte();
+ for (int i = 1; i <= count; i++) {
+ position.set("lock" + i + "Id", ByteBufUtil.hexDump(buf.readSlice(5)));
+ position.set("lock" + i + "Card", ByteBufUtil.hexDump(buf.readSlice(5)));
+ position.set("lock" + i + "Battery", buf.readUnsignedByte());
+ int status = buf.readUnsignedShort();
+ position.set("lock" + i + "Locked", !BitUtil.check(status, 5));
+ }
+ }
break;
case 0xDA:
buf.readUnsignedShort(); // string cut count