BLE fixes (#436)

* BLE fixes

* Lock/Opener action fixes

* Prevent Keypad/TC request when no valid PIN is set

* Set BLE Power and C6 improvements

* Update nuki_ble

* BLE High performance on state change

* Update nuki_ble
This commit is contained in:
iranl
2024-08-01 15:56:39 +02:00
committed by GitHub
parent 41483b1b19
commit 9d09c4354d
15 changed files with 383 additions and 280 deletions

View File

@@ -30,6 +30,7 @@ void Scanner::initialize(const std::string& deviceName, const bool wantDuplicate
}
BLEDevice::init(deviceName);
}
bleScan = BLEDevice::getScan();
#ifndef BLESCANNER_USE_LATEST_NIMBLE
@@ -98,4 +99,9 @@ void Scanner::onResult(NimBLEAdvertisedDevice* advertisedDevice) {
}
}
void Scanner::whitelist(BLEAddress bleAddress) {
BLEDevice::whiteListAdd(bleAddress);
bleScan->setFilterPolicy(BLE_HCI_SCAN_FILT_USE_WL);
}
} // namespace BleScanner

View File

@@ -84,6 +84,14 @@ class Scanner : public Publisher, BLEAdvertisedDeviceCallbacks {
* @param advertisedDevice
*/
void onResult(NimBLEAdvertisedDevice* advertisedDevice) override;
/**
* @brief Whitelist a specific BLE Address
*
* @param whiteListBleAddress
*/
void whitelist(BLEAddress bleAddress);
private:
uint32_t scanDuration = 0; //default indefinite scanning time

View File

@@ -295,8 +295,6 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttributes)
if(isConnected()) {
NIMBLE_LOGE(LOG_TAG, "Connect timeout - no response");
disconnect();
NIMBLE_LOGE(LOG_TAG, "Connect timeout - cancelling");
ble_gap_conn_cancel();
} else {
// workaround; if the controller doesn't cancel the connection
// at the timeout, cancel it here.