diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-24 17:02:52 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-24 17:02:52 -0700 |
commit | 284de955abc4526fd988f350666558f57db1507f (patch) | |
tree | 59dbc46af39f48e993215cb6fb0298d7b2f513ec /src/main/java/org | |
parent | 0ba89aa35180f965e8c8ca85560d7ee7a1849b3c (diff) | |
download | trackermap-server-284de955abc4526fd988f350666558f57db1507f.tar.gz trackermap-server-284de955abc4526fd988f350666558f57db1507f.tar.bz2 trackermap-server-284de955abc4526fd988f350666558f57db1507f.zip |
Decode A1L808 lock info
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 13 |
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 |