/*******************************************************************************
**
** Function         nfa_ee_evt_hdlr
**
** Description      Processing event for NFA EE
**
**
** Returns          TRUE if p_msg needs to be deallocated
**
*******************************************************************************/
BOOLEAN nfa_ee_evt_hdlr (BT_HDR *p_msg)
{
    tNFA_EE_MSG *p_evt_data = (tNFA_EE_MSG *) p_msg;
    UINT16  event = p_msg->event & 0x00ff;
    BOOLEAN act = FALSE;

#if (BT_TRACE_VERBOSE == TRUE)
    NFA_TRACE_DEBUG4 ("nfa_ee_evt_hdlr (): Event %s(0x%02x), State: %s(%d)",
        nfa_ee_sm_evt_2_str (p_evt_data->hdr.event), p_evt_data->hdr.event,
        nfa_ee_sm_st_2_str (nfa_ee_cb.em_state), nfa_ee_cb.em_state);
#else
    NFA_TRACE_DEBUG2 ("nfa_ee_evt_hdlr (): Event 0x%02x, State: %d", p_evt_data->hdr.event, nfa_ee_cb.em_state);
#endif

#if(NFC_NXP_NOT_OPEN_INCLUDED == TRUE)
    /*This is required to receive Reader Over SWP event*/
    if(p_evt_data->hdr.event == NFA_EE_NCI_DISC_NTF_EVT)
    {
        NFA_TRACE_DEBUG0("recived dis_ntf; stopping timer");
        nfa_sys_stop_timer(&nfa_ee_cb.discv_timer);
    }
#endif

    switch (nfa_ee_cb.em_state)
    {
    case NFA_EE_EM_STATE_INIT_DONE:
    case NFA_EE_EM_STATE_RESTORING:
        act = TRUE;
        break;
    case NFA_EE_EM_STATE_INIT:
        if ((p_msg->event == NFA_EE_NCI_DISC_NTF_EVT) || (p_msg->event == NFA_EE_NCI_DISC_RSP_EVT))
            act = TRUE;
        break;
    case NFA_EE_EM_STATE_DISABLING:
        if (p_msg->event == NFA_EE_NCI_CONN_EVT)
            act = TRUE;
        break;
    }
    if (act)
    {
        if (event < NFA_EE_NUM_ACTIONS)
        {
            (*nfa_ee_actions[event]) (p_evt_data);
        }
    }
    else
    {
        /* if the data event is not handled by action function, free the data packet */
        if (p_msg->event == NFA_EE_NCI_DATA_EVT)
            GKI_freebuf (p_evt_data->conn.p_data);
    }

    return TRUE;
}
Example #2
0
/*******************************************************************************
**
** Function         nfa_ee_evt_hdlr
**
** Description      Processing event for NFA EE
**
**
** Returns          TRUE if p_msg needs to be deallocated
**
*******************************************************************************/
BOOLEAN nfa_ee_evt_hdlr (BT_HDR *p_msg)
{
    tNFA_EE_MSG *p_evt_data = (tNFA_EE_MSG *) p_msg;
    UINT16  event = p_msg->event & 0x00ff;
    BOOLEAN act = FALSE;

#if (BT_TRACE_VERBOSE == TRUE)
    NFA_TRACE_DEBUG4 ("nfa_ee_evt_hdlr (): Event %s(0x%02x), State: %s(%d)",
        nfa_ee_sm_evt_2_str (p_evt_data->hdr.event), p_evt_data->hdr.event,
        nfa_ee_sm_st_2_str (nfa_ee_cb.em_state), nfa_ee_cb.em_state);
#else
    NFA_TRACE_DEBUG2 ("nfa_ee_evt_hdlr (): Event 0x%02x, State: %d", p_evt_data->hdr.event, nfa_ee_cb.em_state);
#endif

    switch (nfa_ee_cb.em_state)
    {
    case NFA_EE_EM_STATE_INIT_DONE:
    case NFA_EE_EM_STATE_RESTORING:
        act = TRUE;
        break;
    case NFA_EE_EM_STATE_INIT:
        if ((p_msg->event == NFA_EE_NCI_DISC_NTF_EVT) || (p_msg->event == NFA_EE_NCI_DISC_RSP_EVT))
            act = TRUE;
        break;
    case NFA_EE_EM_STATE_DISABLING:
        if (p_msg->event == NFA_EE_NCI_CONN_EVT)
            act = TRUE;
        break;
    }
    if (act)
    {
        if (event < NFA_EE_NUM_ACTIONS)
        {
            (*nfa_ee_actions[event]) (p_evt_data);
        }
    }
    else
    {
        /* if the data event is not handled by action function, free the data packet */
        if (p_msg->event == NFA_EE_NCI_DATA_EVT)
            GKI_freebuf (p_evt_data->conn.p_data);
    }

    return TRUE;
}