diff options
author | Sven Gothel <[email protected]> | 2022-01-25 18:25:23 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-01-25 18:25:23 +0100 |
commit | fed5a977d7d9f2a26b5ef462d13146de1bfaffec (patch) | |
tree | 14f260a7094f1cf768a505ea81bd21cedf187180 /src/direct_bt/BTAdapter.cpp | |
parent | 4ceee4cb4d2d34e7d24db33f12c05bb617f288ca (diff) |
Expose BTManager::setDefaultConnParam(..) via BTAdapter::setDefaultConnParam(..), essential in server mode
Diffstat (limited to 'src/direct_bt/BTAdapter.cpp')
-rw-r--r-- | src/direct_bt/BTAdapter.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/direct_bt/BTAdapter.cpp b/src/direct_bt/BTAdapter.cpp index 8a632433..1f8d873a 100644 --- a/src/direct_bt/BTAdapter.cpp +++ b/src/direct_bt/BTAdapter.cpp @@ -601,6 +601,14 @@ HCIStatusCode BTAdapter::setSecureConnections(const bool enable) noexcept { updateAdapterSettings(false /* off_thread */, new_settings, false /* sendEvent */, 0); return ( enable == isAdapterSettingBitSet(new_settings, AdapterSetting::SECURE_CONN) ) ? HCIStatusCode::SUCCESS : HCIStatusCode::FAILED; } + +HCIStatusCode BTAdapter::setDefaultConnParam(const uint16_t conn_interval_min, const uint16_t conn_interval_max, + const uint16_t conn_latency, const uint16_t supervision_timeout) noexcept { + if( isAdapterSettingBitSet(adapterInfo.getCurrentSettingMask(), AdapterSetting::POWERED) ) { + return HCIStatusCode::COMMAND_DISALLOWED; + } + const bool res = mgmt.setDefaultConnParam(dev_id, conn_interval_min, conn_interval_max, conn_latency, supervision_timeout); + return res ? HCIStatusCode::SUCCESS : HCIStatusCode::FAILED; } void BTAdapter::setServerConnSecurity(const BTSecurityLevel sec_level, const SMPIOCapability io_cap) noexcept { |