Hello,
in our final device, I want to give the user the opportunity, to close an opened BLE connection between our device and another smart device. This should be done by pushing a button. At the moment, if the button is pressed, I call the "closeBLEconnection" function.
uint32_t stopAdvertising(void){
uint32_t err_code;
err_code = sd_ble_gap_adv_stop();
if(err_code != NRF_SUCCESS)
{
ble_dbg_printf("stop dvertising error code: %x\r", err_code);
}
return err_code;}
uint32_t closeBLEconnection(void){
uint32_t err_code;
err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION);
if(err_code != NRF_SUCCESS)
{
ble_dbg_printf("Connection close error code: %d\r", err_code);
}
err_code = stopAdvertising();
return err_code;}
But if I use the functions like this, I will get NRF_ERRORS from both functions. Connection close returns with error code "7" and stop advertising function returns error code 8. How can I change the disconnection sequenze to get a proper result? It seems, that "BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION" is not a valid parameter for sd_ble_gap_disconnect!?
Regards, BTprogrammer
PS: I use the S120 softdevice as an peripheral.