diff options
author | Sven Gothel <[email protected]> | 2021-02-01 20:32:56 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-02-01 20:32:56 +0100 |
commit | f84121c2e34447d52b3026787219ad192d874c86 (patch) | |
tree | 413095c58c686f9a6ffcf4e7b275b293985dd213 /api/direct_bt/BTDevice.hpp | |
parent | 72a387df5bbf136810c0aabe05dc34bd72beb669 (diff) |
DBTDevice: Fix automatic security negotiation: 'pairing_data.ioCap_auto' needs to survive disconnect
- Don't clear 'pairing_data.ioCap_auto' in clearSMPState() - needs to survive disconnect!
- Use 'std::condition_variable cv_pairing_state_changed' to be notified of PairingState change
instead of dumb polling.
Diffstat (limited to 'api/direct_bt/BTDevice.hpp')
-rw-r--r-- | api/direct_bt/BTDevice.hpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/api/direct_bt/BTDevice.hpp b/api/direct_bt/BTDevice.hpp index 25956a01..fb6867fe 100644 --- a/api/direct_bt/BTDevice.hpp +++ b/api/direct_bt/BTDevice.hpp @@ -86,7 +86,7 @@ namespace direct_bt { SMPIOCapability ioCap_user = SMPIOCapability::UNSET; BTSecurityLevel sec_level_conn = BTSecurityLevel::UNSET; BTSecurityLevel sec_level_user = BTSecurityLevel::UNSET; - SMPIOCapability ioCap_auto = SMPIOCapability::UNSET; + SMPIOCapability ioCap_auto = SMPIOCapability::UNSET; // not cleared by clearSMPStates() SMPPairingState state; PairingMode mode; @@ -114,6 +114,7 @@ namespace direct_bt { PairingData pairing_data; mutable std::mutex mtx_pairing; mutable jau::sc_atomic_bool sync_pairing; + std::condition_variable cv_pairing_state_changed; /** Private class only for private make_shared(). */ class ctor_cookie { friend BTDevice; ctor_cookie(const uint16_t secret) { (void)secret; } }; |