Add asynchronous client connection secure

* Adds parameter `rcPtr` to `NimBLEDevice::startSecurity`, default value works as the original method.
* * `rcPtr`: if not nullptr, will allow caller to obtain the internal return code.
* Adds parameter `async` to `NimBLEClient::secureConnection`, default value works as the original method.
* * `async`; if true, will send the secure command and return immediately with a true value for successfully sending the command, else false.
This commit is contained in:
thekurtovic
2024-12-02 09:54:18 -07:00
committed by h2zero
parent e0fe1668de
commit 15392bf581
4 changed files with 33 additions and 7 deletions
+2 -1
View File
@@ -65,7 +65,7 @@ class NimBLEClient {
bool setConnection(uint16_t connHandle);
uint16_t getMTU() const;
bool exchangeMTU();
bool secureConnection() const;
bool secureConnection(bool async = false) const;
void setConnectTimeout(uint32_t timeout);
bool setDataLen(uint16_t txOctets);
bool discoverAttributes();
@@ -131,6 +131,7 @@ class NimBLEClient {
NimBLEClientCallbacks* m_pClientCallbacks;
uint16_t m_connHandle;
uint8_t m_terminateFailCount;
mutable uint8_t m_asyncSecureAttempt;
Config m_config;
# if CONFIG_BT_NIMBLE_EXT_ADV