Connect address type default to public.

* Cleanup logs.

Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
This commit is contained in:
h2zero 2020-07-30 10:07:52 -06:00 committed by h2zero
parent 8fbab09f53
commit b901eeb1e5
2 changed files with 7 additions and 8 deletions

View file

@ -146,8 +146,7 @@ bool NimBLEClient::connect(bool deleteAttibutes) {
*/
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes) {
NimBLEAddress address(device->getAddress());
uint8_t type = device->getAddressType();
return connect(address, type, deleteAttibutes);
return connect(address, 0, deleteAttibutes);
}
@ -181,7 +180,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, uint8_t type, bool dele
ble_addr_t peerAddrt;
memcpy(&peerAddrt.val, address.getNative(),6);
peerAddrt.type = type;
peerAddrt.type = address.getType();
ble_task_data_t taskData = {this, xTaskGetCurrentTaskHandle(), 0, nullptr};
m_pTaskData = &taskData;
@ -199,10 +198,9 @@ bool NimBLEClient::connect(const NimBLEAddress &address, uint8_t type, bool dele
}while(rc == BLE_HS_EBUSY);
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",
type,
m_peerAddress.toString().c_str(),
std::string(m_peerAddress).c_str(),
rc, NimBLEUtils::returnCodeToString(rc));
m_pTaskData = nullptr;
m_waitingToConnect = false;
@ -219,7 +217,6 @@ bool NimBLEClient::connect(const NimBLEAddress &address, uint8_t type, bool dele
}
if(deleteAttibutes) {
NIMBLE_LOGD(LOG_TAG, "Refreshing Services for: (%s)", address.toString().c_str());
deleteServices();
}
@ -373,7 +370,7 @@ void NimBLEClient::setPeerAddress(const NimBLEAddress &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

View file

@ -137,6 +137,8 @@ void NimBLEDevice::stopAdvertising() {
/**
* @brief Creates a new client object and maintains a list of all client objects
* 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.
*/
#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)