New feature: List of allowed MAC Addresses

This commit is contained in:
PatBoud 2021-01-23 17:29:13 -05:00
parent 109ea37c8f
commit 360b8c1b85
3 changed files with 26 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -318,6 +318,25 @@ bool reportDevice(BLEAdvertisedDevice advertisedDevice) {
String mac_address = advertisedDevice.getAddress().toString().c_str();
mac_address.replace(":","");
mac_address.toLowerCase();
//Check scanned MAC Address against a list of allowed MAC Addresses
if (allowedListCheck) {
bool allowedListFound = false;
for (uint32_t x = 0; x < allowedListNumberOfItems; x++) {
if (mac_address == allowedList[x]) {
allowedListFound = true;
}
}
if (allowedListFound == false) {
return false;
}
}
// --------------
// Serial.print("mac:\t");
// Serial.println(mac_address);
int rssi = advertisedDevice.getRSSI();

View File

@ -49,3 +49,10 @@
// MQTT topic for sensor values from HTU21D temperature and humidity sensor
//#define htuSensorTopic "presence_nodes/" hostname "/sensor"
//List of allowed MAC Addresses for MQTT Publish. All others will be ignored.
//Feature is disabled by default.
#define allowedListCheck false
String allowedList[] = {"11223344aabb", "11223344aabb"};
uint32_t allowedListNumberOfItems = 2;