New feature: List of allowed MAC Addresses
This commit is contained in:
parent
109ea37c8f
commit
360b8c1b85
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue