diff options
author | Sven Gothel <[email protected]> | 2020-12-03 08:19:22 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-12-03 08:19:22 +0100 |
commit | e2ba3bb7d8ea1740ef1b67956bc30de3d702029b (patch) | |
tree | dad4f5029e099eaa44f20844d4a35737493bdfc6 /api/direct_bt/DBTManager.hpp | |
parent | 41c253870574c252b13cd358ec96392e140065a7 (diff) |
MgmtTypes: Support PAIR_DEVICE (async - pending reply), CANCEL_PAIR_DEVICE and UNPAIR_DEVICE: DBTManager <-> DBTDevice
PAIR_DEVICE's COMMAND_COMPLETE reply -> Synthetic pending event PAIR_DEVICE_COMPLETE (MgmtEvtPairDeviceComplete)
- Testing disclosed that Mgmt's pairDevice(..) is not suitable nor stable
- within our workflow: SCAN - FOUND - *CONNECT or PAIR* ..
- Can't call adapter.stopDiscovery() after FOUND, otherwise pairDevice() fails
- Not able to set all scan params (even though connection params can be frontloaded)
- Not producing proper PRE_PAIRED behavior (ALREADY_PAIRED doesn't allow us to GATT process)
The above despite the very usable way of setting SMPIOCapability per connection
w/o our hacky blocked per adapter setting (one connect command at one time).
However, having it supported for testing, allowed us to compare with our workflow
and just using connect.
Diffstat (limited to 'api/direct_bt/DBTManager.hpp')
-rw-r--r-- | api/direct_bt/DBTManager.hpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/api/direct_bt/DBTManager.hpp b/api/direct_bt/DBTManager.hpp index aaf046b3..9053d9bd 100644 --- a/api/direct_bt/DBTManager.hpp +++ b/api/direct_bt/DBTManager.hpp @@ -224,7 +224,7 @@ namespace direct_bt { pthread_t mgmtReaderThreadId; jau::relaxed_atomic_bool mgmtReaderRunning; - std::recursive_mutex mtx_sendReply; // for sendWithReply + std::recursive_mutex mtx_sendReply; // for send() and sendWithReply() jau::sc_atomic_bool allowClose; @@ -253,6 +253,8 @@ namespace direct_bt { */ std::shared_ptr<MgmtEvent> sendWithReply(MgmtCommand &req) noexcept; + bool send(MgmtCommand &req) noexcept; + /** * Instantiate singleton. * @param btMode default {@link BTMode} when initializing new adapter. If BTMode::NONE given, MgmtEnv::DEFAULT_BTMODE is being used. @@ -442,6 +444,9 @@ namespace direct_bt { MgmtStatus userPasskeyNegativeReply(const uint16_t dev_id, const EUI48 &address, const BDAddressType addressType) noexcept; MgmtStatus userConfirmReply(const uint16_t dev_id, const EUI48 &address, const BDAddressType addressType, const bool positive) noexcept; + bool pairDevice(const uint16_t dev_id, const EUI48 &address, const BDAddressType addressType, const SMPIOCapability iocap) noexcept; + MgmtStatus unpairDevice(const uint16_t dev_id, const EUI48 &address, const BDAddressType addressType, const bool disconnect) noexcept; + /** MgmtEventCallback handling */ /** |