Add 'MI32Option5 1' to only accept sensors if they have a BLEAlias

This commit is contained in:
Simon Hailes 2021-01-26 08:17:09 +00:00
parent 84620f70ea
commit 26be733269
1 changed files with 11 additions and 0 deletions

View File

@ -117,6 +117,7 @@ struct {
uint32_t showRSSI:1;
uint32_t ignoreBogusBattery:1;
uint32_t minimalSummary:1; // DEPRECATED!!
uint32_t onlyAliased:1; // only include sensors that are aliased
} option;
} MI32;
@ -922,6 +923,13 @@ int MI32advertismentCallback(BLE_ESP32::ble_advertisment_t *pStruct)
const uint8_t *addr = pStruct->addr;
if(MI32isInBlockList(addr) == true) return 0;
if (MI32.option.onlyAliased){
const char *alias = BLE_ESP32::getAlias(p->MAC);
if (!alias || !(*alias)){
return;
}
}
int svcdataCount = advertisedDevice->getServiceDataCount();
if (svcdataCount == 0) {
@ -2120,6 +2128,9 @@ void CmndMi32Option(void){
case 4:{
MI32.option.ignoreBogusBattery = onOff;
} break;
case 5:{
MI32.option.onlyAliased = onOff;
} break;
}
ResponseCmndDone();
}