From ef315b2b39365102b64f2e859ac4182115df7827 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sat, 8 Feb 2020 07:38:29 -0800 Subject: [PATCH] don't let non bonded devices connect to our services --- lib/BluetoothOTA/src/BluetoothUtil.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/BluetoothOTA/src/BluetoothUtil.cpp b/lib/BluetoothOTA/src/BluetoothUtil.cpp index 71769d8df..33fe27675 100644 --- a/lib/BluetoothOTA/src/BluetoothUtil.cpp +++ b/lib/BluetoothOTA/src/BluetoothUtil.cpp @@ -206,7 +206,9 @@ BLEServer *initBLE(std::string deviceName, std::string hwVendor, std::string swV pUpdate->start(); // Start advertising - pServer->getAdvertising()->start(); + BLEAdvertising *advert = pServer->getAdvertising(); + advert->setScanFilter(false, true); // We let anyone scan for us (FIXME, perhaps only allow that until we are paired with a phone and configured) but only let whitelist phones connect + advert->start(); BLESecurity *pSecurity = new BLESecurity(); pSecurity->setCapability(ESP_IO_CAP_OUT);