diff options
-rw-r--r-- | api/direct_bt/HCIComm.hpp | 10 | ||||
-rw-r--r-- | api/direct_bt/L2CAPComm.hpp | 10 | ||||
-rw-r--r-- | src/direct_bt/BTAdapter.cpp | 2 | ||||
-rw-r--r-- | src/direct_bt/BTGattHandler.cpp | 2 | ||||
-rw-r--r-- | src/direct_bt/BTManager.cpp | 2 | ||||
-rw-r--r-- | src/direct_bt/HCIHandler.cpp | 2 | ||||
-rw-r--r-- | src/direct_bt/L2CAPComm.cpp | 4 | ||||
-rw-r--r-- | src/direct_bt/SMPHandler.cpp | 2 |
8 files changed, 17 insertions, 17 deletions
diff --git a/api/direct_bt/HCIComm.hpp b/api/direct_bt/HCIComm.hpp index ec7199f6..3d3bd8c5 100644 --- a/api/direct_bt/HCIComm.hpp +++ b/api/direct_bt/HCIComm.hpp @@ -51,8 +51,8 @@ namespace direct_bt { */ class HCIComm { public: - /** Utilized for forced disconnect and read/accept interruption. */ - typedef jau::FunctionDef<bool, int /* dummy*/> is_interrupted_t; + /** Utilized to query for external interruption, whether device is still connected etc. */ + typedef jau::FunctionDef<bool, int /* dummy*/> get_boolean_callback_t; const uint16_t dev_id; const uint16_t channel; @@ -64,7 +64,7 @@ namespace direct_bt { std::recursive_mutex mtx_write; jau::relaxed_atomic_int socket_descriptor; // the hci socket jau::sc_atomic_bool interrupted_intern; // for forced disconnect and read interruption via close() - is_interrupted_t is_interrupted_extern; // for forced disconnect and read interruption via external event + get_boolean_callback_t is_interrupted_extern; // for forced disconnect and read interruption via external event std::atomic<pthread_t> tid_read; public: @@ -81,8 +81,8 @@ namespace direct_bt { bool is_open() const noexcept { return 0 <= socket_descriptor; } - /** The external is_interrupted_t callback is used until close(), thereafter it is removed. */ - void set_interupt(is_interrupted_t is_interrupted_cb) { is_interrupted_extern = is_interrupted_cb; } + /** The external `is interrupted` callback is used until close(), thereafter it is removed. */ + void set_interrupted_query(get_boolean_callback_t is_interrupted_cb) { is_interrupted_extern = is_interrupted_cb; } /** Returns true if interrupted by internal or external cause, hence shall stop connecting and reading. */ bool interrupted() const noexcept { return interrupted_intern || ( !is_interrupted_extern.isNullType() && is_interrupted_extern(0/*dummy*/) ); } diff --git a/api/direct_bt/L2CAPComm.hpp b/api/direct_bt/L2CAPComm.hpp index 5f5f53c8..31490c68 100644 --- a/api/direct_bt/L2CAPComm.hpp +++ b/api/direct_bt/L2CAPComm.hpp @@ -116,8 +116,8 @@ namespace direct_bt { static std::string getStateString(bool isOpen, bool hasIOError) noexcept; static std::string getStateString(bool isOpen, bool isInterrupted, bool hasIOError) noexcept; - /** Utilized for forced disconnect and read/accept interruption. */ - typedef jau::FunctionDef<bool, int /* dummy*/> is_interrupted_t; + /** Utilized to query for external interruption, whether device is still connected etc. */ + typedef jau::FunctionDef<bool, int /* dummy*/> get_boolean_callback_t; protected: static int l2cap_open_dev(const BDAddressAndType & adapterAddressAndType, const L2CAP_PSM psm, const L2CAP_CID cid) noexcept; @@ -140,7 +140,7 @@ namespace direct_bt { jau::relaxed_atomic_int socket_; // the native socket jau::sc_atomic_bool is_open_; // reflects state jau::sc_atomic_bool interrupted_intern; // for forced disconnect and read/accept interruption via close() - is_interrupted_t is_interrupted_extern; // for forced disconnect and read/accept interruption via external event + get_boolean_callback_t is_interrupted_extern; // for forced disconnect and read/accept interruption via external event bool setBTSecurityLevelImpl(const BTSecurityLevel sec_level, const BDAddressAndType& remoteAddressAndType) noexcept; BTSecurityLevel getBTSecurityLevelImpl(const BDAddressAndType& remoteAddressAndType) noexcept; @@ -156,8 +156,8 @@ namespace direct_bt { bool is_open() const noexcept { return is_open_; } - /** The external is_interrupted_t callback is used until close(), thereafter it is removed. */ - void set_interupt(is_interrupted_t is_interrupted_cb) { is_interrupted_extern = is_interrupted_cb; } + /** The external `is interrupted` callback is used until close(), thereafter it is removed. */ + void set_interrupted_query(get_boolean_callback_t is_interrupted_cb) { is_interrupted_extern = is_interrupted_cb; } /** Returns true if interrupted by internal or external cause, hence shall stop connecting and reading. */ bool interrupted() const noexcept { return interrupted_intern || ( !is_interrupted_extern.isNullType() && is_interrupted_extern(0/*dummy*/) ); } diff --git a/src/direct_bt/BTAdapter.cpp b/src/direct_bt/BTAdapter.cpp index 65f25bb2..250b290d 100644 --- a/src/direct_bt/BTAdapter.cpp +++ b/src/direct_bt/BTAdapter.cpp @@ -1795,7 +1795,7 @@ bool BTAdapter::mgmtEvLocalNameChangedMgmt(const MgmtEvent& e) noexcept { void BTAdapter::l2capServerInit(jau::service_runner& sr0) { (void)sr0; - l2cap_att_srv.set_interupt( jau::bindMemberFunc(&l2cap_service, &jau::service_runner::shall_stop2) ); + l2cap_att_srv.set_interrupted_query( jau::bindMemberFunc(&l2cap_service, &jau::service_runner::shall_stop2) ); if( !l2cap_att_srv.open() ) { ERR_PRINT("Adapter[%d]: L2CAP ATT open failed: %s", dev_id, l2cap_att_srv.toString().c_str()); diff --git a/src/direct_bt/BTGattHandler.cpp b/src/direct_bt/BTGattHandler.cpp index b147eddf..d8f857cb 100644 --- a/src/direct_bt/BTGattHandler.cpp +++ b/src/direct_bt/BTGattHandler.cpp @@ -569,7 +569,7 @@ BTGattHandler::BTGattHandler(const BTDeviceRef &device, L2CAPClient& l2cap_att, * We utilize DBTManager's mgmthandler_sigaction SIGALRM handler, * as we only can install one handler. */ - l2cap.set_interupt( jau::bindMemberFunc(&l2cap_reader_service, &jau::service_runner::shall_stop2) ); + l2cap.set_interrupted_query( jau::bindMemberFunc(&l2cap_reader_service, &jau::service_runner::shall_stop2) ); l2cap_reader_service.start(); if( GATTRole::Client == getRole() ) { diff --git a/src/direct_bt/BTManager.cpp b/src/direct_bt/BTManager.cpp index 650ec71b..8e810f4f 100644 --- a/src/direct_bt/BTManager.cpp +++ b/src/direct_bt/BTManager.cpp @@ -375,7 +375,7 @@ BTManager::BTManager() noexcept return; } - comm.set_interupt( jau::bindMemberFunc(&mgmt_reader_service, &jau::service_runner::shall_stop2) ); + comm.set_interrupted_query( jau::bindMemberFunc(&mgmt_reader_service, &jau::service_runner::shall_stop2) ); mgmt_reader_service.start(); PERF_TS_T0(); diff --git a/src/direct_bt/HCIHandler.cpp b/src/direct_bt/HCIHandler.cpp index b75bf1fb..d26d7cef 100644 --- a/src/direct_bt/HCIHandler.cpp +++ b/src/direct_bt/HCIHandler.cpp @@ -688,7 +688,7 @@ HCIHandler::HCIHandler(const uint16_t dev_id_, const BTMode btMode_) noexcept return; } - comm.set_interupt( jau::bindMemberFunc(&hci_reader_service, &jau::service_runner::shall_stop2) ); + comm.set_interrupted_query( jau::bindMemberFunc(&hci_reader_service, &jau::service_runner::shall_stop2) ); hci_reader_service.start(); PERF_TS_T0(); diff --git a/src/direct_bt/L2CAPComm.cpp b/src/direct_bt/L2CAPComm.cpp index 8c003b3a..bfe5e34e 100644 --- a/src/direct_bt/L2CAPComm.cpp +++ b/src/direct_bt/L2CAPComm.cpp @@ -386,7 +386,7 @@ bool L2CAPClient::close() noexcept { to_string(psm).c_str(), to_string(cid).c_str(), getStateString().c_str()); has_ioerror = false; // always clear last ioerror flag (should be redundant) - set_interupt(L2CAPComm::is_interrupted_t()); // Null-Type + set_interrupted_query(L2CAPComm::get_boolean_callback_t()); // Null-Type return true; } const std::lock_guard<std::recursive_mutex> lock(mtx_write); // RAII-style acquire and relinquish via destructor @@ -396,7 +396,7 @@ bool L2CAPClient::close() noexcept { to_string(psm).c_str(), to_string(cid).c_str(), getStateString().c_str()); has_ioerror = false; - set_interupt(L2CAPComm::is_interrupted_t()); // Null-Type + set_interrupted_query(L2CAPComm::get_boolean_callback_t()); // Null-Type PERF_TS_T0(); // interrupt connect() and read(), avoiding prolonged hang diff --git a/src/direct_bt/SMPHandler.cpp b/src/direct_bt/SMPHandler.cpp index 63bd1cd2..ff55b352 100644 --- a/src/direct_bt/SMPHandler.cpp +++ b/src/direct_bt/SMPHandler.cpp @@ -174,7 +174,7 @@ SMPHandler::SMPHandler(const std::shared_ptr<BTDevice> &device) noexcept DBG_PRINT("SMPHandler::ctor: Start Connect: GattHandler[%s], l2cap[%s]: %s", getStateString().c_str(), l2cap.getStateString().c_str(), deviceString.c_str()); - l2cap.set_interupt( jau::bindMemberFunc(&smp_reader_service, &jau::service_runner::shall_stop2) ); + l2cap.set_interrupted_query( jau::bindMemberFunc(&smp_reader_service, &jau::service_runner::shall_stop2) ); smp_reader_service.start(); // FIXME: Determine proper MTU usage: Defaults::MIN_SMP_MTU or Defaults::LE_SECURE_SMP_MTU (if enabled) |