This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Infinite Fast Advertising

Hi!

I want to get infinite advertising.

My advertising gets timed out in 180 sec.

I have set to Fast Advertising Mode.

Below is my code

static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { ble_conn_params_on_ble_evt(p_ble_evt); ble_nus_on_ble_evt(&m_nus, p_ble_evt); on_ble_evt(p_ble_evt); ble_advertising_on_ble_evt(p_ble_evt); bsp_btn_ble_on_ble_evt(p_ble_evt);

}

static void advertising_init(void) { uint32_t err_code; ble_advdata_t advdata; ble_advdata_t scanrsp;

// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type          = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance = false;
advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;

memset(&scanrsp, 0, sizeof(scanrsp));
scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
scanrsp.uuids_complete.p_uuids  = m_adv_uuids;

ble_adv_modes_config_t options = {0};
options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;
	

/* options.ble_adv_slow_enabled = BLE_ADV_SLOW_ENABLED; options.ble_adv_slow_interval = APP_ADV_INTERVAL; options.ble_adv_slow_timeout = APP_ADV_TIMEOUT_IN_SECONDS; */

err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
APP_ERROR_CHECK(err_code);

}

Related