Remove std::string as the model id and use decoder enum. (#1143)

* Remove std::string as the model id and use decoder enum.

* Update decoder version

* Check model id is in decoder range when launching discovery.

* Add BLEconnect enum MIN/MAX
This commit is contained in:
h2zero authored and GitHub committed 2022-01-24 20:09:15 -06:00
1 parent 91ab8dcdf1
commit e838d3cee0
5 files changed
+67 -44

No files matched your search

+3 -3
View File
@@ -145,10 +145,10 @@ void LYWSD03MMC_connect::notifyCB(NimBLERemoteCharacteristic* pChar, uint8_t* pD
for (std::vector<BLEdevice*>::iterator it = devices.begin(); it != devices.end(); ++it) {
BLEdevice* p = *it;
if ((strcmp(p->macAdr, (char*)mac_address.c_str()) == 0)) {
if (p->sensorModel_id.compare("LYWSD03MMC") == 0)
if (p->sensorModel_id == BLEconectable::id::LYWSD03MMC)
BLEdata["model"] = "LYWSD03MMC";
else if (p->sensorModel_id.compare("MHO_C401") == 0)
BLEdata["model"] = "MHO_C401";
else if (p->sensorModel_id == BLEconectable::id::MHO_C401)
BLEdata["model"] = "MHO-C401";
}
}
BLEdata["id"] = (char*)mac_address.c_str();