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/phFriNfc_LlcpMacNfcip.c | |
parent | 28ab3385d05d10437c6b1f0168bab6ed71bf4bfd (diff) | |
download | libnfc-nxp-35a9f321a9cb5db0e65b9579d11bee2ac9bb1c54.tar.gz |
Fix missing send callback in error upon deactivation.
Change-Id: I2a857c4e02fcf8c0f655a6fa960466f5ac4f191e
Diffstat (limited to 'src/phFriNfc_LlcpMacNfcip.c')
-rw-r--r-- | src/phFriNfc_LlcpMacNfcip.c | 38 |
1 files changed, 38 insertions, 0 deletions
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 |