Beispiel #1
0
/**
 * Called once a second by the ble_hs heartbeat timer.  Handles unresponsive
 * timeouts and periodic retries in case of resource shortage.
 */
static void
ble_hs_heartbeat(void *unused)
{
    ble_gattc_heartbeat();
    ble_gap_heartbeat();
    ble_l2cap_sig_heartbeat();
    ble_l2cap_sm_heartbeat();

    ble_hs_heartbeat_timer_reset();
}
/**
 * Called once a second by the ble_hs heartbeat timer.  Handles unresponsive
 * timeouts and periodic retries in case of resource shortage.
 */
static void
ble_hs_heartbeat(void *unused)
{
    uint32_t lcl_ticks_until_next;
    uint32_t ticks_until_next;

    ticks_until_next = BLE_HS_HEARTBEAT_OS_TICKS;

    lcl_ticks_until_next = ble_gattc_heartbeat();
    ticks_until_next = min(ticks_until_next, lcl_ticks_until_next);

    lcl_ticks_until_next = ble_gap_heartbeat();
    ticks_until_next = min(ticks_until_next, lcl_ticks_until_next);

    lcl_ticks_until_next = ble_l2cap_sig_heartbeat();
    ticks_until_next = min(ticks_until_next, lcl_ticks_until_next);

    lcl_ticks_until_next = ble_sm_heartbeat();
    ticks_until_next = min(ticks_until_next, lcl_ticks_until_next);

    ble_hs_heartbeat_timer_reset(ticks_until_next);
}