diff options
author | Anton Tananaev <anton@traccar.org> | 2022-09-09 17:35:56 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-09-09 17:35:56 -0700 |
commit | 725195a271f4313255b80c99278b3a91cff799e1 (patch) | |
tree | b6d0cbbb4c6966929e92ac07a2ce4003dc641ef9 | |
parent | ff95c7dc0adf17710438f7dd2168d6ad1dd31415 (diff) | |
download | trackermap-server-725195a271f4313255b80c99278b3a91cff799e1.tar.gz trackermap-server-725195a271f4313255b80c99278b3a91cff799e1.tar.bz2 trackermap-server-725195a271f4313255b80c99278b3a91cff799e1.zip |
Add DT700 bluetooth temperature
-rw-r--r-- | src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 10 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index 5393c6f74..d2b8f1fb5 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -513,6 +513,16 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_MOTION, BitUtil.check(deviceStatus, 2)); 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); + break; case 0xEB: if (buf.getUnsignedShort(buf.readerIndex()) > 200) { Network network = new Network(); diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java index 7322185d5..4ef2e25ea 100644 --- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java @@ -12,6 +12,10 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest { var decoder = inject(new HuabaoProtocolDecoder(null)); verifyAttribute(decoder, binary( + "7e0200003d012291302256004800000000000c012300d2648805ff31db000e0000000022090708255503020000a70400000000ac04000002bce5020000e60b01dd34020754fe1bce3efc357e"), + Position.PREFIX_TEMP + 1, 29.06); + + verifyAttribute(decoder, binary( "7E0200008201215233475100030000000000000003015A7F6106CF8CEC003D0000000021071311481901040000005630011931011AE10200755D3D0601CC0024990A7dA0032301CC002499099B2941FC01CC002499099B29430B01CC0024990A7dA0290601CC0024990A7dA015FD01CC0026220994506BFFFE157C010400000001F10C000000000000000000000000997E"), Position.KEY_ALARM, Position.ALARM_ACCELERATION); |