Ejemplo n.º 1
0
/*******************************************************************************
**
** Function         nfa_ee_sys_disable
**
** Description      Deregister NFA EE from NFA SYS/DM
**
**
** Returns          None
**
*******************************************************************************/
void nfa_ee_sys_disable (void)
{
    UINT32  xx;
    tNFA_EE_ECB *p_cb;
    tNFA_EE_MSG     msg;

    NFA_TRACE_DEBUG0 ("nfa_ee_sys_disable ()");

    nfa_ee_cb.em_state = NFA_EE_EM_STATE_DISABLED;
    /* report NFA_EE_DEREGISTER_EVT to all registered to EE */
    for (xx = 0; xx < NFA_EE_MAX_CBACKS; xx++)
    {
        if (nfa_ee_cb.p_ee_cback[xx])
        {
            msg.deregister.index     = xx;
            nfa_ee_api_deregister (&msg);
        }
    }

    nfa_ee_cb.num_ee_expecting  = 0;
    p_cb = nfa_ee_cb.ecb;
    for (xx = 0; xx < nfa_ee_cb.cur_ee; xx++, p_cb++)
    {
        if (p_cb->conn_st == NFA_EE_CONN_ST_CONN)
        {
            if (nfa_sys_is_graceful_disable ())
            {
                /* Disconnect NCI connection on graceful shutdown */
                msg.disconnect.p_cb = p_cb;
                nfa_ee_api_disconnect (&msg);
                nfa_ee_cb.num_ee_expecting++;
            }
            else
            {
                /* fake NFA_EE_DISCONNECT_EVT on ungraceful shutdown */
                msg.conn.conn_id    = p_cb->conn_id;
                msg.conn.event      = NFC_CONN_CLOSE_CEVT;
                nfa_ee_nci_conn (&msg);
            }
        }
    }

    if (nfa_ee_cb.num_ee_expecting)
    {
        nfa_ee_cb.ee_flags |= NFA_EE_FLAG_WAIT_DISCONN;
        nfa_ee_cb.em_state  = NFA_EE_EM_STATE_DISABLING;
    }


    nfa_sys_stop_timer (&nfa_ee_cb.timer);
    nfa_sys_stop_timer (&nfa_ee_cb.discv_timer);

    /* If Application initiated NFCEE discovery, fake/report the event */
    nfa_ee_report_disc_done (FALSE);

    /* deregister message handler on NFA SYS */
    if (nfa_ee_cb.em_state == NFA_EE_EM_STATE_DISABLED)
        nfa_sys_deregister (NFA_ID_EE);

}
Ejemplo n.º 2
0
/*******************************************************************************
**
** Function         nfa_dm_sys_disable
**
** Description      This function is called after all subsystems have been disabled.
**
** Returns          void
**
*******************************************************************************/
void nfa_dm_sys_disable (void)
{
    /* Disable the DM sub-system */
    /* If discovery state is not IDLE or DEACTIVATED and graceful disable, */
    /* then we need to deactivate link or stop discovery                   */

    if (nfa_sys_is_graceful_disable ())
    {
        if (  (nfa_dm_cb.disc_cb.disc_state == NFA_DM_RFST_IDLE)
            &&((nfa_dm_cb.disc_cb.disc_flags & NFA_DM_DISC_FLAGS_DISABLING) == 0)  )
        {
            /* discovery is not started */
            nfa_dm_disable_complete ();
        }
        else
        {
            /* probably waiting to be disabled */
            NFA_TRACE_WARNING2 ("DM disc_state state = %d disc_flags:0x%x", nfa_dm_cb.disc_cb.disc_state, nfa_dm_cb.disc_cb.disc_flags);
        }

    }
    else
    {
        nfa_dm_disable_complete ();
    }
}