diff options
-rw-r--r-- | src/phFriNfc_Llcp.c | 21 | ||||
-rw-r--r-- | src/phFriNfc_LlcpTransport_Connection.c | 5 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/phFriNfc_Llcp.c b/src/phFriNfc_Llcp.c index cfbda3a..ab9b768 100644 --- a/src/phFriNfc_Llcp.c +++ b/src/phFriNfc_Llcp.c @@ -143,6 +143,8 @@ static void phFriNfc_Llcp_Deallocate(phNfc_sData_t * pData) static NFCSTATUS phFriNfc_Llcp_InternalDeactivate( phFriNfc_Llcp_t *Llcp ) { + phFriNfc_Llcp_Send_CB_t pfSendCB; + void * pSendContext; if ((Llcp->state == PHFRINFC_LLCP_STATE_OPERATION_RECV) || (Llcp->state == PHFRINFC_LLCP_STATE_OPERATION_SEND) || (Llcp->state == PHFRINFC_LLCP_STATE_PAX) || @@ -154,6 +156,25 @@ static NFCSTATUS phFriNfc_Llcp_InternalDeactivate( phFriNfc_Llcp_t *Llcp ) /* Stop timer */ phOsalNfc_Timer_Stop(Llcp->hSymmTimer); + /* Return delayed send operation in error, in any */ + if (Llcp->psSendInfo != NULL) + { + phFriNfc_Llcp_Deallocate(Llcp->psSendInfo); + Llcp->psSendHeader = NULL; + Llcp->psSendSequence = NULL; + } + if (Llcp->pfSendCB != NULL) + { + /* Get Callback params */ + pfSendCB = Llcp->pfSendCB; + pSendContext = Llcp->pSendContext; + /* Reset callback params */ + Llcp->pfSendCB = NULL; + Llcp->pSendContext = NULL; + /* Call the callback */ + (pfSendCB)(pSendContext, NFCSTATUS_FAILED); + } + /* Notify service layer */ Llcp->pfLink_CB(Llcp->pLinkContext, phFriNfc_LlcpMac_eLinkDeactivated); diff --git a/src/phFriNfc_LlcpTransport_Connection.c b/src/phFriNfc_LlcpTransport_Connection.c index 2056f45..fbe2dec 100644 --- a/src/phFriNfc_LlcpTransport_Connection.c +++ b/src/phFriNfc_LlcpTransport_Connection.c @@ -325,6 +325,11 @@ static void phFriNfc_LlcpTransport_ConnectionOriented_SendLlcp_CB(void* p else { /* Send CB error */ + if(psTransport->pSocketTable[psTransport->socketIndex].sLlcpHeader.ptype == PHFRINFC_LLCP_PTYPE_I && psTransport->pSocketTable[psTransport->socketIndex].pfSocketSend_Cb != NULL) + { + psTransport->pSocketTable[psTransport->socketIndex].pfSocketSend_Cb(psTransport->pSocketTable[psTransport->socketIndex].pSendContext,status); + psTransport->pSocketTable[psTransport->socketIndex].pfSocketSend_Cb = NULL; + } } } |