Hi,
Which functions should I modify?and what should I pay attention to? Look forward to your reply, thank you in advance.
/**@brief Function handling events from @ref es_adv_timing.c.
*
* @param[in] p_evt Advertisement timing event.
*/
static void adv_timing_callback(const es_adv_timing_evt_t * p_evt)
{
ret_code_t err_code;
ble_gap_adv_params_t non_connectable_adv_params;
const es_slot_reg_t * p_reg = es_slot_get_registry();
// As new advertisement data will be loaded, stop advertising.
err_code = sd_ble_gap_adv_stop(*mp_adv_handle);
if (err_code != NRF_ERROR_INVALID_STATE && err_code != BLE_ERROR_INVALID_ADV_HANDLE)
{
APP_ERROR_CHECK(err_code);
}
// If a non-eTLM frame is to be advertised.
if (p_evt->evt_id == ES_ADV_TIMING_EVT_ADV_SLOT)
{
err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, 0, p_reg->slots[p_evt->slot_no].radio_tx_pwr);
if (err_code != BLE_ERROR_INVALID_ADV_HANDLE)
{
APP_ERROR_CHECK(err_code);
}
es_adv_frame_fill_non_connectable_adv_data(p_evt->slot_no, false, &m_adv_data);
}
// If an eTLM frame is to be advertised
else if (p_evt->evt_id == ES_ADV_TIMING_EVT_ADV_ETLM)
{
err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, 0, p_reg->slots[p_reg->tlm_slot].radio_tx_pwr);
APP_ERROR_CHECK(err_code);
es_adv_frame_fill_non_connectable_adv_data(p_evt->slot_no, true, &m_adv_data);
}
// invoke_callback(ES_ADV_EVT_NON_CONN_ADV);
invoke_callback(ES_ADV_EVT_CONNECTABLE_ADV_STARTED); //add for connectable mode
get_adv_params(&non_connectable_adv_params, false, m_remain_connectable); //modify for connectable mode,from true to false
adv_start(&non_connectable_adv_params);
}
Sincerely,
Susan