mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-22 13:10:55 +01:00
Connect address type default to public.
* Cleanup logs. Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
This commit is contained in:
parent
8fbab09f53
commit
b901eeb1e5
2 changed files with 7 additions and 8 deletions
|
@ -146,8 +146,7 @@ bool NimBLEClient::connect(bool deleteAttibutes) {
|
||||||
*/
|
*/
|
||||||
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes) {
|
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes) {
|
||||||
NimBLEAddress address(device->getAddress());
|
NimBLEAddress address(device->getAddress());
|
||||||
uint8_t type = device->getAddressType();
|
return connect(address, 0, deleteAttibutes);
|
||||||
return connect(address, type, deleteAttibutes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -181,7 +180,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, uint8_t type, bool dele
|
||||||
|
|
||||||
ble_addr_t peerAddrt;
|
ble_addr_t peerAddrt;
|
||||||
memcpy(&peerAddrt.val, address.getNative(),6);
|
memcpy(&peerAddrt.val, address.getNative(),6);
|
||||||
peerAddrt.type = type;
|
peerAddrt.type = address.getType();
|
||||||
|
|
||||||
ble_task_data_t taskData = {this, xTaskGetCurrentTaskHandle(), 0, nullptr};
|
ble_task_data_t taskData = {this, xTaskGetCurrentTaskHandle(), 0, nullptr};
|
||||||
m_pTaskData = &taskData;
|
m_pTaskData = &taskData;
|
||||||
|
@ -199,10 +198,9 @@ bool NimBLEClient::connect(const NimBLEAddress &address, uint8_t type, bool dele
|
||||||
}while(rc == BLE_HS_EBUSY);
|
}while(rc == BLE_HS_EBUSY);
|
||||||
|
|
||||||
if (rc != 0 && rc != BLE_HS_EDONE) {
|
if (rc != 0 && rc != BLE_HS_EDONE) {
|
||||||
NIMBLE_LOGE(LOG_TAG, "Error: Failed to connect to device; addr_type=%d "
|
NIMBLE_LOGE(LOG_TAG, "Error: Failed to connect to device; "
|
||||||
"addr=%s, rc=%d; %s",
|
"addr=%s, rc=%d; %s",
|
||||||
type,
|
std::string(m_peerAddress).c_str(),
|
||||||
m_peerAddress.toString().c_str(),
|
|
||||||
rc, NimBLEUtils::returnCodeToString(rc));
|
rc, NimBLEUtils::returnCodeToString(rc));
|
||||||
m_pTaskData = nullptr;
|
m_pTaskData = nullptr;
|
||||||
m_waitingToConnect = false;
|
m_waitingToConnect = false;
|
||||||
|
@ -219,7 +217,6 @@ bool NimBLEClient::connect(const NimBLEAddress &address, uint8_t type, bool dele
|
||||||
}
|
}
|
||||||
|
|
||||||
if(deleteAttibutes) {
|
if(deleteAttibutes) {
|
||||||
NIMBLE_LOGD(LOG_TAG, "Refreshing Services for: (%s)", address.toString().c_str());
|
|
||||||
deleteServices();
|
deleteServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +370,7 @@ void NimBLEClient::setPeerAddress(const NimBLEAddress &address) {
|
||||||
}
|
}
|
||||||
|
|
||||||
m_peerAddress = address;
|
m_peerAddress = address;
|
||||||
NIMBLE_LOGE(LOG_TAG, "Peer address set: %s", std::string(m_peerAddress).c_str());
|
NIMBLE_LOGD(LOG_TAG, "Peer address set: %s", std::string(m_peerAddress).c_str());
|
||||||
} // setPeerAddress
|
} // setPeerAddress
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,8 @@ void NimBLEDevice::stopAdvertising() {
|
||||||
/**
|
/**
|
||||||
* @brief Creates a new client object and maintains a list of all client objects
|
* @brief Creates a new client object and maintains a list of all client objects
|
||||||
* each client can connect to 1 peripheral device.
|
* each client can connect to 1 peripheral device.
|
||||||
|
* @param [in] peerAddress An optional peer address that is copied to the new client
|
||||||
|
* object, allows for calling connect() without providing a device or address.
|
||||||
* @return A reference to the new client object.
|
* @return A reference to the new client object.
|
||||||
*/
|
*/
|
||||||
#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||||
|
|
Loading…
Reference in a new issue