From 729bf987349dc9230293140139dd8ad10b7de107 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 16 Sep 2022 18:17:28 -0700 Subject: Handle multiple DT700 sensors --- .../org/traccar/protocol/HuabaoProtocolDecoder.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index d2b8f1fb5..0639b9dcf 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -514,14 +514,16 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { position.set("cover", BitUtil.check(deviceStatus, 3)); break; case 0xE6: - int sensorIndex = buf.readUnsignedByte(); - buf.skipBytes(6); // mac - position.set( - Position.PREFIX_TEMP + sensorIndex, - buf.readUnsignedByte() + buf.readUnsignedByte() * 0.01); - position.set( - "humidity" + sensorIndex, - buf.readUnsignedByte() + buf.readUnsignedByte() * 0.01); + while (buf.readerIndex() < endIndex) { + int sensorIndex = buf.readUnsignedByte(); + buf.skipBytes(6); // mac + position.set( + Position.PREFIX_TEMP + sensorIndex, + buf.readUnsignedByte() + buf.readUnsignedByte() * 0.01); + position.set( + "humidity" + sensorIndex, + buf.readUnsignedByte() + buf.readUnsignedByte() * 0.01); + } break; case 0xEB: if (buf.getUnsignedShort(buf.readerIndex()) > 200) { -- cgit v1.2.3