i am working on ble_app_beacon example and i am facing issues in evt_handler. basically i want to use on_adv_evt() function to put my device in sleep mode after timeout hence i copied the function and used in app_beacon example but in the evt handler function is not executing anymore.i want to know if we are initializing ble_advertisement_t parameters in advertisement_init() function then where exactly these parameters are updated in ble_stack, what function is used to register ble_advertisement_t structure into stack. Because of these parameters were not registered the evt_handler is not called.
In ble_app_uart() they were calling ble_advertisement_init() function and it takes care of all configurations, but if use the same function by creating the BLE_ADVERTISE_DEF i am getting error in sdk_config.h as expected ')' before '1' (#define BLE_ADV_BLE_OBSERVER_PRIO 1).
static void advertising_init(void)
{
uint32_t err_code;
ble_advertising_init_t init;
memset(&init, 0, sizeof(init));
ble_advdata_t advdata;
uint8_t flags = /*BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;*/ BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
ble_advdata_manuf_data_t manuf_specific_data;
manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;
init.config.ble_adv_fast_enabled = true;
init.config.ble_adv_fast_interval = 64;
init.config.ble_adv_fast_timeout = APP_ADV_DURATION;
init.evt_handler = on_adv_evt;
manuf_specific_data.data.p_data = (uint8_t *) m_beacon_info;
manuf_specific_data.data.size = APP_BEACON_INFO_LENGTH;
// Build and set advertising data.
memset(&advdata, 0, sizeof(advdata));
//ble_gap_adv_params_t adv_params;
advdata.name_type = BLE_ADVDATA_NO_NAME;
advdata.flags = flags;
advdata.p_manuf_specific_data = &manuf_specific_data;
// Initialize advertising parameters (used when starting advertising).
memset(&m_adv_params, 0, sizeof(m_adv_params));
m_adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
m_adv_params.p_peer_addr = NULL; // Undirected advertisement.
m_adv_params.filter_policy = BLE_GAP_ADV_FP_ANY;
m_adv_params.interval = NON_CONNECTABLE_ADV_INTERVAL;
m_adv_params.duration = APP_ADV_DURATION; // Never time out.
err_code = ble_advdata_encode(&advdata, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
APP_ERROR_CHECK(err_code);
err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &m_adv_params);
APP_ERROR_CHECK(err_code);
The above code was from ble_app_beacon. i want to understand whether on_adv_evt will be called or not according to the above code?