diff options
author | Sven Gothel <[email protected]> | 2023-11-24 07:58:14 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-11-24 07:58:14 +0100 |
commit | 2c9afcdb852ccdb9155d5a8e6bfdea6cb4544674 (patch) | |
tree | 366ed36d952ad2cd1d5a8d57a45e2b5007085263 /src/direct_bt | |
parent | a7c13863b9351dba2ad4a1251547b2399e9c053f (diff) |
BTDevice::pairing_data.is_pre_paired: Set on uploadKeys() post setup, aligned for all cases (C++ and Java, via setSMPKey() or manual)
Diffstat (limited to 'src/direct_bt')
-rw-r--r-- | src/direct_bt/BTDevice.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/direct_bt/BTDevice.cpp b/src/direct_bt/BTDevice.cpp index 8524c507..8c0240f1 100644 --- a/src/direct_bt/BTDevice.cpp +++ b/src/direct_bt/BTDevice.cpp @@ -1603,10 +1603,10 @@ bool BTDevice::setSMPKeyBin(const SMPKeyBin& bin) noexcept { const BTSecurityLevel applySecLevel = BTSecurityLevel::NONE == bin.getSecLevel() ? BTSecurityLevel::NONE : BTSecurityLevel::ENC_ONLY; - pairing_data.is_pre_paired = true; - pairing_data.io_cap_user = SMPIOCapability::NO_INPUT_NO_OUTPUT; - pairing_data.sec_level_user = applySecLevel; - pairing_data.io_cap_auto = SMPIOCapability::UNSET; // disable auto + if( !setConnSecurity(applySecLevel, SMPIOCapability::NO_INPUT_NO_OUTPUT) ) { + DBG_PRINT("BTDevice::setSMPKeyBin: Setting security failed: Device Connected/ing: %s, %s", bin.toString().c_str(), toString().c_str()); + return false; + } } pairing_data.use_sc = bin.uses_SC(); @@ -1690,6 +1690,7 @@ HCIStatusCode BTDevice::uploadKeys() noexcept { if( BDAddressType::BDADDR_BREDR != addressAndType.type ) { // Not supported DBG_PRINT("BTDevice::uploadKeys: Upload LK for LE address not supported -> ignored: %s", toString().c_str()); + pairing_data.is_pre_paired = true; return HCIStatusCode::SUCCESS; } @@ -1706,6 +1707,9 @@ HCIStatusCode BTDevice::uploadKeys() noexcept { DBG_PRINT("BTDevice::uploadKeys.LK[adapter slave]: %s", to_string(res).c_str()); } } + if( HCIStatusCode::SUCCESS == res ) { + pairing_data.is_pre_paired = true; + } return res; } else if constexpr ( SMP_SUPPORTED_BY_OS ) { return HCIStatusCode::NOT_SUPPORTED; |