diff options
author | Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> | 2010-12-09 17:57:08 +0100 |
---|---|---|
committer | Jeff Hamilton <jham@android.com> | 2010-12-13 10:24:31 -0600 |
commit | 35a9f321a9cb5db0e65b9579d11bee2ac9bb1c54 (patch) | |
tree | 9589b042da813c863ffb5b68746a9762e97b953d /src | |
parent | 28ab3385d05d10437c6b1f0168bab6ed71bf4bfd (diff) | |
download | external_libnfc-nxp-35a9f321a9cb5db0e65b9579d11bee2ac9bb1c54.zip external_libnfc-nxp-35a9f321a9cb5db0e65b9579d11bee2ac9bb1c54.tar.gz external_libnfc-nxp-35a9f321a9cb5db0e65b9579d11bee2ac9bb1c54.tar.bz2 |
Fix missing send callback in error upon deactivation.
Change-Id: I2a857c4e02fcf8c0f655a6fa960466f5ac4f191e
Diffstat (limited to 'src')
-rw-r--r-- | src/phFriNfc_Llcp.c | 6 | ||||
-rw-r--r-- | src/phFriNfc_LlcpMacNfcip.c | 38 |
2 files changed, 41 insertions, 3 deletions
diff --git a/src/phFriNfc_Llcp.c b/src/phFriNfc_Llcp.c index 86ab6ed..cfbda3a 100644 --- a/src/phFriNfc_Llcp.c +++ b/src/phFriNfc_Llcp.c @@ -933,9 +933,6 @@ static void phFriNfc_Llcp_Receive_CB( void *pContext, NFCSTATUS result = NFCSTATUS_SUCCESS; phFriNfc_Llcp_sPacketHeader_t sPacketHeader; - /* Parse header */ - phFriNfc_Llcp_Buffer2Header(psData->buffer, 0, &sPacketHeader); - /* Check reception status and for pending disconnection */ if ((status != NFCSTATUS_SUCCESS) || (Llcp->bDiscPendingFlag == TRUE)) { @@ -947,6 +944,9 @@ static void phFriNfc_Llcp_Receive_CB( void *pContext, return; } + /* Parse header */ + phFriNfc_Llcp_Buffer2Header(psData->buffer, 0, &sPacketHeader); + if (sPacketHeader.ptype != PHFRINFC_LLCP_PTYPE_SYMM) { LLCP_PRINT_BUFFER("\nReceived LLCP packet :", psData->buffer, psData->length); diff --git a/src/phFriNfc_LlcpMacNfcip.c b/src/phFriNfc_LlcpMacNfcip.c index f4e069d..a0fad6c 100644 --- a/src/phFriNfc_LlcpMacNfcip.c +++ b/src/phFriNfc_LlcpMacNfcip.c @@ -91,6 +91,9 @@ static NFCSTATUS phFriNfc_LlcpMac_Nfcip_Activate (phFriNfc_LlcpMac_t *LlcpMac) static NFCSTATUS phFriNfc_LlcpMac_Nfcip_Deactivate (phFriNfc_LlcpMac_t *LlcpMac) { NFCSTATUS status = NFCSTATUS_SUCCESS; + phFriNfc_LlcpMac_Send_CB_t pfSendCB; + phFriNfc_LlcpMac_Reveive_CB_t pfRecvCB; + void *pContext; if(NULL == LlcpMac) { @@ -102,6 +105,40 @@ static NFCSTATUS phFriNfc_LlcpMac_Nfcip_Deactivate (phFriNfc_LlcpMac_t *LlcpMa LlcpMac->LinkState = phFriNfc_LlcpMac_eLinkDeactivated; } + if (LlcpMac->SendPending) + { + /* Reset Flag */ + LlcpMac->SendPending = FALSE; + + /* Save context in local variables */ + pfSendCB = LlcpMac->MacSend_Cb; + pContext = LlcpMac->MacSend_Context; + + /* Reset the pointer to the Send Callback */ + LlcpMac->MacSend_Cb = NULL; + LlcpMac->MacSend_Context = NULL; + + /* Call Send callback */ + pfSendCB(pContext, NFCSTATUS_FAILED); + } + + if (LlcpMac->RecvPending) + { + /* Reset Flag */ + LlcpMac->RecvPending = FALSE; + + /* Save context in local variables */ + pfRecvCB = LlcpMac->MacReceive_Cb; + pContext = LlcpMac->MacReceive_Context; + + /* Reset the pointer to the Receive Callback */ + LlcpMac->MacReceive_Cb = NULL; + LlcpMac->MacReceive_Context = NULL; + + /* Call Receive callback */ + pfRecvCB(pContext, NFCSTATUS_FAILED, NULL); + } + LlcpMac->LinkStatus_Cb(LlcpMac->LinkStatus_Context, LlcpMac->LinkState, NULL, @@ -187,6 +224,7 @@ static void phFriNfc_LlcpMac_Nfcip_Receive_Cb(void *pContext, LlcpMac->MacReceive_Context = NULL; /* Call the receive callback */ + LlcpMac->RecvPending = FALSE; pfReceiveCB(pReceiveContext, Status, LlcpMac->psReceiveBuffer); #ifdef LLCP_CHANGES |