Hello,
I am using nrf5 sdk 12, and I have read the documentation in ble_gap.h for NRF_ERROR_INVALID_STATE and I have seen a few questions on this forum, and what I understand is NRF_ERROR_INVALID_STATE is an error which needs to be handled according which API resulted in this error.
But I have seen this code in the SDK:
err_code = ble_nus_string_send(&m_nus, data_array, index);
if (err_code != NRF_ERROR_INVALID_STATE)
{
APP_ERROR_CHECK(err_code);
}
and this:
case BSP_EVENT_DISCONNECT:
err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
if (err_code != NRF_ERROR_INVALID_STATE)
{
APP_ERROR_CHECK(err_code);
}
break;
in main.c
My question is, why aren't we checking if the function is SUCCESS over here, why are we checking if it returns NRF_ERROR_INVALID_STATE? It seems we wish to ignore this error, why is this so?