From 8fbab09f53a40175d7fd748914479d09812c426f Mon Sep 17 00:00:00 2001 From: h2zero Date: Thu, 30 Jul 2020 10:06:10 -0600 Subject: [PATCH] Rename refreshServices to deleteAttributes in connect(). Minor semantic change for clarity. Co-authored-by: wakwak-koba --- src/NimBLEClient.cpp | 22 ++++++++++++++-------- src/NimBLEClient.h | 6 +++--- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/NimBLEClient.cpp b/src/NimBLEClient.cpp index 8ae7394..967b972 100644 --- a/src/NimBLEClient.cpp +++ b/src/NimBLEClient.cpp @@ -127,21 +127,27 @@ size_t NimBLEClient::deleteService(const NimBLEUUID &uuid) { } // deleteServices -bool NimBLEClient::connect(bool refreshServices) { - return connect(m_peerAddress, 0, refreshServices); +/** + * @brief Connect to the BLE Server. + * @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n + * have created and clears the vectors after successful connection. + * @return True on success. + */ +bool NimBLEClient::connect(bool deleteAttibutes) { + return connect(m_peerAddress, 0, deleteAttibutes); } /** * @brief Connect to an advertising device. * @param [in] device The device to connect to. - * @param [in] refreshServices If true this will delete any attribute objects this client may already\n + * @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n * have created and clears the vectors after successful connection. * @return True on success. */ -bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool refreshServices) { +bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes) { NimBLEAddress address(device->getAddress()); uint8_t type = device->getAddressType(); - return connect(address, type, refreshServices); + return connect(address, type, deleteAttibutes); } @@ -149,11 +155,11 @@ bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool refreshServices) * @brief Connect to the BLE Server. * @param [in] address The address of the server. * @param [in] type The address type of the server (Random/public/other) - * @param [in] refreshServices If true this will delete any attribute objects this client may already\n + * @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n * have created and clears the vectors after successful connection. * @return True on success. */ -bool NimBLEClient::connect(const NimBLEAddress &address, uint8_t type, bool refreshServices) { +bool NimBLEClient::connect(const NimBLEAddress &address, uint8_t type, bool deleteAttibutes) { NIMBLE_LOGD(LOG_TAG, ">> connect(%s)", address.toString().c_str()); if(!NimBLEDevice::m_synced) { @@ -212,7 +218,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, uint8_t type, bool refr return false; } - if(refreshServices) { + if(deleteAttibutes) { NIMBLE_LOGD(LOG_TAG, "Refreshing Services for: (%s)", address.toString().c_str()); deleteServices(); } diff --git a/src/NimBLEClient.h b/src/NimBLEClient.h index 600ac7c..a41905f 100644 --- a/src/NimBLEClient.h +++ b/src/NimBLEClient.h @@ -38,10 +38,10 @@ class NimBLEAdvertisedDevice; */ class NimBLEClient { public: - bool connect(NimBLEAdvertisedDevice* device, bool refreshServices = true); + bool connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes = true); bool connect(const NimBLEAddress &address, uint8_t type = BLE_ADDR_PUBLIC, - bool refreshServices = true); - bool connect(bool refreshServices = true); + bool deleteAttibutes = true); + bool connect(bool deleteAttibutes = true); int disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM); NimBLEAddress getPeerAddress(); void setPeerAddress(const NimBLEAddress &address);