Nimble: Added return value (success / failure ) to nimble_port_init

This commit is contained in:
Rahul Tank
2023-01-31 12:01:02 +05:30
parent 1195b6cb2b
commit 826495a145
23 changed files with 144 additions and 49 deletions
@@ -35,8 +35,21 @@
extern "C" {
#endif
void nimble_port_init(void);
void nimble_port_deinit(void);
/**
* @brief nimble_port_init - Initialize controller and NimBLE host stack
*
* @return esp_err_t - ESP_OK ( if success)
* Error code in case of failure
*/
esp_err_t nimble_port_init(void);
/**
* @brief nimble_port_deinit - Deinitialize controller and NimBLE host stack
*
* @return esp_err_t - ESP_OK ( if success)
* Error code in case of failure
*/
esp_err_t nimble_port_deinit(void);
void nimble_port_run(void);
int nimble_port_stop(void);
@@ -494,7 +494,11 @@ static int simple_ble_start(const simple_ble_cfg_t *cfg)
int rc;
ESP_LOGD(TAG, "Free memory at start of simple_ble_init %" PRIu32, esp_get_free_heap_size());
nimble_port_init();
rc = nimble_port_init();
if (rc != ESP_OK) {
ESP_LOGE(TAG, "Failed to init nimble %d ", rc);
return rc;
}
/* Initialize the NimBLE host configuration. */
ble_hs_cfg.reset_cb = simple_ble_on_reset;