From e73bfa6898ad1fdd813f024990a70e81bc2d70ba Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 24 Sep 2021 09:13:23 +0200 Subject: Added HCIHandler::check_open_connection(..): Reuse same state and param checking, reduce code --- api/direct_bt/HCIHandler.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'api') diff --git a/api/direct_bt/HCIHandler.hpp b/api/direct_bt/HCIHandler.hpp index 46891696..dcaec292 100644 --- a/api/direct_bt/HCIHandler.hpp +++ b/api/direct_bt/HCIHandler.hpp @@ -477,6 +477,24 @@ namespace direct_bt { */ LE_Features le_get_local_features() noexcept { return le_ll_feats; } + private: + + /** + * Return HCIStatusCode::SUCCESS if isOpen() and the conn_handle is tracked + * and matching the give peerAddressAndType + * + * @param caller caller method base-name for DBG_ or ERR_PRINT. + * @param conn_handle + * @param peerAddressAndType + * @param addUntrackedConn true adds connection if not tracked, + * otherwise return HCIStatusCode::INVALID_HCI_COMMAND_PARAMETERS (default) + * @return + */ + HCIStatusCode check_open_connection(const std::string& caller, + const uint16_t conn_handle, const BDAddressAndType& peerAddressAndType, + const bool addUntrackedConn = false); + + public: /** * Request supported LE_Features from remote device. *
-- 
cgit v1.2.3