forked from h2zero/esp-nimble-cpp
Rename refreshServices to deleteAttributes in connect().
Minor semantic change for clarity. Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
This commit is contained in:
@ -127,21 +127,27 @@ size_t NimBLEClient::deleteService(const NimBLEUUID &uuid) {
|
|||||||
} // deleteServices
|
} // 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.
|
* @brief Connect to an advertising device.
|
||||||
* @param [in] device The device to connect to.
|
* @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.
|
* have created and clears the vectors after successful connection.
|
||||||
* @return True on success.
|
* @return True on success.
|
||||||
*/
|
*/
|
||||||
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool refreshServices) {
|
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes) {
|
||||||
NimBLEAddress address(device->getAddress());
|
NimBLEAddress address(device->getAddress());
|
||||||
uint8_t type = device->getAddressType();
|
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.
|
* @brief Connect to the BLE Server.
|
||||||
* @param [in] address The address of the server.
|
* @param [in] address The address of the server.
|
||||||
* @param [in] type The address type of the server (Random/public/other)
|
* @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.
|
* have created and clears the vectors after successful connection.
|
||||||
* @return True on success.
|
* @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());
|
NIMBLE_LOGD(LOG_TAG, ">> connect(%s)", address.toString().c_str());
|
||||||
|
|
||||||
if(!NimBLEDevice::m_synced) {
|
if(!NimBLEDevice::m_synced) {
|
||||||
@ -212,7 +218,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, uint8_t type, bool refr
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(refreshServices) {
|
if(deleteAttibutes) {
|
||||||
NIMBLE_LOGD(LOG_TAG, "Refreshing Services for: (%s)", address.toString().c_str());
|
NIMBLE_LOGD(LOG_TAG, "Refreshing Services for: (%s)", address.toString().c_str());
|
||||||
deleteServices();
|
deleteServices();
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,10 @@ class NimBLEAdvertisedDevice;
|
|||||||
*/
|
*/
|
||||||
class NimBLEClient {
|
class NimBLEClient {
|
||||||
public:
|
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 connect(const NimBLEAddress &address, uint8_t type = BLE_ADDR_PUBLIC,
|
||||||
bool refreshServices = true);
|
bool deleteAttibutes = true);
|
||||||
bool connect(bool refreshServices = true);
|
bool connect(bool deleteAttibutes = true);
|
||||||
int disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
|
int disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
|
||||||
NimBLEAddress getPeerAddress();
|
NimBLEAddress getPeerAddress();
|
||||||
void setPeerAddress(const NimBLEAddress &address);
|
void setPeerAddress(const NimBLEAddress &address);
|
||||||
|
Reference in New Issue
Block a user