Exemple #1
0
/**@brief Timeout handler for the advertisement interval timer. */
static void adv_interval_timeout(void * p_context)
{
    if (es_slot_get_registry()->num_configured_slots > 0)
    {
        // Trigger slot timeout for advertising the first slot.
        // Note: The slot number is not the index in the slot registry, it is the index of the active slots.
        adv_slot_timeout(NULL);
    }

    if(m_non_conn_adv_active)
    {
        uint32_t err_code = app_timer_start(m_es_adv_interval_timer,
                                   APP_TIMER_TICKS(m_current_adv_interval, APP_TIMER_PRESCALER),
                                   NULL);
        APP_ERROR_CHECK(err_code);
    }
}
/**@brief Function for starting to advertise all slots with timer interval control */
static void slots_advertising_start(void)
{
    adv_interval_timer_start(); //this must start first, since it calculates parameters that the adv_slot_timer depends on
    adv_slot_timeout(NULL);     //Spoof a timeout right away so the actual advertising can begin immediately
}