We are working in an IOT device with a ESP32_WROOM using the idf4.3.2 SDK. The ESP32 works as ble peripheral with nimble.
ESP32 needs, as peripheral to be able to expel/terminate/close a bluetooth connection.
I tried with
Code: Select all
/**
* Terminates an established connection.
*
* @param conn_handle The handle corresponding to the connection to
* terminate.
* @param hci_reason The HCI error code to indicate as the reason
* for termination.
*
* @return 0 on success;
* BLE_HS_ENOTCONN if there is no connection with
* the specified handle;
* Other nonzero on failure.
*/
int ble_gap_terminate(uint16_t conn_handle, uint8_t hci_reason);
Which is the best way to force disconnect of a ble connection as peripheral?