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:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user