aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-11-28 22:07:23 +0100
committerSven Gothel <[email protected]>2022-11-28 22:07:23 +0100
commitbcd344e80c4b7b0a13c78a26999727748dcc5dc7 (patch)
tree9e69e15668afdf80c3142151364526cc7aee640d
parent6949c0d04f1ef57fa513125896466859a59500f5 (diff)
clang-tidy fixes part-4 / 4: Use 'const T&' for arguments on listener types
- AdapterStatusListener - BTGattHandler::NativeGattCharListener - DBGattServer::Listener
-rw-r--r--api/direct_bt/BTAdapter.hpp12
-rw-r--r--api/direct_bt/BTGattHandler.hpp40
-rw-r--r--api/direct_bt/DBGattServer.hpp20
-rw-r--r--examples/dbt_peripheral00.cpp36
-rw-r--r--examples/dbt_repeater00.cpp40
-rw-r--r--examples/dbt_scanner10.cpp12
-rw-r--r--java/jni/direct_bt/DBGattServer.cxx20
-rw-r--r--trial/direct_bt/dbt_client01.hpp14
-rw-r--r--trial/direct_bt/dbt_client_server1x.hpp2
-rw-r--r--trial/direct_bt/dbt_server01.hpp36
10 files changed, 116 insertions, 116 deletions
diff --git a/api/direct_bt/BTAdapter.hpp b/api/direct_bt/BTAdapter.hpp
index b8613626..5e6a0647 100644
--- a/api/direct_bt/BTAdapter.hpp
+++ b/api/direct_bt/BTAdapter.hpp
@@ -182,7 +182,7 @@ namespace direct_bt {
* @see BTDevice::unpair()
* @see BTDevice::getEIR()
*/
- virtual bool deviceFound(BTDeviceRef device, const uint64_t timestamp) {
+ virtual bool deviceFound(const BTDeviceRef& device, const uint64_t timestamp) {
(void)device;
(void)timestamp;
return false;
@@ -196,7 +196,7 @@ namespace direct_bt {
*
* @see BTDevice::getEIR()
*/
- virtual void deviceUpdated(BTDeviceRef device, const EIRDataType updateMask, const uint64_t timestamp) {
+ virtual void deviceUpdated(const BTDeviceRef& device, const EIRDataType updateMask, const uint64_t timestamp) {
(void)device;
(void)updateMask;
(void)timestamp;
@@ -213,7 +213,7 @@ namespace direct_bt {
* @see BTDevice::unpair()
* @since 2.6.6
*/
- virtual void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) {
+ virtual void deviceConnected(const BTDeviceRef& device, const bool discovered, const uint64_t timestamp) {
(void)device;
(void)discovered;
(void)timestamp;
@@ -228,7 +228,7 @@ namespace direct_bt {
* @see BTDevice::setPairingPasskey()
* @see BTDevice::setPairingNumericComparison()
*/
- virtual void devicePairingState(BTDeviceRef device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) {
+ virtual void devicePairingState(const BTDeviceRef& device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) {
(void)device;
(void)state;
(void)mode;
@@ -248,7 +248,7 @@ namespace direct_bt {
* @see ::SMPPairingState::COMPLETED
* @see BTDevice::getGattServices()
*/
- virtual void deviceReady(BTDeviceRef device, const uint64_t timestamp) {
+ virtual void deviceReady(const BTDeviceRef& device, const uint64_t timestamp) {
(void)device;
(void)timestamp;
}
@@ -264,7 +264,7 @@ namespace direct_bt {
* @param timestamp the time in monotonic milliseconds when this event occurred. See BasicTypes::getCurrentMilliseconds().
* @see BTDevice::unpair()
*/
- virtual void deviceDisconnected(BTDeviceRef device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) {
+ virtual void deviceDisconnected(const BTDeviceRef& device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) {
(void)device;
(void)reason;
(void)handle;
diff --git a/api/direct_bt/BTGattHandler.hpp b/api/direct_bt/BTGattHandler.hpp
index d19c1b31..c4d832e9 100644
--- a/api/direct_bt/BTGattHandler.hpp
+++ b/api/direct_bt/BTGattHandler.hpp
@@ -316,7 +316,7 @@ namespace direct_bt {
* @param charValue the notification value
* @param timestamp monotonic timestamp at reception, see jau::getCurrentMilliseconds()
*/
- virtual void notificationReceived(BTDeviceRef source, const uint16_t charHandle,
+ virtual void notificationReceived(const BTDeviceRef& source, const uint16_t charHandle,
const jau::TROOctets& charValue, const uint64_t timestamp) = 0;
/**
@@ -327,7 +327,7 @@ namespace direct_bt {
* @param timestamp monotonic timestamp at reception, see jau::getCurrentMilliseconds()
* @param confirmationSent if true, the native stack has sent the confirmation, otherwise user is required to do so.
*/
- virtual void indicationReceived(BTDeviceRef source, const uint16_t charHandle,
+ virtual void indicationReceived(const BTDeviceRef&, const uint16_t charHandle,
const jau::TROOctets& charValue, const uint64_t timestamp,
const bool confirmationSent) = 0;
@@ -335,23 +335,23 @@ namespace direct_bt {
* Informal low-level notification of AttPDUMsg requests to this GATTRole::Server, optional
*
* @param pduRequest the request
- * @param serverDest the GATTRole::Server receiver device, never nullptr
+ * @param serverDest the GATTRole::Server receiver device, never null
* @param clientSource the GATTRole::Client source device, only known and not nullptr for DBGattServer::Mode:FWD GattServerHandler
*/
virtual void requestSent([[maybe_unused]] const AttPDUMsg& pduRequest,
- [[maybe_unused]] BTDeviceRef serverDest,
- [[maybe_unused]] BTDeviceRef clientSource) { }
+ [[maybe_unused]] const BTDeviceRef& serverDest,
+ [[maybe_unused]] const BTDeviceRef& clientSource) { }
/**
* Informal low-level notification of AttPDUMsg responses from this GATTRole::Server, optional.
*
* @param pduReply the response
- * @param serverSource the GATTRole::Server source device, never nullptr
+ * @param serverSource the GATTRole::Server source device, never null
* @param clientDest the GATTRole::Client receiver device, only known and not nullptr for DBGattServer::Mode:FWD GattServerHandler
*/
virtual void replyReceived([[maybe_unused]] const AttPDUMsg& pduReply,
- [[maybe_unused]] BTDeviceRef serverSource,
- [[maybe_unused]] BTDeviceRef clientDest) { }
+ [[maybe_unused]] const BTDeviceRef& serverSource,
+ [[maybe_unused]] const BTDeviceRef& clientDest) { }
/**
* Informal notification about a complete MTU exchange request and response to and from this GATTRole::Server, optional.
@@ -361,7 +361,7 @@ namespace direct_bt {
* @param error_reply in case of an AttErrorRsp reply, the AttErrorRsp::ErrorCode is passed for convenience, otherwise AttErrorRsp::ErrorCode::NO_ERROR.
* @param serverMTU the replied server MTU, passed for convenience
* @param usedMTU the MTU minimum of client and server to be used, passed for convenience
- * @param serverReplier the GATTRole::Server replier device, never nullptr
+ * @param serverReplier the GATTRole::Server replier device, never null
* @param clientRequester the GATTRole::Client requester device, only known and not nullptr for DBGattServer::Mode:FWD GattServerHandler
*/
virtual void mtuResponse([[maybe_unused]] const uint16_t clientMTU,
@@ -369,8 +369,8 @@ namespace direct_bt {
[[maybe_unused]] const AttErrorRsp::ErrorCode error_reply,
[[maybe_unused]] const uint16_t serverMTU,
[[maybe_unused]] const uint16_t usedMTU,
- [[maybe_unused]] BTDeviceRef serverReplier,
- [[maybe_unused]] BTDeviceRef clientRequester) { }
+ [[maybe_unused]] const BTDeviceRef& serverReplier,
+ [[maybe_unused]] const BTDeviceRef& clientRequester) { }
/**
* Informal notification about a completed write request sent to this GATTRole::Server, optional.
*
@@ -378,28 +378,28 @@ namespace direct_bt {
* @param data the data requested to be written
* @param sections list of NativeGattCharListener::Section within given data, requested to be written. Overlapping consecutive sections have already been merged.
* @param with_response true if the write requests expects a response, i.e. via AttPDUMsg::Opcode::WRITE_REQ or AttPDUMsg::Opcode::EXECUTE_WRITE_REQ
- * @param serverDest the GATTRole::Server receiver device, never nullptr
+ * @param serverDest the GATTRole::Server receiver device, never null
* @param clientSource the GATTRole::Client source device, only known and not nullptr for DBGattServer::Mode:FWD GattServerHandler
*/
virtual void writeRequest([[maybe_unused]] const uint16_t handle,
[[maybe_unused]] const jau::TROOctets& data,
[[maybe_unused]] const jau::darray<Section>& sections,
[[maybe_unused]] const bool with_response,
- [[maybe_unused]] BTDeviceRef serverDest,
- [[maybe_unused]] BTDeviceRef clientSource) { }
+ [[maybe_unused]] const BTDeviceRef& serverDest,
+ [[maybe_unused]] const BTDeviceRef& clientSource) { }
/**
* Informal notification about a write response received from this GATTRole::Server, optional.
*
* @param pduReply the write response
* @param error_code in case of an AttErrorRsp reply, the AttErrorRsp::ErrorCode is passed for convenience, otherwise AttErrorRsp::ErrorCode::NO_ERROR.
- * @param serverSource the GATTRole::Server source device, never nullptr
+ * @param serverSource the GATTRole::Server source device, never null
* @param clientDest the GATTRole::Client receiver device, only known and not nullptr for DBGattServer::Mode:FWD GattServerHandler
*/
virtual void writeResponse([[maybe_unused]] const AttPDUMsg& pduReply,
[[maybe_unused]] const AttErrorRsp::ErrorCode error_code,
- [[maybe_unused]] BTDeviceRef serverSource,
- [[maybe_unused]] BTDeviceRef clientDest) { }
+ [[maybe_unused]] const BTDeviceRef& serverSource,
+ [[maybe_unused]] const BTDeviceRef& clientDest) { }
/**
@@ -410,7 +410,7 @@ namespace direct_bt {
* @param pduReply the response
* @param error_reply in case of an AttErrorRsp reply, the AttErrorRsp::ErrorCode is passed for convenience, otherwise AttErrorRsp::ErrorCode::NO_ERROR.
* @param data_reply the replied read data at given value_offset, passed for convenience
- * @param serverReplier the GATTRole::Server replier device, never nullptr
+ * @param serverReplier the GATTRole::Server replier device, never null
* @param clientRequester the GATTRole::Client requester device, only known and not nullptr for DBGattServer::Mode:FWD GattServerHandler
*/
virtual void readResponse([[maybe_unused]] const uint16_t handle,
@@ -418,8 +418,8 @@ namespace direct_bt {
[[maybe_unused]] const AttPDUMsg& pduReply,
[[maybe_unused]] const AttErrorRsp::ErrorCode error_reply,
[[maybe_unused]] const jau::TROOctets& data_reply,
- [[maybe_unused]] BTDeviceRef serverReplier,
- [[maybe_unused]] BTDeviceRef clientRequester) { }
+ [[maybe_unused]] const BTDeviceRef& serverReplier,
+ [[maybe_unused]] const BTDeviceRef& clientRequester) { }
virtual ~NativeGattCharListener() noexcept = default;
diff --git a/api/direct_bt/DBGattServer.hpp b/api/direct_bt/DBGattServer.hpp
index 36463e88..4d899d45 100644
--- a/api/direct_bt/DBGattServer.hpp
+++ b/api/direct_bt/DBGattServer.hpp
@@ -691,7 +691,7 @@ namespace direct_bt {
* @param device the connected device
* @param initialMTU initial used minimum MTU until negotiated.
*/
- virtual void connected(BTDeviceRef device, const uint16_t initialMTU) = 0;
+ virtual void connected(const BTDeviceRef& device, const uint16_t initialMTU) = 0;
/**
* Notification that device got disconnected.
@@ -700,7 +700,7 @@ namespace direct_bt {
*
* @param device the disconnected device.
*/
- virtual void disconnected(BTDeviceRef device) = 0;
+ virtual void disconnected(const BTDeviceRef& device) = 0;
/**
* Notification that the MTU has changed.
@@ -708,7 +708,7 @@ namespace direct_bt {
* @param device the device for which the MTU has changed
* @param mtu the new negotiated MTU
*/
- virtual void mtuChanged(BTDeviceRef device, const uint16_t mtu) = 0;
+ virtual void mtuChanged(const BTDeviceRef& device, const uint16_t mtu) = 0;
/**
* Signals attempt to read a value.
@@ -720,7 +720,7 @@ namespace direct_bt {
* @param c
* @return true if master read has been accepted by GATT-Server listener, otherwise false. Only if all listener return true, the read action will be allowed.
*/
- virtual bool readCharValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c) = 0;
+ virtual bool readCharValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c) = 0;
/**
* Signals attempt to read a value.
@@ -733,7 +733,7 @@ namespace direct_bt {
* @param d
* @return true if master read has been accepted by GATT-Server listener, otherwise false. Only if all listener return true, the read action will be allowed.
*/
- virtual bool readDescValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d) = 0;
+ virtual bool readDescValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d) = 0;
/**
* Signals attempt to write a single or bulk (prepare) value.
@@ -748,7 +748,7 @@ namespace direct_bt {
* @return true if master write has been accepted by GATT-Server listener, otherwise false. Only if all listener return true, the write action will be allowed.
* @see writeCharValueDone()
*/
- virtual bool writeCharValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c,
+ virtual bool writeCharValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c,
const jau::TROOctets & value, const uint16_t value_offset) = 0;
/**
@@ -759,7 +759,7 @@ namespace direct_bt {
* @param c
* @see writeCharValue()
*/
- virtual void writeCharValueDone(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c) = 0;
+ virtual void writeCharValueDone(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c) = 0;
/**
* Signals attempt to write a single or bulk (prepare) value.
@@ -775,7 +775,7 @@ namespace direct_bt {
* @return true if master write has been accepted by GATT-Server listener, otherwise false. Only if all listener return true, the write action will be allowed.
* @see writeDescValueDone()
*/
- virtual bool writeDescValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d,
+ virtual bool writeDescValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d,
const jau::TROOctets & value, const uint16_t value_offset) = 0;
/**
@@ -787,7 +787,7 @@ namespace direct_bt {
* @param d
* @see writeDescValue()
*/
- virtual void writeDescValueDone(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d) = 0;
+ virtual void writeDescValueDone(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d) = 0;
/**
* Notifies a change of the Client Characteristic Configuration Descriptor (CCCD) value.
@@ -799,7 +799,7 @@ namespace direct_bt {
* @param notificationEnabled
* @param indicationEnabled
*/
- virtual void clientCharConfigChanged(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d,
+ virtual void clientCharConfigChanged(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d,
const bool notificationEnabled, const bool indicationEnabled) = 0;
/**
diff --git a/examples/dbt_peripheral00.cpp b/examples/dbt_peripheral00.cpp
index 9bebcea5..ff83084c 100644
--- a/examples/dbt_peripheral00.cpp
+++ b/examples/dbt_peripheral00.cpp
@@ -235,21 +235,21 @@ class MyAdapterStatusListener : public AdapterStatusListener {
(void)timestamp;
}
- bool deviceFound(BTDeviceRef device, const uint64_t timestamp) override {
+ bool deviceFound(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
fprintf_td(stderr, "****** FOUND__-1: NOP %s\n", device->toString(true).c_str());
return false;
}
- void deviceUpdated(BTDeviceRef device, const EIRDataType updateMask, const uint64_t timestamp) override {
+ void deviceUpdated(const BTDeviceRef& device, const EIRDataType updateMask, const uint64_t timestamp) override {
if( SHOW_UPDATE_EVENTS ) {
fprintf_td(stderr, "****** UPDATED: %s of %s\n", to_string(updateMask).c_str(), device->toString(true).c_str());
}
(void)timestamp;
}
- void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ void deviceConnected(const BTDeviceRef& device, const bool discovered, const uint64_t timestamp) override {
fprintf_td(stderr, "****** CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
const bool available = nullptr == getDevice();
if( available ) {
@@ -259,7 +259,7 @@ class MyAdapterStatusListener : public AdapterStatusListener {
(void)timestamp;
}
- void devicePairingState(BTDeviceRef device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
+ void devicePairingState(const BTDeviceRef& device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
fprintf_td(stderr, "****** PAIRING STATE: state %s, mode %s, %s\n",
to_string(state).c_str(), to_string(mode).c_str(), device->toString().c_str());
(void)timestamp;
@@ -316,12 +316,12 @@ class MyAdapterStatusListener : public AdapterStatusListener {
}
}
- void deviceReady(BTDeviceRef device, const uint64_t timestamp) override {
+ void deviceReady(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
fprintf_td(stderr, "****** READY-1: NOP %s\n", device->toString(true).c_str());
}
- void deviceDisconnected(BTDeviceRef device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
+ void deviceDisconnected(const BTDeviceRef& device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
servedConnections = servedConnections + 1;
fprintf_td(stderr, "****** DISCONNECTED (count %zu): Reason 0x%X (%s), old handle %s: %s\n",
servedConnections.load(), static_cast<uint8_t>(reason), to_string(reason).c_str(),
@@ -399,7 +399,7 @@ class MyGATTServerListener : public DBGattServer::Listener {
fprintf_td(stderr, "****** Server GATT::PULSE End %s\n", connectedDeviceStr.c_str());
}
- void sendResponse(jau::POctets data) {
+ void sendResponse(jau::POctets data) { // NOLINT(performance-unnecessary-value-param): Pass-by-value out-of-thread
BTDeviceRef connectedDevice_ = getDevice();
if( nullptr != connectedDevice_ && connectedDevice_->getConnected() ) {
if( 0 != handleResponseDataNotify || 0 != handleResponseDataIndicate ) {
@@ -427,7 +427,7 @@ class MyGATTServerListener : public DBGattServer::Listener {
pulse_service.start();
}
- ~MyGATTServerListener() noexcept {
+ ~MyGATTServerListener() noexcept override {
pulse_service.stop();
}
@@ -436,7 +436,7 @@ class MyGATTServerListener : public DBGattServer::Listener {
clear();
}
- void connected(BTDeviceRef device, const uint16_t initialMTU) override {
+ void connected(const BTDeviceRef& device, const uint16_t initialMTU) override {
jau::sc_atomic_critical sync(sync_data);
const bool match = matches(device);
fprintf_td(stderr, "****** GATT::connected(match %d): initMTU %d, %s\n",
@@ -446,7 +446,7 @@ class MyGATTServerListener : public DBGattServer::Listener {
}
}
- void disconnected(BTDeviceRef device) override {
+ void disconnected(const BTDeviceRef& device) override {
jau::sc_atomic_critical sync(sync_data);
const bool match = matches(device);
fprintf_td(stderr, "****** GATT::disconnected(match %d): %s\n", match, device->toString().c_str());
@@ -455,7 +455,7 @@ class MyGATTServerListener : public DBGattServer::Listener {
}
}
- void mtuChanged(BTDeviceRef device, const uint16_t mtu) override {
+ void mtuChanged(const BTDeviceRef& device, const uint16_t mtu) override {
const bool match = matches(device);
fprintf_td(stderr, "****** GATT::mtuChanged(match %d): %d -> %d, %s\n",
match, match ? (int)usedMTU : 0, (int)mtu, device->toString().c_str());
@@ -464,21 +464,21 @@ class MyGATTServerListener : public DBGattServer::Listener {
}
}
- bool readCharValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c) override {
+ bool readCharValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c) override {
const bool match = matches(device);
fprintf_td(stderr, "****** GATT::readCharValue(match %d): to %s, from\n %s\n %s\n",
match, device->toString().c_str(), s->toString().c_str(), c->toString().c_str());
return match;
}
- bool readDescValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d) override {
+ bool readDescValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d) override {
const bool match = matches(device);
fprintf_td(stderr, "****** GATT::readDescValue(match %d): to %s, from\n %s\n %s\n %s\n",
match, device->toString().c_str(), s->toString().c_str(), c->toString().c_str(), d->toString().c_str());
return match;
}
- bool writeCharValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, const jau::TROOctets & value, const uint16_t value_offset) override {
+ bool writeCharValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const jau::TROOctets & value, const uint16_t value_offset) override {
const bool match = matches(device);
fprintf_td(stderr, "****** GATT::writeCharValue(match %d): %s '%s' @ %u from %s, to\n %s\n %s\n",
match, value.toString().c_str(), jau::dfa_utf8_decode( value.get_ptr(), value.size() ).c_str(),
@@ -486,7 +486,7 @@ class MyGATTServerListener : public DBGattServer::Listener {
device->toString().c_str(), s->toString().c_str(), c->toString().c_str());
return match;
}
- void writeCharValueDone(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c) override {
+ void writeCharValueDone(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c) override {
const bool match = matches(device);
const jau::TROOctets& value = c->getValue();
fprintf_td(stderr, "****** GATT::writeCharValueDone(match %d): From %s, to\n %s\n %s\n Char-Value: %s\n",
@@ -502,7 +502,7 @@ class MyGATTServerListener : public DBGattServer::Listener {
}
}
- bool writeDescValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d, const jau::TROOctets & value, const uint16_t value_offset) override {
+ bool writeDescValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d, const jau::TROOctets & value, const uint16_t value_offset) override {
const bool match = matches(device);
fprintf_td(stderr, "****** GATT::writeDescValue(match %d): %s '%s' @ %u from %s\n %s\n %s\n %s\n",
match, value.toString().c_str(), jau::dfa_utf8_decode( value.get_ptr(), value.size() ).c_str(),
@@ -510,14 +510,14 @@ class MyGATTServerListener : public DBGattServer::Listener {
device->toString().c_str(), s->toString().c_str(), c->toString().c_str(), d->toString().c_str());
return match;
}
- void writeDescValueDone(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d) override {
+ void writeDescValueDone(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d) override {
const bool match = matches(device);
const jau::TROOctets& value = d->getValue();
fprintf_td(stderr, "****** GATT::writeDescValueDone(match %d): From %s\n %s\n %s\n %s\n Desc-Value: %s\n",
match, device->toString().c_str(), s->toString().c_str(), c->toString().c_str(), d->toString().c_str(), value.toString().c_str());
}
- void clientCharConfigChanged(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d, const bool notificationEnabled, const bool indicationEnabled) override {
+ void clientCharConfigChanged(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d, const bool notificationEnabled, const bool indicationEnabled) override {
const bool match = matches(device);
const jau::TROOctets& value = d->getValue();
fprintf_td(stderr, "****** GATT::clientCharConfigChanged(match %d): notify %d, indicate %d from %s\n %s\n %s\n %s\n Desc-Value: %s\n",
diff --git a/examples/dbt_repeater00.cpp b/examples/dbt_repeater00.cpp
index ede1096b..b39adb85 100644
--- a/examples/dbt_repeater00.cpp
+++ b/examples/dbt_repeater00.cpp
@@ -149,7 +149,7 @@ class AdapterToServerStatusListener : public AdapterStatusListener {
(void)timestamp;
}
- bool deviceFound(BTDeviceRef device, const uint64_t timestamp) override {
+ bool deviceFound(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
if( BTDeviceRegistry::isWaitingForAnyDevice() ||
@@ -172,13 +172,13 @@ class AdapterToServerStatusListener : public AdapterStatusListener {
}
}
- void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ void deviceConnected(const BTDeviceRef& device, const bool discovered, const uint64_t timestamp) override {
fprintf_td(stderr, "****** To Server: CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
(void)discovered;
(void)timestamp;
}
- void devicePairingState(BTDeviceRef device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
+ void devicePairingState(const BTDeviceRef& device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
fprintf_td(stderr, "****** To Server: PAIRING STATE: state %s, mode %s, %s\n",
to_string(state).c_str(), to_string(mode).c_str(), device->toString().c_str());
(void)timestamp;
@@ -238,7 +238,7 @@ class AdapterToServerStatusListener : public AdapterStatusListener {
}
}
- void deviceReady(BTDeviceRef device, const uint64_t timestamp) override {
+ void deviceReady(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
if( BTDeviceRegistry::isWaitingForAnyDevice() ||
BTDeviceRegistry::isWaitingForDevice(device->getAddressAndType().address, device->getName())
@@ -252,7 +252,7 @@ class AdapterToServerStatusListener : public AdapterStatusListener {
}
}
- void deviceDisconnected(BTDeviceRef device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
+ void deviceDisconnected(const BTDeviceRef& device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
fprintf_td(stderr, "****** To Server: DISCONNECTED: Reason 0x%X (%s), old handle %s: %s\n",
static_cast<uint8_t>(reason), to_string(reason).c_str(),
to_hexstring(handle).c_str(), device->toString(true).c_str());
@@ -281,7 +281,7 @@ class NativeGattToServerCharListener : public BTGattHandler::NativeGattCharListe
return connectedDeviceToClient;
}
- void notificationReceived(BTDeviceRef source, const uint16_t char_handle,
+ void notificationReceived(const BTDeviceRef& source, const uint16_t char_handle,
const TROOctets& char_value, const uint64_t timestamp) override
{
(void)timestamp;
@@ -300,7 +300,7 @@ class NativeGattToServerCharListener : public BTGattHandler::NativeGattCharListe
}
}
- void indicationReceived(BTDeviceRef source, const uint16_t char_handle,
+ void indicationReceived(const BTDeviceRef& source, const uint16_t char_handle,
const TROOctets& char_value, const uint64_t timestamp,
const bool confirmationSent) override
{
@@ -325,8 +325,8 @@ class NativeGattToServerCharListener : public BTGattHandler::NativeGattCharListe
const AttErrorRsp::ErrorCode error_reply,
const uint16_t serverMTU,
const uint16_t usedMTU,
- BTDeviceRef serverReplier,
- BTDeviceRef clientRequester) override {
+ const BTDeviceRef& serverReplier,
+ const BTDeviceRef& clientRequester) override {
std::string serverReplierS = serverReplier->getAddressAndType().address.toString();
std::string clientRequesterS = nullptr != clientRequester ? clientRequester->getAddressAndType().address.toString() : "nil";
@@ -343,8 +343,8 @@ class NativeGattToServerCharListener : public BTGattHandler::NativeGattCharListe
const jau::TROOctets& data,
const jau::darray<Section>& sections,
const bool with_response,
- BTDeviceRef serverDest,
- BTDeviceRef clientSource) override {
+ const BTDeviceRef& serverDest,
+ const BTDeviceRef& clientSource) override {
std::string serverDestS = serverDest->getAddressAndType().address.toString();
std::string clientSourceS = nullptr != clientSource ? clientSource->getAddressAndType().address.toString() : "nil";
@@ -362,8 +362,8 @@ class NativeGattToServerCharListener : public BTGattHandler::NativeGattCharListe
void writeResponse(const AttPDUMsg& pduReply,
const AttErrorRsp::ErrorCode error_code,
- BTDeviceRef serverSource,
- BTDeviceRef clientDest) override {
+ const BTDeviceRef& serverSource,
+ const BTDeviceRef& clientDest) override {
std::string serverSourceS = serverSource->getAddressAndType().address.toString();
std::string clientDestS = nullptr != clientDest ? clientDest->getAddressAndType().address.toString() : "nil";
@@ -379,8 +379,8 @@ class NativeGattToServerCharListener : public BTGattHandler::NativeGattCharListe
const AttPDUMsg& pduReply,
const AttErrorRsp::ErrorCode error_reply,
const jau::TROOctets& data_reply,
- BTDeviceRef serverReplier,
- BTDeviceRef clientRequester) override {
+ const BTDeviceRef& serverReplier,
+ const BTDeviceRef& clientRequester) override {
std::string serverReplierS = serverReplier->getAddressAndType().address.toString();
std::string clientRequesterS = nullptr != clientRequester ? clientRequester->getAddressAndType().address.toString() : "nil";
@@ -595,20 +595,20 @@ class AdapterToClientStatusListener : public AdapterStatusListener {
(void)timestamp;
}
- bool deviceFound(BTDeviceRef device, const uint64_t timestamp) override {
+ bool deviceFound(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
fprintf_td(stderr, "****** To Client: FOUND__-1: NOP %s\n", device->toString(true).c_str());
return false;
}
- void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ void deviceConnected(const BTDeviceRef& device, const bool discovered, const uint64_t timestamp) override {
fprintf_td(stderr, "****** To Client: CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
(void)discovered;
(void)timestamp;
}
- void devicePairingState(BTDeviceRef device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
+ void devicePairingState(const BTDeviceRef& device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
fprintf_td(stderr, "****** To Client: PAIRING STATE: state %s, mode %s, %s\n",
to_string(state).c_str(), to_string(mode).c_str(), device->toString().c_str());
(void)timestamp;
@@ -665,7 +665,7 @@ class AdapterToClientStatusListener : public AdapterStatusListener {
}
}
- void deviceReady(BTDeviceRef device, const uint64_t timestamp) override {
+ void deviceReady(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
{
jau::sc_atomic_critical sync(sync_data);
@@ -674,7 +674,7 @@ class AdapterToClientStatusListener : public AdapterStatusListener {
fprintf_td(stderr, "****** To Client: READY-0: Processing %s\n", device->toString(true).c_str());
}
- void deviceDisconnected(BTDeviceRef device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
+ void deviceDisconnected(const BTDeviceRef& device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
servedClientConnections = servedClientConnections + 1;
fprintf_td(stderr, "****** DISCONNECTED (count %zu): Reason 0x%X (%s), old handle %s: %s\n",
servedClientConnections.load(), static_cast<uint8_t>(reason), to_string(reason).c_str(),
diff --git a/examples/dbt_scanner10.cpp b/examples/dbt_scanner10.cpp
index 0866dc6a..2905798f 100644
--- a/examples/dbt_scanner10.cpp
+++ b/examples/dbt_scanner10.cpp
@@ -179,7 +179,7 @@ class MyAdapterStatusListener : public AdapterStatusListener {
(void)timestamp;
}
- bool deviceFound(BTDeviceRef device, const uint64_t timestamp) override {
+ bool deviceFound(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
if( BTDeviceRegistry::isWaitingForAnyDevice() ||
@@ -204,20 +204,20 @@ class MyAdapterStatusListener : public AdapterStatusListener {
}
}
- void deviceUpdated(BTDeviceRef device, const EIRDataType updateMask, const uint64_t timestamp) override {
+ void deviceUpdated(const BTDeviceRef& device, const EIRDataType updateMask, const uint64_t timestamp) override {
if( !QUIET && SHOW_UPDATE_EVENTS ) {
fprintf_td(stderr, "****** UPDATED: %s of %s\n", to_string(updateMask).c_str(), device->toString(true).c_str());
}
(void)timestamp;
}
- void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ void deviceConnected(const BTDeviceRef& device, const bool discovered, const uint64_t timestamp) override {
fprintf_td(stderr, "****** CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
(void)discovered;
(void)timestamp;
}
- void devicePairingState(BTDeviceRef device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
+ void devicePairingState(const BTDeviceRef& device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
fprintf_td(stderr, "****** PAIRING STATE: state %s, mode %s, %s\n",
to_string(state).c_str(), to_string(mode).c_str(), device->toString().c_str());
(void)timestamp;
@@ -277,14 +277,14 @@ class MyAdapterStatusListener : public AdapterStatusListener {
}
}
- void deviceReady(BTDeviceRef device, const uint64_t timestamp) override {
+ void deviceReady(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
deviceReadyCount++;
fprintf_td(stderr, "****** READY-0: Processing[%d] %s\n", deviceReadyCount.load(), device->toString(true).c_str());
processReadyDevice(device); // AdapterStatusListener::deviceReady() explicitly allows prolonged and complex code execution!
}
- void deviceDisconnected(BTDeviceRef device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
+ void deviceDisconnected(const BTDeviceRef& device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
fprintf_td(stderr, "****** DISCONNECTED: Reason 0x%X (%s), old handle %s: %s\n",
static_cast<uint8_t>(reason), to_string(reason).c_str(),
to_hexstring(handle).c_str(), device->toString(true).c_str());
diff --git a/java/jni/direct_bt/DBGattServer.cxx b/java/jni/direct_bt/DBGattServer.cxx
index 8d8ba99c..d3824c7e 100644
--- a/java/jni/direct_bt/DBGattServer.cxx
+++ b/java/jni/direct_bt/DBGattServer.cxx
@@ -637,7 +637,7 @@ class JNIDBGattServerListener : public DBGattServer::Listener {
~JNIDBGattServerListener() noexcept override = default;
- void connected(BTDeviceRef device, const uint16_t initialMTU) override {
+ void connected(const BTDeviceRef& device, const uint16_t initialMTU) override {
jobject j_device = JavaGlobalObj::checkAndGetObject(device->getJavaObject(), E_FILE_LINE);
JNIEnv *env = *jni_env;
@@ -645,7 +645,7 @@ class JNIDBGattServerListener : public DBGattServer::Listener {
java_exception_check_and_throw(env, E_FILE_LINE);
}
- void disconnected(BTDeviceRef device) override {
+ void disconnected(const BTDeviceRef& device) override {
jobject j_device = JavaGlobalObj::checkAndGetObject(device->getJavaObject(), E_FILE_LINE);
JNIEnv *env = *jni_env;
@@ -653,7 +653,7 @@ class JNIDBGattServerListener : public DBGattServer::Listener {
java_exception_check_and_throw(env, E_FILE_LINE);
}
- void mtuChanged(BTDeviceRef device, const uint16_t mtu) override {
+ void mtuChanged(const BTDeviceRef& device, const uint16_t mtu) override {
jobject j_device = JavaGlobalObj::checkAndGetObject(device->getJavaObject(), E_FILE_LINE);
JNIEnv *env = *jni_env;
@@ -661,7 +661,7 @@ class JNIDBGattServerListener : public DBGattServer::Listener {
java_exception_check_and_throw(env, E_FILE_LINE);
}
- bool readCharValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c) override {
+ bool readCharValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c) override {
jobject j_device = JavaGlobalObj::checkAndGetObject(device->getJavaObject(), E_FILE_LINE);
jobject j_s = JavaGlobalObj::checkAndGetObject(s->getJavaObject(), E_FILE_LINE);
jobject j_c = JavaGlobalObj::checkAndGetObject(c->getJavaObject(), E_FILE_LINE);
@@ -672,7 +672,7 @@ class JNIDBGattServerListener : public DBGattServer::Listener {
return JNI_TRUE == res;
}
- bool readDescValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d) override {
+ bool readDescValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d) override {
jobject j_device = JavaGlobalObj::checkAndGetObject(device->getJavaObject(), E_FILE_LINE);
jobject j_s = JavaGlobalObj::checkAndGetObject(s->getJavaObject(), E_FILE_LINE);
jobject j_c = JavaGlobalObj::checkAndGetObject(c->getJavaObject(), E_FILE_LINE);
@@ -684,7 +684,7 @@ class JNIDBGattServerListener : public DBGattServer::Listener {
return JNI_TRUE == res;
}
- bool writeCharValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, const jau::TROOctets & value, const uint16_t value_offset) override {
+ bool writeCharValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const jau::TROOctets & value, const uint16_t value_offset) override {
jobject j_device = JavaGlobalObj::checkAndGetObject(device->getJavaObject(), E_FILE_LINE);
jobject j_s = JavaGlobalObj::checkAndGetObject(s->getJavaObject(), E_FILE_LINE);
jobject j_c = JavaGlobalObj::checkAndGetObject(c->getJavaObject(), E_FILE_LINE);
@@ -700,7 +700,7 @@ class JNIDBGattServerListener : public DBGattServer::Listener {
env->DeleteLocalRef(j_value);
return JNI_TRUE == res;
}
- void writeCharValueDone(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c) override {
+ void writeCharValueDone(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c) override {
jobject j_device = JavaGlobalObj::checkAndGetObject(device->getJavaObject(), E_FILE_LINE);
jobject j_s = JavaGlobalObj::checkAndGetObject(s->getJavaObject(), E_FILE_LINE);
jobject j_c = JavaGlobalObj::checkAndGetObject(c->getJavaObject(), E_FILE_LINE);
@@ -710,7 +710,7 @@ class JNIDBGattServerListener : public DBGattServer::Listener {
java_exception_check_and_throw(env, E_FILE_LINE);
}
- bool writeDescValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d, const jau::TROOctets & value, const uint16_t value_offset) override {
+ bool writeDescValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d, const jau::TROOctets & value, const uint16_t value_offset) override {
jobject j_device = JavaGlobalObj::checkAndGetObject(device->getJavaObject(), E_FILE_LINE);
jobject j_s = JavaGlobalObj::checkAndGetObject(s->getJavaObject(), E_FILE_LINE);
jobject j_c = JavaGlobalObj::checkAndGetObject(c->getJavaObject(), E_FILE_LINE);
@@ -727,7 +727,7 @@ class JNIDBGattServerListener : public DBGattServer::Listener {
env->DeleteLocalRef(j_value);
return JNI_TRUE == res;
}
- void writeDescValueDone(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d) override {
+ void writeDescValueDone(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d) override {
jobject j_device = JavaGlobalObj::checkAndGetObject(device->getJavaObject(), E_FILE_LINE);
jobject j_s = JavaGlobalObj::checkAndGetObject(s->getJavaObject(), E_FILE_LINE);
jobject j_c = JavaGlobalObj::checkAndGetObject(c->getJavaObject(), E_FILE_LINE);
@@ -738,7 +738,7 @@ class JNIDBGattServerListener : public DBGattServer::Listener {
java_exception_check_and_throw(env, E_FILE_LINE);
}
- void clientCharConfigChanged(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d, const bool notificationEnabled, const bool indicationEnabled) override {
+ void clientCharConfigChanged(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d, const bool notificationEnabled, const bool indicationEnabled) override {
jobject j_device = JavaGlobalObj::checkAndGetObject(device->getJavaObject(), E_FILE_LINE);
jobject j_s = JavaGlobalObj::checkAndGetObject(s->getJavaObject(), E_FILE_LINE);
jobject j_c = JavaGlobalObj::checkAndGetObject(c->getJavaObject(), E_FILE_LINE);
diff --git a/trial/direct_bt/dbt_client01.hpp b/trial/direct_bt/dbt_client01.hpp
index 9b803b39..67f86c24 100644
--- a/trial/direct_bt/dbt_client01.hpp
+++ b/trial/direct_bt/dbt_client01.hpp
@@ -102,7 +102,7 @@ class DBTClient01 : public DBTClientTest {
(void)timestamp;
}
- bool deviceFound(BTDeviceRef device, const uint64_t timestamp) override {
+ bool deviceFound(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
if( BTDeviceRegistry::isWaitingForDevice(device->getAddressAndType().address, device->getName()) &&
0 < parent.measurementsLeft
@@ -123,19 +123,19 @@ class DBTClient01 : public DBTClientTest {
}
}
- void deviceUpdated(BTDeviceRef device, const EIRDataType updateMask, const uint64_t timestamp) override {
+ void deviceUpdated(const BTDeviceRef& device, const EIRDataType updateMask, const uint64_t timestamp) override {
(void)device;
(void)updateMask;
(void)timestamp;
}
- void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ void deviceConnected(const BTDeviceRef& device, const bool discovered, const uint64_t timestamp) override {
fprintf_td(stderr, "****** Client CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
(void)discovered;
(void)timestamp;
}
- void devicePairingState(BTDeviceRef device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
+ void devicePairingState(const BTDeviceRef& device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
fprintf_td(stderr, "****** Client PAIRING STATE: state %s, mode %s, %s\n",
to_string(state).c_str(), to_string(mode).c_str(), device->toString().c_str());
(void)timestamp;
@@ -195,7 +195,7 @@ class DBTClient01 : public DBTClientTest {
}
}
- void disconnectDeviceRandomly(BTDeviceRef device) {
+ void disconnectDeviceRandomly(BTDeviceRef device) { // NOLINT(performance-unnecessary-value-param):
// sleep range: 100 - 1500 ms
// sleep range: 100 - 1500 ms
static const int sleep_min = 100;
@@ -213,7 +213,7 @@ class DBTClient01 : public DBTClientTest {
parent.running_threads.count_down();
}
- void deviceReady(BTDeviceRef device, const uint64_t timestamp) override {
+ void deviceReady(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
{
parent.deviceReadyCount++;
@@ -233,7 +233,7 @@ class DBTClient01 : public DBTClientTest {
}
}
- void deviceDisconnected(BTDeviceRef device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
+ void deviceDisconnected(const BTDeviceRef& device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
fprintf_td(stderr, "****** Client DISCONNECTED: Reason 0x%X (%s), old handle %s: %s\n",
static_cast<uint8_t>(reason), to_string(reason).c_str(),
to_hexstring(handle).c_str(), device->toString(true).c_str());
diff --git a/trial/direct_bt/dbt_client_server1x.hpp b/trial/direct_bt/dbt_client_server1x.hpp
index 9127d66b..217d2a16 100644
--- a/trial/direct_bt/dbt_client_server1x.hpp
+++ b/trial/direct_bt/dbt_client_server1x.hpp
@@ -151,7 +151,7 @@ class DBTClientServer1x {
(void)a;
}
- void deviceReady(BTDeviceRef device, const uint64_t timestamp) override {
+ void deviceReady(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
const std::lock_guard<std::mutex> lock(parent.mtx_sync); // RAII-style acquire and relinquish via destructor
parent.lastCompletedDevice = device;
diff --git a/trial/direct_bt/dbt_server01.hpp b/trial/direct_bt/dbt_server01.hpp
index 047e29b4..450a479f 100644
--- a/trial/direct_bt/dbt_server01.hpp
+++ b/trial/direct_bt/dbt_server01.hpp
@@ -209,21 +209,21 @@ class DBTServer01 : public DBTServerTest {
(void)timestamp;
}
- bool deviceFound(BTDeviceRef device, const uint64_t timestamp) override {
+ bool deviceFound(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
fprintf_td(stderr, "****** Server FOUND__-1: NOP %s\n", device->toString(true).c_str());
return false;
}
- void deviceUpdated(BTDeviceRef device, const EIRDataType updateMask, const uint64_t timestamp) override {
+ void deviceUpdated(const BTDeviceRef& device, const EIRDataType updateMask, const uint64_t timestamp) override {
if( SHOW_UPDATE_EVENTS ) {
fprintf_td(stderr, "****** Server UPDATED: %s of %s\n", to_string(updateMask).c_str(), device->toString(true).c_str());
}
(void)timestamp;
}
- void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override {
+ void deviceConnected(const BTDeviceRef& device, const bool discovered, const uint64_t timestamp) override {
fprintf_td(stderr, "****** Server CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str());
const bool available = nullptr == parent.getDevice();
if( available ) {
@@ -233,7 +233,7 @@ class DBTServer01 : public DBTServerTest {
(void)timestamp;
}
- void devicePairingState(BTDeviceRef device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
+ void devicePairingState(const BTDeviceRef& device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) override {
fprintf_td(stderr, "****** Server PAIRING STATE: state %s, mode %s, %s\n",
to_string(state).c_str(), to_string(mode).c_str(), device->toString().c_str());
(void)timestamp;
@@ -290,12 +290,12 @@ class DBTServer01 : public DBTServerTest {
}
}
- void deviceReady(BTDeviceRef device, const uint64_t timestamp) override {
+ void deviceReady(const BTDeviceRef& device, const uint64_t timestamp) override {
(void)timestamp;
fprintf_td(stderr, "****** Server READY-1: NOP %s\n", device->toString(true).c_str());
}
- void deviceDisconnected(BTDeviceRef device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
+ void deviceDisconnected(const BTDeviceRef& device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
fprintf_td(stderr, "****** Server DISCONNECTED (count %zu): Reason 0x%X (%s), old handle %s: %s\n",
1+parent.disconnectCount.load(), static_cast<uint8_t>(reason), to_string(reason).c_str(),
to_hexstring(handle).c_str(), device->toString(true).c_str());
@@ -366,7 +366,7 @@ class DBTServer01 : public DBTServerTest {
fprintf_td(stderr, "****** Server GATT::PULSE End %s\n", connectedDeviceStr.c_str());
}
- void sendResponse(jau::POctets data) {
+ void sendResponse(jau::POctets data) { // NOLINT(performance-unnecessary-value-param): Pass-by-value out-of-thread
BTDeviceRef connectedDevice_ = parent.getDevice();
if( nullptr != connectedDevice_ && connectedDevice_->getConnected() ) {
if( 0 != handleResponseDataNotify || 0 != handleResponseDataIndicate ) {
@@ -420,7 +420,7 @@ class DBTServer01 : public DBTServerTest {
pulse_service.start();
}
- ~MyGATTServerListener() noexcept {
+ ~MyGATTServerListener() noexcept override {
pulse_service.stop();
}
@@ -441,7 +441,7 @@ class DBTServer01 : public DBTServerTest {
clear();
}
- void connected(BTDeviceRef device, const uint16_t initialMTU) override {
+ void connected(const BTDeviceRef& device, const uint16_t initialMTU) override {
const bool match = parent.matches(device);
fprintf_td(stderr, "****** Server GATT::connected(match %d): initMTU %d, %s\n",
match, (int)initialMTU, device->toString().c_str());
@@ -451,7 +451,7 @@ class DBTServer01 : public DBTServerTest {
}
}
- void disconnected(BTDeviceRef device) override {
+ void disconnected(const BTDeviceRef& device) override {
const bool match = parent.matches(device);
fprintf_td(stderr, "****** Server GATT::disconnected(match %d): %s\n", match, device->toString().c_str());
if( match ) {
@@ -459,7 +459,7 @@ class DBTServer01 : public DBTServerTest {
}
}
- void mtuChanged(BTDeviceRef device, const uint16_t mtu) override {
+ void mtuChanged(const BTDeviceRef& device, const uint16_t mtu) override {
const bool match = parent.matches(device);
const uint16_t usedMTU_old = usedMTU;
if( match ) {
@@ -476,7 +476,7 @@ class DBTServer01 : public DBTServerTest {
}
}
- bool readCharValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c) override {
+ bool readCharValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c) override {
const bool match = parent.matches(device);
if( GATT_VERBOSE ) {
fprintf_td(stderr, "****** Server GATT::readCharValue(match %d): to %s, from\n %s\n %s\n",
@@ -485,7 +485,7 @@ class DBTServer01 : public DBTServerTest {
return match;
}
- bool readDescValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d) override {
+ bool readDescValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d) override {
const bool match = parent.matches(device);
if( GATT_VERBOSE ) {
fprintf_td(stderr, "****** Server GATT::readDescValue(match %d): to %s, from\n %s\n %s\n %s\n",
@@ -494,7 +494,7 @@ class DBTServer01 : public DBTServerTest {
return match;
}
- bool writeCharValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, const jau::TROOctets & value, const uint16_t value_offset) override {
+ bool writeCharValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const jau::TROOctets & value, const uint16_t value_offset) override {
const bool match = parent.matches(device);
if( GATT_VERBOSE ) {
fprintf_td(stderr, "****** Server GATT::writeCharValue(match %d): %s '%s' @ %u from %s, to\n %s\n %s\n",
@@ -505,7 +505,7 @@ class DBTServer01 : public DBTServerTest {
return match;
}
- void writeCharValueDone(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c) override {
+ void writeCharValueDone(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c) override {
const bool match = parent.matches(device);
const jau::TROOctets& value = c->getValue();
bool isFinalHandshake = false;
@@ -542,7 +542,7 @@ class DBTServer01 : public DBTServerTest {
}
}
- bool writeDescValue(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d, const jau::TROOctets & value, const uint16_t value_offset) override {
+ bool writeDescValue(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d, const jau::TROOctets & value, const uint16_t value_offset) override {
const bool match = parent.matches(device);
if( GATT_VERBOSE ) {
fprintf_td(stderr, "****** Server GATT::writeDescValue(match %d): %s '%s' @ %u from %s\n %s\n %s\n %s\n",
@@ -552,7 +552,7 @@ class DBTServer01 : public DBTServerTest {
}
return match;
}
- void writeDescValueDone(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d) override {
+ void writeDescValueDone(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d) override {
if( GATT_VERBOSE ) {
const bool match = parent.matches(device);
const jau::TROOctets& value = d->getValue();
@@ -561,7 +561,7 @@ class DBTServer01 : public DBTServerTest {
}
}
- void clientCharConfigChanged(BTDeviceRef device, DBGattServiceRef s, DBGattCharRef c, DBGattDescRef d, const bool notificationEnabled, const bool indicationEnabled) override {
+ void clientCharConfigChanged(const BTDeviceRef& device, const DBGattServiceRef& s, const DBGattCharRef& c, const DBGattDescRef& d, const bool notificationEnabled, const bool indicationEnabled) override {
const bool match = parent.matches(device);
if( GATT_VERBOSE ) {
const jau::TROOctets& value = d->getValue();