diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dbt_peripheral00.cpp | 36 | ||||
-rw-r--r-- | examples/dbt_repeater00.cpp | 40 | ||||
-rw-r--r-- | examples/dbt_scanner10.cpp | 12 |
3 files changed, 44 insertions, 44 deletions
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()); |