aboutsummaryrefslogtreecommitdiffstats
path: root/src/direct_bt
diff options
context:
space:
mode:
Diffstat (limited to 'src/direct_bt')
-rw-r--r--src/direct_bt/BTAdapter.cpp12
-rw-r--r--src/direct_bt/BTDevice.cpp14
2 files changed, 11 insertions, 15 deletions
diff --git a/src/direct_bt/BTAdapter.cpp b/src/direct_bt/BTAdapter.cpp
index 30cd4710..f29b87d0 100644
--- a/src/direct_bt/BTAdapter.cpp
+++ b/src/direct_bt/BTAdapter.cpp
@@ -1960,7 +1960,7 @@ bool BTAdapter::mgmtEvDeviceConnectedHCI(const MgmtEvent& e) noexcept {
// hci.le_read_remote_features(event.getHCIHandle(), device->getAddressAndType());
// Hence .. induce it right after connect
- device->notifyLEFeatures(device, HCIStatusCode::SUCCESS, LE_Features::LE_Encryption);
+ device->notifyLEFeatures(device, LE_Features::LE_Encryption);
}
return true;
}
@@ -2032,10 +2032,12 @@ bool BTAdapter::mgmtEvHCILERemoteUserFeaturesHCI(const MgmtEvent& e) noexcept {
addDevicePausingDiscovery(device);
}
}
- device->notifyLEFeatures(device, event.getHCIStatus(), event.getFeatures());
- // Performs optional SMP pairing, then one of
- // - sendDeviceReady()
- // - disconnect() .. eventually
+ if( HCIStatusCode::SUCCESS == event.getHCIStatus() ) {
+ device->notifyLEFeatures(device, event.getFeatures());
+ // Performs optional SMP pairing, then one of
+ // - sendDeviceReady()
+ // - disconnect() .. eventually
+ } // else: disconnect will occur
} else {
WORDY_PRINT("BTAdapter::EventHCI:LERemoteUserFeatures(dev_id %d): Device not tracked: %s",
dev_id, event.toString().c_str());
diff --git a/src/direct_bt/BTDevice.cpp b/src/direct_bt/BTDevice.cpp
index 6359f958..0737e068 100644
--- a/src/direct_bt/BTDevice.cpp
+++ b/src/direct_bt/BTDevice.cpp
@@ -547,17 +547,12 @@ void BTDevice::notifyConnected(std::shared_ptr<BTDevice> sthis, const uint16_t h
(void)sthis; // not used yet
}
-void BTDevice::notifyLEFeatures(std::shared_ptr<BTDevice> sthis, const HCIStatusCode status, const LE_Features features) noexcept {
- if( HCIStatusCode::SUCCESS == status ) {
- le_features = features;
- } else {
- le_features = le_features | LE_Features::LE_Encryption; // required!
- }
- DBG_PRINT("BTDevice::notifyLEFeatures: %s: %s -> %s, %s",
- direct_bt::to_string(status).c_str(),
- direct_bt::to_string(features).c_str(),
+void BTDevice::notifyLEFeatures(std::shared_ptr<BTDevice> sthis, const LE_Features features) noexcept {
+ DBG_PRINT("BTDevice::notifyLEFeatures: %s -> %s, %s",
direct_bt::to_string(le_features).c_str(),
+ direct_bt::to_string(features).c_str(),
toString().c_str());
+ le_features = features;
const bool is_local_server = BTRole::Master == btRole; // -> local GattRole::Server
if( addressAndType.isLEAddress() && ( !l2cap_att->isOpen() || is_local_server ) ) {
std::thread bg(&BTDevice::processL2CAPSetup, this, sthis); // @suppress("Invalid arguments")
@@ -716,7 +711,6 @@ bool BTDevice::checkPairingKeyDistributionComplete() const noexcept {
res = true;
}
}
-
return res;
}