aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-09-16 07:00:14 +0200
committerSven Gothel <[email protected]>2022-09-16 07:00:14 +0200
commit982dad0d350ee4789ea98388f525e24b494b91ee (patch)
tree09346c467e7cf8e21f1216f15a9a1da85a0c9eea
parent2ca5311d33bb05b48d41ea9d0ffb6bede265801f (diff)
Adopt to jau::function<R(A...)> from jau::FunctionDef<>
-rw-r--r--api/direct_bt/BTManager.hpp4
-rw-r--r--api/direct_bt/HCIComm.hpp6
-rw-r--r--api/direct_bt/HCIHandler.hpp4
-rw-r--r--api/direct_bt/L2CAPComm.hpp6
-rw-r--r--api/direct_bt/MgmtTypes.hpp4
-rw-r--r--api/direct_bt/SMPHandler.hpp4
-rw-r--r--examples/dbt_peripheral00.cpp6
-rw-r--r--java/jni/direct_bt/DBTManager.cxx4
-rw-r--r--src/direct_bt/BTAdapter.cpp64
-rw-r--r--src/direct_bt/BTGattHandler.cpp8
-rw-r--r--src/direct_bt/BTManager.cpp68
-rw-r--r--src/direct_bt/HCIHandler.cpp6
-rw-r--r--src/direct_bt/SMPHandler.cpp6
-rw-r--r--src/direct_bt/SMPKeyBin.cpp2
-rw-r--r--trial/direct_bt/dbt_base_client_server.hpp2
-rw-r--r--trial/direct_bt/dbt_endpoint.hpp2
-rw-r--r--trial/direct_bt/dbt_server01.hpp6
17 files changed, 100 insertions, 102 deletions
diff --git a/api/direct_bt/BTManager.hpp b/api/direct_bt/BTManager.hpp
index 54468f20..e65dc209 100644
--- a/api/direct_bt/BTManager.hpp
+++ b/api/direct_bt/BTManager.hpp
@@ -166,7 +166,7 @@ namespace direct_bt {
typedef bool (*ChangedAdapterSetFunc)(bool added, std::shared_ptr<BTAdapter>& adapter);
/**
- * Callback jau::FunctionDef to receive change events regarding the system's adapter set,
+ * Callback jau::function to receive change events regarding the system's adapter set,
* e.g. a removed or added adapter due to user interaction or 'cold reset'.
* <p>
* When a new callback is added, all available adapter's will be reported as added,
@@ -190,7 +190,7 @@ namespace direct_bt {
* @see BTManager::removeChangedAdapterSetCallback()
* @see [Direct-BT Overview](namespacedirect__bt.html#details)
*/
- typedef jau::FunctionDef<bool, bool, std::shared_ptr<BTAdapter>&> ChangedAdapterSetCallback;
+ typedef jau::function<bool(bool, std::shared_ptr<BTAdapter>&)> ChangedAdapterSetCallback;
typedef jau::cow_darray<ChangedAdapterSetCallback> ChangedAdapterSetCallbackList;
/**
diff --git a/api/direct_bt/HCIComm.hpp b/api/direct_bt/HCIComm.hpp
index 061569ea..5b5dec18 100644
--- a/api/direct_bt/HCIComm.hpp
+++ b/api/direct_bt/HCIComm.hpp
@@ -33,7 +33,7 @@
#include <mutex>
#include <jau/basic_types.hpp>
-#include <jau/function_def.hpp>
+#include <jau/functional.hpp>
#include "HCIIoctl.hpp"
@@ -61,7 +61,7 @@ namespace direct_bt {
class HCIComm {
public:
/** Utilized to query for external interruption, whether device is still connected etc. */
- typedef jau::FunctionDef<bool, int /* dummy*/> get_boolean_callback_t;
+ typedef jau::function<bool(int /* dummy*/)> get_boolean_callback_t;
const uint16_t dev_id;
const uint16_t channel;
@@ -94,7 +94,7 @@ namespace direct_bt {
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*/) ); }
+ bool interrupted() const noexcept { return interrupted_intern || ( !is_interrupted_extern.is_null() && is_interrupted_extern(0/*dummy*/) ); }
/** Closing the HCI channel, locking {@link #mutex_write()}. */
void close() noexcept;
diff --git a/api/direct_bt/HCIHandler.hpp b/api/direct_bt/HCIHandler.hpp
index 0d440213..4e483b4e 100644
--- a/api/direct_bt/HCIHandler.hpp
+++ b/api/direct_bt/HCIHandler.hpp
@@ -163,8 +163,8 @@ namespace direct_bt {
}
};
- typedef jau::FunctionDef<bool, const BDAddressAndType& /* addressAndType */,
- const SMPPDUMsg&, const HCIACLData::l2cap_frame& /* source */> HCISMPMsgCallback;
+ typedef jau::function<bool(const BDAddressAndType& /* addressAndType */,
+ const SMPPDUMsg&, const HCIACLData::l2cap_frame& /* source */)> HCISMPMsgCallback;
typedef jau::cow_darray<HCISMPMsgCallback> HCISMPMsgCallbackList;
/**
diff --git a/api/direct_bt/L2CAPComm.hpp b/api/direct_bt/L2CAPComm.hpp
index 830bbc0c..5e4b2072 100644
--- a/api/direct_bt/L2CAPComm.hpp
+++ b/api/direct_bt/L2CAPComm.hpp
@@ -36,7 +36,7 @@
#include <jau/environment.hpp>
#include <jau/uuid.hpp>
-#include <jau/function_def.hpp>
+#include <jau/functional.hpp>
#include "BTTypes0.hpp"
@@ -127,7 +127,7 @@ namespace direct_bt {
static std::string getStateString(bool isOpen, bool irqed_int, bool irqed_ext, bool hasIOError) noexcept;
/** Utilized to query for external interruption, whether device is still connected etc. */
- typedef jau::FunctionDef<bool, int /* dummy*/> get_boolean_callback_t;
+ typedef jau::function<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;
@@ -159,7 +159,7 @@ namespace direct_bt {
bool interrupted_int() const noexcept { return interrupted_intern; }
/** Returns true if interrupted by external cause. */
- bool interrupted_ext() const noexcept { return !is_interrupted_extern.isNullType() && is_interrupted_extern(0/*dummy*/); }
+ bool interrupted_ext() const noexcept { return !is_interrupted_extern.is_null() && is_interrupted_extern(0/*dummy*/); }
public:
L2CAPComm(const uint16_t adev_id, const BDAddressAndType& localAddressAndType, const L2CAP_PSM psm, const L2CAP_CID cid) noexcept;
diff --git a/api/direct_bt/MgmtTypes.hpp b/api/direct_bt/MgmtTypes.hpp
index 35870c10..0fdd9e5f 100644
--- a/api/direct_bt/MgmtTypes.hpp
+++ b/api/direct_bt/MgmtTypes.hpp
@@ -32,7 +32,7 @@
#include <mutex>
-#include <jau/function_def.hpp>
+#include <jau/functional.hpp>
#include <jau/cow_darray.hpp>
#include <jau/octets.hpp>
#include <jau/packed_attribute.hpp>
@@ -2774,7 +2774,7 @@ namespace direct_bt {
bool updateAdapterInfo(AdapterInfo& info) const noexcept;
};
- typedef jau::FunctionDef<bool, const MgmtEvent&> MgmtEventCallback;
+ typedef jau::function<bool(const MgmtEvent&)> MgmtEventCallback;
typedef jau::cow_darray<MgmtEventCallback> MgmtEventCallbackList;
class MgmtAdapterEventCallback {
diff --git a/api/direct_bt/SMPHandler.hpp b/api/direct_bt/SMPHandler.hpp
index 610fd7c8..bb250924 100644
--- a/api/direct_bt/SMPHandler.hpp
+++ b/api/direct_bt/SMPHandler.hpp
@@ -36,7 +36,7 @@
#include <jau/environment.hpp>
#include <jau/ringbuffer.hpp>
-#include <jau/function_def.hpp>
+#include <jau/functional.hpp>
#include <jau/darray.hpp>
#include <jau/cow_darray.hpp>
#include <jau/uuid.hpp>
@@ -146,7 +146,7 @@ namespace direct_bt {
};
- typedef jau::FunctionDef<bool, const SMPPDUMsg&> SMPSecurityReqCallback;
+ typedef jau::function<bool(const SMPPDUMsg&)> SMPSecurityReqCallback;
typedef jau::cow_darray<SMPSecurityReqCallback> SMPSecurityReqCallbackList;
/**
diff --git a/examples/dbt_peripheral00.cpp b/examples/dbt_peripheral00.cpp
index b874aee7..b5edba27 100644
--- a/examples/dbt_peripheral00.cpp
+++ b/examples/dbt_peripheral00.cpp
@@ -420,9 +420,9 @@ class MyGATTServerListener : public DBGattServer::Listener {
public:
MyGATTServerListener()
: pulse_service("MyGATTServerListener::pulse", THREAD_SHUTDOWN_TIMEOUT_MS,
- jau::bindMemberFunc(this, &MyGATTServerListener::pulse_worker),
- jau::bindMemberFunc(this, &MyGATTServerListener::pulse_worker_init),
- jau::bindMemberFunc(this, &MyGATTServerListener::pulse_worker_end))
+ jau::bind_member(this, &MyGATTServerListener::pulse_worker),
+ jau::bind_member(this, &MyGATTServerListener::pulse_worker_init),
+ jau::bind_member(this, &MyGATTServerListener::pulse_worker_end))
{
pulse_service.start();
}
diff --git a/java/jni/direct_bt/DBTManager.cxx b/java/jni/direct_bt/DBTManager.cxx
index 2d49bf57..684cf79a 100644
--- a/java/jni/direct_bt/DBTManager.cxx
+++ b/java/jni/direct_bt/DBTManager.cxx
@@ -101,8 +101,8 @@ static void _addMgmtCBOnce(JNIEnv *env, BTManager & mgmt, JNIGlobalRef jmgmtRef,
throw jau::InternalError("BTManager has no "+jmethodName+"."+jmethodArgs+" method, for "+mgmt.toString(), E_FILE_LINE);
}
- // move BooleanDeviceCBContextRef into CaptureValueInvocationFunc and operator== includes javaCallback comparison
- jau::FunctionDef<bool, const MgmtEvent&> funcDef = jau::bindCaptureValueFunc(std::make_shared<BooleanMgmtCBContext>(opc, jmgmtRef, mid), nativeCallback);
+ // move BooleanDeviceCBContextRef into jau::func::capval_target_t and operator== includes javaCallback comparison
+ jau::function<bool(const MgmtEvent&)> funcDef = jau::bind_capval(std::make_shared<BooleanMgmtCBContext>(opc, jmgmtRef, mid), nativeCallback);
mgmt.addMgmtEventCallback(-1, opc, funcDef);
} catch(...) {
rethrow_and_raise_java_exception(env);
diff --git a/src/direct_bt/BTAdapter.cpp b/src/direct_bt/BTAdapter.cpp
index 78e2de04..55263cda 100644
--- a/src/direct_bt/BTAdapter.cpp
+++ b/src/direct_bt/BTAdapter.cpp
@@ -319,17 +319,17 @@ bool BTAdapter::enableListening(const bool enable) noexcept {
hci.clearAllCallbacks();
bool ok = true;
- ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::DISCOVERING, jau::bindMemberFunc(this, &BTAdapter::mgmtEvDeviceDiscoveringMgmt)) && ok;
- ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::NEW_SETTINGS, jau::bindMemberFunc(this, &BTAdapter::mgmtEvNewSettingsMgmt)) && ok;
- ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::LOCAL_NAME_CHANGED, jau::bindMemberFunc(this, &BTAdapter::mgmtEvLocalNameChangedMgmt)) && ok;
- ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::PIN_CODE_REQUEST, jau::bindMemberFunc(this, &BTAdapter::mgmtEvPinCodeRequestMgmt));
- ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::USER_CONFIRM_REQUEST, jau::bindMemberFunc(this, &BTAdapter::mgmtEvUserConfirmRequestMgmt));
- ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::USER_PASSKEY_REQUEST, jau::bindMemberFunc(this, &BTAdapter::mgmtEvUserPasskeyRequestMgmt));
- ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::AUTH_FAILED, jau::bindMemberFunc(this, &BTAdapter::mgmtEvAuthFailedMgmt));
- ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::DEVICE_UNPAIRED, jau::bindMemberFunc(this, &BTAdapter::mgmtEvDeviceUnpairedMgmt));
- ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::PAIR_DEVICE_COMPLETE, jau::bindMemberFunc(this, &BTAdapter::mgmtEvPairDeviceCompleteMgmt));
- ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::NEW_LONG_TERM_KEY, jau::bindMemberFunc(this, &BTAdapter::mgmtEvNewLongTermKeyMgmt));
- ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::NEW_LINK_KEY, jau::bindMemberFunc(this, &BTAdapter::mgmtEvNewLinkKeyMgmt));
+ ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::DISCOVERING, jau::bind_member(this, &BTAdapter::mgmtEvDeviceDiscoveringMgmt)) && ok;
+ ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::NEW_SETTINGS, jau::bind_member(this, &BTAdapter::mgmtEvNewSettingsMgmt)) && ok;
+ ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::LOCAL_NAME_CHANGED, jau::bind_member(this, &BTAdapter::mgmtEvLocalNameChangedMgmt)) && ok;
+ ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::PIN_CODE_REQUEST, jau::bind_member(this, &BTAdapter::mgmtEvPinCodeRequestMgmt));
+ ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::USER_CONFIRM_REQUEST, jau::bind_member(this, &BTAdapter::mgmtEvUserConfirmRequestMgmt));
+ ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::USER_PASSKEY_REQUEST, jau::bind_member(this, &BTAdapter::mgmtEvUserPasskeyRequestMgmt));
+ ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::AUTH_FAILED, jau::bind_member(this, &BTAdapter::mgmtEvAuthFailedMgmt));
+ ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::DEVICE_UNPAIRED, jau::bind_member(this, &BTAdapter::mgmtEvDeviceUnpairedMgmt));
+ ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::PAIR_DEVICE_COMPLETE, jau::bind_member(this, &BTAdapter::mgmtEvPairDeviceCompleteMgmt));
+ ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::NEW_LONG_TERM_KEY, jau::bind_member(this, &BTAdapter::mgmtEvNewLongTermKeyMgmt));
+ ok = mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::NEW_LINK_KEY, jau::bind_member(this, &BTAdapter::mgmtEvNewLinkKeyMgmt));
if( !ok ) {
ERR_PRINT("Could not add all required MgmtEventCallbacks to DBTManager: %s", toString().c_str());
@@ -337,30 +337,30 @@ bool BTAdapter::enableListening(const bool enable) noexcept {
}
#if 0
- mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::DEVICE_DISCONNECTED, bindMemberFunc(this, &BTAdapter::mgmtEvDeviceDisconnectedMgmt));
+ mgmt->addMgmtEventCallback(dev_id, MgmtEvent::Opcode::DEVICE_DISCONNECTED, bind_member(this, &BTAdapter::mgmtEvDeviceDisconnectedMgmt));
#endif
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::DISCOVERING, jau::bindMemberFunc(this, &BTAdapter::mgmtEvDeviceDiscoveringHCI)) && ok;
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::DEVICE_CONNECTED, jau::bindMemberFunc(this, &BTAdapter::mgmtEvDeviceConnectedHCI)) && ok;
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::CONNECT_FAILED, jau::bindMemberFunc(this, &BTAdapter::mgmtEvConnectFailedHCI)) && ok;
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::DEVICE_DISCONNECTED, jau::bindMemberFunc(this, &BTAdapter::mgmtEvDeviceDisconnectedHCI)) && ok;
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::DEVICE_FOUND, jau::bindMemberFunc(this, &BTAdapter::mgmtEvDeviceFoundHCI)) && ok;
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_REMOTE_FEATURES, jau::bindMemberFunc(this, &BTAdapter::mgmtEvHCILERemoteUserFeaturesHCI)) && ok;
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_PHY_UPDATE_COMPLETE, jau::bindMemberFunc(this, &BTAdapter::mgmtEvHCILEPhyUpdateCompleteHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::DISCOVERING, jau::bind_member(this, &BTAdapter::mgmtEvDeviceDiscoveringHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::DEVICE_CONNECTED, jau::bind_member(this, &BTAdapter::mgmtEvDeviceConnectedHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::CONNECT_FAILED, jau::bind_member(this, &BTAdapter::mgmtEvConnectFailedHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::DEVICE_DISCONNECTED, jau::bind_member(this, &BTAdapter::mgmtEvDeviceDisconnectedHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::DEVICE_FOUND, jau::bind_member(this, &BTAdapter::mgmtEvDeviceFoundHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_REMOTE_FEATURES, jau::bind_member(this, &BTAdapter::mgmtEvHCILERemoteUserFeaturesHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_PHY_UPDATE_COMPLETE, jau::bind_member(this, &BTAdapter::mgmtEvHCILEPhyUpdateCompleteHCI)) && ok;
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_ENC_CHANGED, jau::bindMemberFunc(this, &BTAdapter::mgmtEvHCIEncryptionChangedHCI)) && ok;
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_ENC_KEY_REFRESH_COMPLETE, jau::bindMemberFunc(this, &BTAdapter::mgmtEvHCIEncryptionKeyRefreshCompleteHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_ENC_CHANGED, jau::bind_member(this, &BTAdapter::mgmtEvHCIEncryptionChangedHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_ENC_KEY_REFRESH_COMPLETE, jau::bind_member(this, &BTAdapter::mgmtEvHCIEncryptionKeyRefreshCompleteHCI)) && ok;
if constexpr ( CONSIDER_HCI_CMD_FOR_SMP_STATE ) {
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_LTK_REQUEST, jau::bindMemberFunc(this, &BTAdapter::mgmtEvLELTKReqEventHCI)) && ok;
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_LTK_REPLY_ACK, jau::bindMemberFunc(this, &BTAdapter::mgmtEvLELTKReplyAckCmdHCI)) && ok;
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_LTK_REPLY_REJ, jau::bindMemberFunc(this, &BTAdapter::mgmtEvLELTKReplyRejCmdHCI)) && ok;
- ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_ENABLE_ENC, jau::bindMemberFunc(this, &BTAdapter::mgmtEvLEEnableEncryptionCmdHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_LTK_REQUEST, jau::bind_member(this, &BTAdapter::mgmtEvLELTKReqEventHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_LTK_REPLY_ACK, jau::bind_member(this, &BTAdapter::mgmtEvLELTKReplyAckCmdHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_LTK_REPLY_REJ, jau::bind_member(this, &BTAdapter::mgmtEvLELTKReplyRejCmdHCI)) && ok;
+ ok = hci.addMgmtEventCallback(MgmtEvent::Opcode::HCI_LE_ENABLE_ENC, jau::bind_member(this, &BTAdapter::mgmtEvLEEnableEncryptionCmdHCI)) && ok;
}
if( !ok ) {
ERR_PRINT("Could not add all required MgmtEventCallbacks to HCIHandler: %s of %s", hci.toString().c_str(), toString().c_str());
return false; // dtor local HCIHandler w/ closing
}
- hci.addSMPMsgCallback(jau::bindMemberFunc(this, &BTAdapter::hciSMPMsgCallback));
+ hci.addSMPMsgCallback(jau::bind_member(this, &BTAdapter::hciSMPMsgCallback));
} else {
mgmt->removeMgmtEventCallback(dev_id);
hci.clearAllCallbacks();
@@ -388,18 +388,18 @@ BTAdapter::BTAdapter(const BTAdapter::ctor_cookie& cc, const BTManagerRef& mgmt_
smp_watchdog("adapter"+std::to_string(dev_id)+"_smp_watchdog", THREAD_SHUTDOWN_TIMEOUT_MS),
l2cap_att_srv(dev_id, adapterInfo_.addressAndType, L2CAP_PSM::UNDEFINED, L2CAP_CID::ATT),
l2cap_service("BTAdapter::l2capServer", THREAD_SHUTDOWN_TIMEOUT_MS,
- jau::bindMemberFunc(this, &BTAdapter::l2capServerWork),
- jau::bindMemberFunc(this, &BTAdapter::l2capServerInit),
- jau::bindMemberFunc(this, &BTAdapter::l2capServerEnd)),
+ jau::bind_member(this, &BTAdapter::l2capServerWork),
+ jau::bind_member(this, &BTAdapter::l2capServerInit),
+ jau::bind_member(this, &BTAdapter::l2capServerEnd)),
discovery_service("BTAdapter::discoveryServer", 400_ms,
- jau::bindMemberFunc(this, &BTAdapter::discoveryServerWork))
+ jau::bind_member(this, &BTAdapter::discoveryServerWork))
{
(void)cc;
adapter_operational = initialSetup();
if( isValid() ) {
- const bool r = smp_watchdog.start(SMP_NEXT_EVENT_TIMEOUT_MS, jau::bindMemberFunc(this, &BTAdapter::smp_timeoutfunc));
+ const bool r = smp_watchdog.start(SMP_NEXT_EVENT_TIMEOUT_MS, jau::bind_member(this, &BTAdapter::smp_timeoutfunc));
DBG_PRINT("BTAdapter::ctor: dev_id %d: smp_watchdog.smp_timeoutfunc started %d", dev_id, r);
}
}
@@ -1791,7 +1791,7 @@ bool BTAdapter::mgmtEvLocalNameChangedMgmt(const MgmtEvent& e) noexcept {
void BTAdapter::l2capServerInit(jau::service_runner& sr0) noexcept {
(void)sr0;
- l2cap_att_srv.set_interrupted_query( jau::bindMemberFunc(&l2cap_service, &jau::service_runner::shall_stop2) );
+ l2cap_att_srv.set_interrupted_query( jau::bind_member(&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 0ed46416..ebe92357 100644
--- a/src/direct_bt/BTGattHandler.cpp
+++ b/src/direct_bt/BTGattHandler.cpp
@@ -599,9 +599,9 @@ BTGattHandler::BTGattHandler(const BTDeviceRef &device, L2CAPClient& l2cap_att,
rbuffer(number(Defaults::MAX_ATT_MTU), jau::endian::little),
is_connected(l2cap.is_open()), has_ioerror(false),
l2cap_reader_service("GATTHandler::reader_"+deviceString, THREAD_SHUTDOWN_TIMEOUT_MS,
- jau::bindMemberFunc(this, &BTGattHandler::l2capReaderWork),
+ jau::bind_member(this, &BTGattHandler::l2capReaderWork),
jau::service_runner::Callback() /* init */,
- jau::bindMemberFunc(this, &BTGattHandler::l2capReaderEndLocked)),
+ jau::bind_member(this, &BTGattHandler::l2capReaderEndLocked)),
attPDURing(env.ATTPDU_RING_CAPACITY),
serverMTU(number(Defaults::MIN_ATT_MTU)), usedMTU(number(Defaults::MIN_ATT_MTU)), clientMTUExchanged(false),
gattServerData( GATTRole::Server == role ? device->getAdapter().getGATTServerData() : nullptr ),
@@ -617,8 +617,8 @@ 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_interrupted_query( jau::bindMemberFunc(&l2cap_reader_service, &jau::service_runner::shall_stop2) );
- l2cap.set_interrupted_query( jau::bindMemberFunc(this, &BTGattHandler::l2capReaderInterrupted) );
+ // l2cap.set_interrupted_query( jau::bind_member(&l2cap_reader_service, &jau::service_runner::shall_stop2) );
+ l2cap.set_interrupted_query( jau::bind_member(this, &BTGattHandler::l2capReaderInterrupted) );
l2cap_reader_service.start();
DBG_PRINT("GATTHandler::ctor: Started: GattHandler[%s], l2cap[%s]: %s",
diff --git a/src/direct_bt/BTManager.cpp b/src/direct_bt/BTManager.cpp
index ade23896..33ef6df5 100644
--- a/src/direct_bt/BTManager.cpp
+++ b/src/direct_bt/BTManager.cpp
@@ -140,7 +140,7 @@ void BTManager::sendMgmtEvent(const MgmtEvent& event) noexcept {
jau::for_each_fidelity(mgmtEventCallbackList, [&](MgmtAdapterEventCallback &cb) {
if( 0 > cb.getDevID() || dev_id == cb.getDevID() ) {
try {
- cb.getCallback().invoke(event);
+ cb.getCallback()(event);
} catch (std::exception &e) {
ERR_PRINT("BTManager::sendMgmtEvent-CBs %d/%zd: MgmtAdapterEventCallback %s : Caught exception %s",
invokeCount+1, mgmtEventCallbackList.size(),
@@ -364,9 +364,9 @@ BTManager::BTManager() noexcept
: env(MgmtEnv::get()),
rbuffer(ClientMaxMTU, jau::endian::little), comm(HCI_DEV_NONE, HCI_CHANNEL_CONTROL),
mgmt_reader_service("HCIHandler::reader", THREAD_SHUTDOWN_TIMEOUT_MS,
- jau::bindMemberFunc(this, &BTManager::mgmtReaderWork),
+ jau::bind_member(this, &BTManager::mgmtReaderWork),
jau::service_runner::Callback() /* init */,
- jau::bindMemberFunc(this, &BTManager::mgmtReaderEndLocked)),
+ jau::bind_member(this, &BTManager::mgmtReaderEndLocked)),
mgmtEventRing(env.MGMT_EVT_RING_CAPACITY),
allowClose( comm.is_open() )
{
@@ -381,7 +381,7 @@ BTManager::BTManager() noexcept
}
bool BTManager::initialize(const std::shared_ptr<BTManager>& self) noexcept {
- comm.set_interrupted_query( jau::bindMemberFunc(&mgmt_reader_service, &jau::service_runner::shall_stop2) );
+ comm.set_interrupted_query( jau::bind_member(&mgmt_reader_service, &jau::service_runner::shall_stop2) );
mgmt_reader_service.start();
PERF_TS_T0();
@@ -465,34 +465,34 @@ next1:
}
}
- addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_SETTINGS, jau::bindMemberFunc(this, &BTManager::mgmtEvNewSettingsCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_SETTINGS, jau::bind_member(this, &BTManager::mgmtEvNewSettingsCB));
if( jau::environment::get().debug ) {
- addMgmtEventCallback(-1, MgmtEvent::Opcode::CONTROLLER_ERROR, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::CLASS_OF_DEV_CHANGED, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_LINK_KEY, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_LONG_TERM_KEY, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_CONNECTED, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_DISCONNECTED, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::CONNECT_FAILED, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::PIN_CODE_REQUEST, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::USER_CONFIRM_REQUEST, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::USER_PASSKEY_REQUEST, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::AUTH_FAILED, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_FOUND, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::DISCOVERING, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_BLOCKED, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_UNBLOCKED, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_UNPAIRED, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::PASSKEY_NOTIFY, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_IRK, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_CSRK, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_WHITELIST_ADDED, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_WHITELIST_REMOVED, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_CONN_PARAM, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
-
- addMgmtEventCallback(-1, MgmtEvent::Opcode::LOCAL_OOB_DATA_UPDATED, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
- addMgmtEventCallback(-1, MgmtEvent::Opcode::PAIR_DEVICE_COMPLETE, jau::bindMemberFunc(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::CONTROLLER_ERROR, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::CLASS_OF_DEV_CHANGED, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_LINK_KEY, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_LONG_TERM_KEY, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_CONNECTED, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_DISCONNECTED, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::CONNECT_FAILED, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::PIN_CODE_REQUEST, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::USER_CONFIRM_REQUEST, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::USER_PASSKEY_REQUEST, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::AUTH_FAILED, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_FOUND, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::DISCOVERING, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_BLOCKED, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_UNBLOCKED, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_UNPAIRED, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::PASSKEY_NOTIFY, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_IRK, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_CSRK, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_WHITELIST_ADDED, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::DEVICE_WHITELIST_REMOVED, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::NEW_CONN_PARAM, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::LOCAL_OOB_DATA_UPDATED, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
+ addMgmtEventCallback(-1, MgmtEvent::Opcode::PAIR_DEVICE_COMPLETE, jau::bind_member(this, &BTManager::mgmtEventAnyCB));
}
PERF_TS_TD("BTManager::ctor.ok");
DBG_PRINT("BTManager::ctor: OK");
@@ -1184,7 +1184,7 @@ void BTManager::addChangedAdapterSetCallback(const ChangedAdapterSetCallback & l
mgmtChangedAdapterSetCallbackList.push_back(l);
jau::for_each_fidelity(adapters, [&](std::shared_ptr<BTAdapter>& ai) {
- l_p->invoke(true /* added */, ai);
+ (*l_p)(true /* added */, ai);
});
}
int BTManager::removeChangedAdapterSetCallback(const ChangedAdapterSetCallback & l) {
@@ -1193,12 +1193,10 @@ int BTManager::removeChangedAdapterSetCallback(const ChangedAdapterSetCallback &
void BTManager::addChangedAdapterSetCallback(ChangedAdapterSetFunc f) {
addChangedAdapterSetCallback(
- ChangedAdapterSetCallback(
- jau::bindFreeFunc<bool, bool, std::shared_ptr<BTAdapter>&>(f)
- ) );
+ ChangedAdapterSetCallback( jau::bind_free(f) ) );
}
int BTManager::removeChangedAdapterSetCallback(ChangedAdapterSetFunc f) {
- ChangedAdapterSetCallback l( jau::bindFreeFunc<bool, bool, std::shared_ptr<BTAdapter>&>(f) );
+ ChangedAdapterSetCallback l( jau::bind_free(f) );
return mgmtChangedAdapterSetCallbackList.erase_matching(l, true /* all_matching */, _changedAdapterSetCallbackEqComp);
}
diff --git a/src/direct_bt/HCIHandler.cpp b/src/direct_bt/HCIHandler.cpp
index 41c8b3cf..6af291ca 100644
--- a/src/direct_bt/HCIHandler.cpp
+++ b/src/direct_bt/HCIHandler.cpp
@@ -662,9 +662,9 @@ HCIHandler::HCIHandler(const uint16_t dev_id_, const BTMode btMode_) noexcept
rbuffer(HCI_MAX_MTU, jau::endian::little),
comm(dev_id_, HCI_CHANNEL_RAW),
hci_reader_service("HCIHandler::reader", THREAD_SHUTDOWN_TIMEOUT_MS,
- jau::bindMemberFunc(this, &HCIHandler::hciReaderWork),
+ jau::bind_member(this, &HCIHandler::hciReaderWork),
jau::service_runner::Callback() /* init */,
- jau::bindMemberFunc(this, &HCIHandler::hciReaderEndLocked)),
+ jau::bind_member(this, &HCIHandler::hciReaderEndLocked)),
hciEventRing(env.HCI_EVT_RING_CAPACITY),
le_ll_feats( LE_Features::NONE ),
sup_commands_set( false ),
@@ -681,7 +681,7 @@ HCIHandler::HCIHandler(const uint16_t dev_id_, const BTMode btMode_) noexcept
return;
}
- comm.set_interrupted_query( jau::bindMemberFunc(&hci_reader_service, &jau::service_runner::shall_stop2) );
+ comm.set_interrupted_query( jau::bind_member(&hci_reader_service, &jau::service_runner::shall_stop2) );
hci_reader_service.start();
PERF_TS_T0();
diff --git a/src/direct_bt/SMPHandler.cpp b/src/direct_bt/SMPHandler.cpp
index 32db2be1..40c3b4a5 100644
--- a/src/direct_bt/SMPHandler.cpp
+++ b/src/direct_bt/SMPHandler.cpp
@@ -169,9 +169,9 @@ SMPHandler::SMPHandler(const std::shared_ptr<BTDevice> &device) noexcept
l2cap(device->getAdapter().dev_id, device->getAdapter().getAddressAndType(), L2CAP_PSM::UNDEFINED, L2CAP_CID::SMP),
is_connected(l2cap.open(*device)), has_ioerror(false),
smp_reader_service("SMPHandler::reader", THREAD_SHUTDOWN_TIMEOUT_MS,
- jau::bindMemberFunc(this, &SMPHandler::smpReaderWork),
+ jau::bind_member(this, &SMPHandler::smpReaderWork),
jau::service_runner::Callback() /* init */,
- jau::bindMemberFunc(this, &SMPHandler::smpReaderEndLocked)),
+ jau::bind_member(this, &SMPHandler::smpReaderEndLocked)),
smpPDURing(env.SMPPDU_RING_CAPACITY),
mtu(number(Defaults::MIN_SMP_MTU))
{
@@ -181,7 +181,7 @@ SMPHandler::SMPHandler(const std::shared_ptr<BTDevice> &device) noexcept
return;
}
- l2cap.set_interrupted_query( jau::bindMemberFunc(&smp_reader_service, &jau::service_runner::shall_stop2) );
+ l2cap.set_interrupted_query( jau::bind_member(&smp_reader_service, &jau::service_runner::shall_stop2) );
smp_reader_service.start();
DBG_PRINT("SMPHandler::ctor: Started: SMPHandler[%s], l2cap[%s]: %s",
diff --git a/src/direct_bt/SMPKeyBin.cpp b/src/direct_bt/SMPKeyBin.cpp
index eb561e2c..e0f8be85 100644
--- a/src/direct_bt/SMPKeyBin.cpp
+++ b/src/direct_bt/SMPKeyBin.cpp
@@ -41,7 +41,7 @@ using namespace direct_bt;
static std::vector<std::string> get_file_list(const std::string& dname) {
std::vector<std::string> res;
- const jau::fs::consume_dir_item cs = jau::bindCaptureRefFunc(&res,
+ const jau::fs::consume_dir_item cs = jau::bind_capref(&res,
( void(*)(std::vector<std::string>*, const jau::fs::dir_item&) ) /* help template type deduction of function-ptr */
( [](std::vector<std::string>* receiver, const jau::fs::dir_item& item) -> void {
if( 0 == item.basename().find("bd_") ) { // prefix checl
diff --git a/trial/direct_bt/dbt_base_client_server.hpp b/trial/direct_bt/dbt_base_client_server.hpp
index bc56b767..8c40bdf8 100644
--- a/trial/direct_bt/dbt_base_client_server.hpp
+++ b/trial/direct_bt/dbt_base_client_server.hpp
@@ -119,7 +119,7 @@ class BaseDBTClientServer {
test_timeout = timeout;
resetStates();
if( !timeout.is_zero() ) {
- timeout_timer.start(timeout, jau::bindMemberFunc(this, &BaseDBTClientServer::timeout_func));
+ timeout_timer.start(timeout, jau::bind_member(this, &BaseDBTClientServer::timeout_func));
}
}
diff --git a/trial/direct_bt/dbt_endpoint.hpp b/trial/direct_bt/dbt_endpoint.hpp
index 129fdd8a..10e013dd 100644
--- a/trial/direct_bt/dbt_endpoint.hpp
+++ b/trial/direct_bt/dbt_endpoint.hpp
@@ -125,7 +125,7 @@ class DBTEndpoint {
static ChangedAdapterSetCallback initChangedAdapterSetListener(const BTManagerRef& manager, std::vector<DBTEndpointRef> endpts) {
const std::lock_guard<std::mutex> lock(mtx_cas_endpts); // RAII-style acquire and relinquish via destructor
cas_endpts = std::move( endpts );
- ChangedAdapterSetCallback casc = jau::bindFreeFunc(&DBTEndpoint::myChangedAdapterSetFunc);
+ ChangedAdapterSetCallback casc = jau::bind_free(&DBTEndpoint::myChangedAdapterSetFunc);
manager->addChangedAdapterSetCallback(casc);
for(DBTEndpointRef endpt : cas_endpts ) {
REQUIRE( nullptr != endpt->getAdapter() );
diff --git a/trial/direct_bt/dbt_server01.hpp b/trial/direct_bt/dbt_server01.hpp
index 11a3d027..fef090c6 100644
--- a/trial/direct_bt/dbt_server01.hpp
+++ b/trial/direct_bt/dbt_server01.hpp
@@ -413,9 +413,9 @@ class DBTServer01 : public DBTServerTest {
MyGATTServerListener(DBTServer01& p)
: parent(p),
pulse_service("MyGATTServerListener::pulse", THREAD_SHUTDOWN_TIMEOUT_MS,
- jau::bindMemberFunc(this, &MyGATTServerListener::pulse_worker),
- jau::bindMemberFunc(this, &MyGATTServerListener::pulse_worker_init),
- jau::bindMemberFunc(this, &MyGATTServerListener::pulse_worker_end))
+ jau::bind_member(this, &MyGATTServerListener::pulse_worker),
+ jau::bind_member(this, &MyGATTServerListener::pulse_worker_init),
+ jau::bind_member(this, &MyGATTServerListener::pulse_worker_end))
{
pulse_service.start();
}