static void phFriNfc_LlcpMac_Nfcip_Receive_Cb(void *pContext, NFCSTATUS Status) { phFriNfc_LlcpMac_t *LlcpMac = (phFriNfc_LlcpMac_t *)pContext; #ifdef LLCP_CHANGES phFriNfc_LlcpMac_Send_CB_t pfSendCB; void *pSendContext; if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown) { phLibNfc_Pending_Shutdown(); Status = NFCSTATUS_SHUTDOWN; } if (NFCSTATUS_SHUTDOWN == Status) { /* Save context in local variables */ pfSendCB = LlcpMac->MacSend_Cb; pSendContext = LlcpMac->MacSend_Context; /* Reset the pointer to the Send Callback */ LlcpMac->MacSend_Cb = NULL; LlcpMac->MacSend_Context = NULL; /* Reset Send and Receive Flag */ LlcpMac->SendPending = FALSE; LlcpMac->RecvPending = FALSE; } #endif /* #ifdef LLCP_CHANGES */ phFriNfc_LlcpMac_Nfcip_TriggerRecvCb(LlcpMac, Status); #ifdef LLCP_CHANGES if (NFCSTATUS_SHUTDOWN == Status) { if ((LlcpMac->SendPending) && (NULL != pfSendCB)) { pfSendCB(pSendContext, Status); } } else #endif /* #ifdef LLCP_CHANGES */ { /* Test if a send is pending */ if(LlcpMac->SendPending) { Status = phFriNfc_LlcpMac_Nfcip_Send(LlcpMac,LlcpMac->psSendBuffer,LlcpMac->MacSend_Cb,LlcpMac->MacSend_Context); } } }
static NFCSTATUS phFriNfc_LlcpMac_Nfcip_Deactivate( _Inout_ phFriNfc_LlcpMac_t *LlcpMac ) { NFCSTATUS status = NFCSTATUS_SUCCESS; PH_LOG_LLCP_FUNC_ENTRY(); if(NULL == LlcpMac) { status = PHNFCSTVAL(CID_FRI_NFC_LLCP_MAC, NFCSTATUS_INVALID_PARAMETER); } else { /* Set the flag of LinkStatus to deactivate */ LlcpMac->LinkState = phFriNfc_LlcpMac_eLinkDeactivated; if (LlcpMac->SendPending) { /* Reset Flag */ LlcpMac->SendPending = FALSE; phFriNfc_LlcpMac_Nfcip_TriggerSendCb(LlcpMac, NFCSTATUS_FAILED); } if (LlcpMac->RecvPending) { /* Reset Flag */ LlcpMac->RecvPending = FALSE; phFriNfc_LlcpMac_Nfcip_TriggerRecvCb(LlcpMac, NFCSTATUS_FAILED); } LlcpMac->LinkStatus_Cb(LlcpMac->LinkStatus_Context, LlcpMac->LinkState, NULL, LlcpMac->PeerRemoteDevType); } PH_LOG_LLCP_FUNC_EXIT(); return status; }
static void phFriNfc_LlcpMac_Nfcip_Transceive_Cb(void *pContext, NFCSTATUS Status) { phFriNfc_LlcpMac_t *LlcpMac = (phFriNfc_LlcpMac_t *)pContext; #ifdef LLCP_CHANGES if(gpphLibContext->LibNfcState.next_state == eLibNfcHalStateShutdown) { phLibNfc_Pending_Shutdown(); Status = NFCSTATUS_SHUTDOWN; } #endif /* #ifdef LLCP_CHANGES */ /* Reset Send and Receive Flag */ LlcpMac->SendPending = FALSE; LlcpMac->RecvPending = FALSE; /* Call the callbacks */ phFriNfc_LlcpMac_Nfcip_TriggerSendCb(LlcpMac, Status); phFriNfc_LlcpMac_Nfcip_TriggerRecvCb(LlcpMac, Status); }