Fix discovery of connectable devices (#1173)
This commit is contained in:
1 parent
9059547d12
commit
0e45f7cca0
1 file changed
+8
-9
+8
-9
@@ -844,11 +844,11 @@ void launchBTDiscovery() {
|
|||||||
# endif
|
# endif
|
||||||
BLEdevice* p = *it;
|
BLEdevice* p = *it;
|
||||||
Log.trace(F("Device mac %s" CR), p->macAdr);
|
Log.trace(F("Device mac %s" CR), p->macAdr);
|
||||||
if (p->sensorModel_id > TheengsDecoder::BLE_ID_NUM::UNKNOWN_MODEL &&
|
if (!isDiscovered(p)) {
|
||||||
p->sensorModel_id < TheengsDecoder::BLE_ID_NUM::BLE_ID_MAX &&
|
|
||||||
!isDiscovered(p)) {
|
|
||||||
String macWOdots = String(p->macAdr);
|
String macWOdots = String(p->macAdr);
|
||||||
macWOdots.replace(":", "");
|
macWOdots.replace(":", "");
|
||||||
|
if (p->sensorModel_id > TheengsDecoder::BLE_ID_NUM::UNKNOWN_MODEL &&
|
||||||
|
p->sensorModel_id < TheengsDecoder::BLE_ID_NUM::BLE_ID_MAX) {
|
||||||
Log.trace(F("Looking for Model_id: %d" CR), p->sensorModel_id);
|
Log.trace(F("Looking for Model_id: %d" CR), p->sensorModel_id);
|
||||||
std::string properties = decoder.getTheengProperties(p->sensorModel_id);
|
std::string properties = decoder.getTheengProperties(p->sensorModel_id);
|
||||||
Log.trace(F("properties: %s" CR), properties.c_str());
|
Log.trace(F("properties: %s" CR), properties.c_str());
|
||||||
@@ -878,7 +878,9 @@ void launchBTDiscovery() {
|
|||||||
model.c_str(), brand.c_str(), model_id.c_str(), macWOdots.c_str(), false,
|
model.c_str(), brand.c_str(), model_id.c_str(), macWOdots.c_str(), false,
|
||||||
stateClassMeasurement);
|
stateClassMeasurement);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
} else if (p->sensorModel_id > BLEconectable::id::MIN &&
|
||||||
|
p->sensorModel_id < BLEconectable::id::MAX) {
|
||||||
// Discovery of sensors from which we retrieve data only by connect
|
// Discovery of sensors from which we retrieve data only by connect
|
||||||
if (p->sensorModel_id == BLEconectable::id::DT24_BLE) {
|
if (p->sensorModel_id == BLEconectable::id::DT24_BLE) {
|
||||||
DT24Discovery(macWOdots.c_str(), "DT24-BLE");
|
DT24Discovery(macWOdots.c_str(), "DT24-BLE");
|
||||||
@@ -892,18 +894,15 @@ void launchBTDiscovery() {
|
|||||||
if (p->sensorModel_id == BLEconectable::id::XMWSDJ04MMC) {
|
if (p->sensorModel_id == BLEconectable::id::XMWSDJ04MMC) {
|
||||||
XMWSDJ04MMCDiscovery(macWOdots.c_str(), "XMWSDJ04MMC");
|
XMWSDJ04MMCDiscovery(macWOdots.c_str(), "XMWSDJ04MMC");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Log.trace(F("Device UNKNOWN_MODEL %s" CR), p->macAdr);
|
||||||
}
|
}
|
||||||
p->isDisc = true; // we don't need the semaphore and all the search magic via createOrUpdateDevice
|
p->isDisc = true; // we don't need the semaphore and all the search magic via createOrUpdateDevice
|
||||||
} else {
|
|
||||||
if (!isDiscovered(p)) {
|
|
||||||
Log.trace(F("Device UNKNOWN_MODEL %s" CR), p->macAdr);
|
|
||||||
p->isDisc = true;
|
|
||||||
} else {
|
} else {
|
||||||
Log.trace(F("Device already discovered %s" CR), p->macAdr);
|
Log.trace(F("Device already discovered %s" CR), p->macAdr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
void PublishDeviceData(JsonObject& BLEdata, bool processBLEData) {
|
void PublishDeviceData(JsonObject& BLEdata, bool processBLEData) {
|
||||||
|
|||||||
Reference in new issue
Block a user