コード例 #1
0
static
void
phFriNfc_LlcpMac_Nfcip_TriggerSendCb(
    _Inout_ phFriNfc_LlcpMac_t  *LlcpMac,
    _In_    NFCSTATUS           status
    )
{
   phFriNfc_LlcpMac_Send_CB_t pfSendCB;
   void                       *pSendContext;

   PH_LOG_LLCP_FUNC_ENTRY();
   if (LlcpMac->MacSend_Cb != NULL)
   {
      /* 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;

      /* Call Send callback */
      pfSendCB(pSendContext, status);
   }

   PH_LOG_LLCP_FUNC_EXIT();
}
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 void phFriNfc_LlcpMac_Nfcip_TriggerSendCb(phFriNfc_LlcpMac_t  *LlcpMac,
                                                 NFCSTATUS           status)
{
   phFriNfc_LlcpMac_Send_CB_t pfSendCB;
   void                       *pSendContext;

   if (LlcpMac->MacSend_Cb != NULL)
   {
      /* 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;

      /* Call Send callback */
      pfSendCB(pSendContext, status);
   }
}