mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-23 21:50:55 +01:00
Remove asserts from NimBLEDevice.
This commit is contained in:
parent
358170847d
commit
fae53b8d7f
1 changed files with 12 additions and 7 deletions
|
@ -299,7 +299,7 @@ size_t NimBLEDevice::getClientListSize() {
|
||||||
/**
|
/**
|
||||||
* @brief Get a reference to a client by connection ID.
|
* @brief Get a reference to a client by connection ID.
|
||||||
* @param [in] conn_id The client connection ID to search for.
|
* @param [in] conn_id The client connection ID to search for.
|
||||||
* @return A pointer to the client object with the spcified connection ID.
|
* @return A pointer to the client object with the specified connection ID or nullptr.
|
||||||
*/
|
*/
|
||||||
/* STATIC */
|
/* STATIC */
|
||||||
NimBLEClient* NimBLEDevice::getClientByID(uint16_t conn_id) {
|
NimBLEClient* NimBLEDevice::getClientByID(uint16_t conn_id) {
|
||||||
|
@ -308,7 +308,7 @@ NimBLEClient* NimBLEDevice::getClientByID(uint16_t conn_id) {
|
||||||
return (*it);
|
return (*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(0);
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} // getClientByID
|
} // getClientByID
|
||||||
|
|
||||||
|
@ -806,7 +806,10 @@ void NimBLEDevice::onSync(void)
|
||||||
|
|
||||||
/* Make sure we have proper identity address set (public preferred) */
|
/* Make sure we have proper identity address set (public preferred) */
|
||||||
int rc = ble_hs_util_ensure_addr(0);
|
int rc = ble_hs_util_ensure_addr(0);
|
||||||
assert(rc == 0);
|
if (rc != 0) {
|
||||||
|
NIMBLE_LOGE(LOG_TAG, "error ensuring address; rc=%d", rc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef ESP_PLATFORM
|
#ifndef ESP_PLATFORM
|
||||||
rc = ble_hs_id_infer_auto(m_own_addr_type, &m_own_addr_type);
|
rc = ble_hs_id_infer_auto(m_own_addr_type, &m_own_addr_type);
|
||||||
|
@ -918,7 +921,9 @@ void NimBLEDevice::init(const std::string &deviceName) {
|
||||||
|
|
||||||
// Set the device name.
|
// Set the device name.
|
||||||
rc = ble_svc_gap_device_name_set(deviceName.c_str());
|
rc = ble_svc_gap_device_name_set(deviceName.c_str());
|
||||||
assert(rc == 0);
|
if (rc != 0) {
|
||||||
|
NIMBLE_LOGE(LOG_TAG, "ble_svc_gap_device_name_set() failed; rc=%d", rc);
|
||||||
|
}
|
||||||
|
|
||||||
ble_store_config_init();
|
ble_store_config_init();
|
||||||
|
|
||||||
|
@ -1248,10 +1253,10 @@ void NimBLEDevice::setCustomGapHandler(gap_event_handler handler) {
|
||||||
int rc = ble_gap_event_listener_register(&m_listener, m_customGapHandler, NULL);
|
int rc = ble_gap_event_listener_register(&m_listener, m_customGapHandler, NULL);
|
||||||
if(rc == BLE_HS_EALREADY){
|
if(rc == BLE_HS_EALREADY){
|
||||||
NIMBLE_LOGI(LOG_TAG, "Already listening to GAP events.");
|
NIMBLE_LOGI(LOG_TAG, "Already listening to GAP events.");
|
||||||
|
} else if (rc != 0) {
|
||||||
|
NIMBLE_LOGE(LOG_TAG, "ble_gap_event_listener_register: rc=%d %s", rc, NimBLEUtils::returnCodeToString(rc));
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
assert(rc == 0);
|
|
||||||
}
|
|
||||||
} // setCustomGapHandler
|
} // setCustomGapHandler
|
||||||
|
|
||||||
#endif // CONFIG_BT_ENABLED
|
#endif // CONFIG_BT_ENABLED
|
||||||
|
|
Loading…
Reference in a new issue