aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-10-25 10:28:54 +0200
committerSven Gothel <[email protected]>2023-10-25 10:28:54 +0200
commita8fd6b54367108824512c172588f8ac16bd30393 (patch)
tree5dc0c1551f70c2fa36f02d65d33ca0965e3a451d /src
parent0dc31f03ccd6e138d8e21931c48b9b83eee166c6 (diff)
HCIHandler: Remove reset{->HCI}() from public
Diffstat (limited to 'src')
-rw-r--r--src/direct_bt/HCIHandler.cpp41
1 files changed, 17 insertions, 24 deletions
diff --git a/src/direct_bt/HCIHandler.cpp b/src/direct_bt/HCIHandler.cpp
index 9f58252c..d7654d6c 100644
--- a/src/direct_bt/HCIHandler.cpp
+++ b/src/direct_bt/HCIHandler.cpp
@@ -932,20 +932,6 @@ HCIStatusCode HCIHandler::le_read_remote_features(const uint16_t conn_handle, co
return status;
}
-bool HCIHandler::resetAllStates(const bool powered_on) noexcept {
- const std::lock_guard<std::recursive_mutex> lock(mtx_connectionList); // RAII-style acquire and relinquish via destructor
- connectionList.clear();
- disconnectCmdList.clear();
- currentScanType = ScanType::NONE;
- advertisingEnabled = false;
- zeroSupCommands();
- if( powered_on ) {
- return initSupCommands();
- } else {
- return true;
- }
-}
-
void HCIHandler::close() noexcept {
// Avoid disconnect re-entry -> potential deadlock
bool expConn = true; // C++11, exp as value since C++20
@@ -1083,27 +1069,34 @@ HCIStatusCode HCIHandler::resetAdapter(const HCIHandler::PostShutdownFunc& user_
return res;
}
-HCIStatusCode HCIHandler::reset() noexcept {
- if( !isOpen() ) {
- ERR_PRINT("Not connected %s", toString().c_str());
- return HCIStatusCode::DISCONNECTED;
+bool HCIHandler::resetAllStates(const bool powered_on) noexcept {
+ const std::lock_guard<std::recursive_mutex> lock(mtx_connectionList); // RAII-style acquire and relinquish via destructor
+ connectionList.clear();
+ disconnectCmdList.clear();
+ currentScanType = ScanType::NONE;
+ advertisingEnabled = false;
+ zeroSupCommands();
+ if( powered_on ) {
+ return initSupCommands();
+ } else {
+ return true;
}
+}
+
+HCIStatusCode HCIHandler::resetHCI() noexcept {
HCIStatusCode res = HCIStatusCode::INTERNAL_FAILURE;
const std::lock_guard<std::recursive_mutex> lock(mtx_sendReply); // RAII-style acquire and relinquish via destructor
- DBG_PRINT("HCIHandler<%u>::reset.0: %s", dev_id, toString().c_str());
+ DBG_PRINT("HCIHandler<%u>::Reset HCI.0: %s", dev_id, toString().c_str());
HCICommand req0(HCIOpcode::RESET, 0);
const hci_rp_status * ev_status;
std::unique_ptr<HCIEvent> ev = processCommandComplete(req0, &ev_status, &res);
if( nullptr == ev ) {
- return HCIStatusCode::INTERNAL_TIMEOUT; // timeout
- }
- if( HCIStatusCode::SUCCESS == res ) {
- res = resetAllStates(true) ? HCIStatusCode::SUCCESS : HCIStatusCode::FAILED;
+ res = HCIStatusCode::INTERNAL_TIMEOUT; // timeout
}
- DBG_PRINT("HCIHandler<%u>::reset.X: %s - %s", dev_id, to_string(res).c_str(), toString().c_str());
+ DBG_PRINT("HCIHandler<%u>::Reset HCI.X: %s - %s", dev_id, to_string(res).c_str(), toString().c_str());
return res;
}