/* Called when the host timer expires. Handles unresponsive timeouts and periodic retries in case of resource shortage.  */
static void ble_hs_timer_exp(struct ble_npl_event *ev)
/* Called when the host timer expires. Handles unresponsive timeouts and periodic retries in case of resource shortage.  */
static void ble_hs_timer_exp(struct ble_npl_event *ev)
{
    int32_t ticks_until_next;
    switch (ble_hs_sync_state) {
    case BLE_HS_SYNC_STATE_GOOD:
        ticks_until_next = ble_gattc_timer();
        ble_hs_timer_sched(ticks_until_next);
        ticks_until_next = ble_gap_timer();
        ble_hs_timer_sched(ticks_until_next);
        ticks_until_next = ble_l2cap_sig_timer();
        ble_hs_timer_sched(ticks_until_next);
        ticks_until_next = ble_sm_timer();
        ble_hs_timer_sched(ticks_until_next);
        ticks_until_next = ble_hs_conn_timer();
        ble_hs_timer_sched(ticks_until_next);
        break;
    case BLE_HS_SYNC_STATE_BAD:
        ble_hs_reset();
        break;
    case BLE_HS_SYNC_STATE_BRINGUP:
    default:
        assert(0);
        break;
    }
}