aboutsummaryrefslogtreecommitdiffstats
path: root/src/direct_bt/BTAdapter.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-01-13 05:36:46 +0100
committerSven Gothel <[email protected]>2022-01-13 05:36:46 +0100
commitd9a3326e83951c9f1378ff53845c4193a798a352 (patch)
tree242622f7e8c335fdb08f8c7ba08de49dd058abf5 /src/direct_bt/BTAdapter.cpp
parent48ff06cd7a4ebe0e22f82ac949624130f66dcdd1 (diff)
Add BTAdapter::setServerConnSecurity(..)
Diffstat (limited to 'src/direct_bt/BTAdapter.cpp')
-rw-r--r--src/direct_bt/BTAdapter.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/direct_bt/BTAdapter.cpp b/src/direct_bt/BTAdapter.cpp
index 37c16f05..4ed1e52a 100644
--- a/src/direct_bt/BTAdapter.cpp
+++ b/src/direct_bt/BTAdapter.cpp
@@ -594,6 +594,11 @@ bool BTAdapter::setSecureConnections(const bool enable) noexcept {
return enable == isAdapterSettingBitSet(new_settings, AdapterSetting::SECURE_CONN);
}
+void BTAdapter::setServerConnSecurity(const BTSecurityLevel sec_level, const SMPIOCapability io_cap) noexcept {
+ sec_level_server = sec_level;
+ io_cap_server = io_cap;
+}
+
void BTAdapter::setSMPKeyPath(const std::string path) noexcept {
jau::sc_atomic_critical sync(sync_data); // redundant due to mutex-lock cache-load operation, leaving it for doc
key_path = path;
@@ -1828,6 +1833,10 @@ bool BTAdapter::mgmtEvDeviceConnectedHCI(const MgmtEvent& e) noexcept {
ad_report.toString().c_str(),
device->toString().c_str());
}
+
+ if( BTRole::Slave == getRole() ) {
+ device->setConnSecurity(sec_level_server, io_cap_server);
+ }
device->notifyConnected(device, event.getHCIHandle(), io_cap_conn);
if( device->isConnSecurityAutoEnabled() ) {