Hi,
I use the SDK 12.3 ,example :nRF5_SDK_12.3.0_d7731ad\nRF5_SDK_12.3.0_d7731ad\examples\ble_peripheral\ble_app_uart
I want keep advertising,I use the code as follow:
static void non_connectable_advertising_init(void)
{
uint32_t err_code;
ble_gap_adv_params_t adv_params;
memset(&adv_params, 0, sizeof(ble_gap_adv_params_t));
adv_params.type = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND ;
adv_params.p_peer_addr = NULL;
adv_params.fp = BLE_GAP_ADV_FP_ANY;
adv_params.interval = MSEC_TO_UNITS(500,UNIT_0_625_MS);
adv_params.timeout = 1800;
err_code = sd_ble_gap_adv_start(&adv_params);
if(err_code!=NRF_SUCCESS)
printf("non_connectable_advertising result:%d",err_code);
// APP_ERROR_CHECK(err_code);
}
i add this in ble event:BLE_GAP_EVT_CONNECTED。
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
uint32_t err_code;
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
{
err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
APP_ERROR_CHECK(err_code);
m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
non_connectable_advertising_init();
}break; // BLE_GAP_EVT_CONNECTED
but i get err_code:NRF_ERROR_INVALID_PARAM .
So what shoule I do to keep advertising when connected?