aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-09-16 18:17:28 -0700
committerAnton Tananaev <anton@traccar.org>2022-09-16 18:17:28 -0700
commit729bf987349dc9230293140139dd8ad10b7de107 (patch)
treefd7ddbfa1afe137f077027330fa4eb6677cbf03b /src/main
parent73407e12acce8061cc1aa3d18517569368707864 (diff)
downloadtrackermap-server-729bf987349dc9230293140139dd8ad10b7de107.tar.gz
trackermap-server-729bf987349dc9230293140139dd8ad10b7de107.tar.bz2
trackermap-server-729bf987349dc9230293140139dd8ad10b7de107.zip
Handle multiple DT700 sensors
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java18
1 files changed, 10 insertions, 8 deletions
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) {