summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2012-01-27 12:13:06 -0800
committerMartijn Coenen <maco@google.com>2012-01-27 12:21:54 -0800
commitd25018da04378bf0529f82ed03d9e25390216b0b (patch)
tree7bd1433e8753b04e8aa80899431de42a21b34dca /src
parent32060a1ad89a5791039bf4a7e89db6cbc3e669d0 (diff)
downloadexternal_libnfc-nxp-d25018da04378bf0529f82ed03d9e25390216b0b.zip
external_libnfc-nxp-d25018da04378bf0529f82ed03d9e25390216b0b.tar.gz
external_libnfc-nxp-d25018da04378bf0529f82ed03d9e25390216b0b.tar.bz2
LLCP 1.1: Fix some bugs.
- Clear out send callback if send was not accepted. - Set transport busy status for RR/RNR frames. Change-Id: Idf8986f6b82995644b176247a644e36d2c879ebf
Diffstat (limited to 'src')
-rw-r--r--src/phFriNfc_LlcpTransport.c11
-rw-r--r--src/phFriNfc_LlcpTransport_Connection.c6
2 files changed, 14 insertions, 3 deletions
diff --git a/src/phFriNfc_LlcpTransport.c b/src/phFriNfc_LlcpTransport.c
index 38c6807..158dbc2 100644
--- a/src/phFriNfc_LlcpTransport.c
+++ b/src/phFriNfc_LlcpTransport.c
@@ -544,7 +544,6 @@ static void phFriNfc_LlcpTransport_Send_CB(void *pContext,
uint8_t index;
/* 1 - Reset the FLAG send pending*/
-
psTransport->bSendPending = FALSE;
/* 2 - Handle pending error responses */
@@ -800,18 +799,24 @@ NFCSTATUS phFriNfc_LlcpTransport_LinkSend( phFriNfc_LlcpTransport_t *Llc
phFriNfc_Llcp_Send_CB_t pfSend_CB,
void *pContext )
{
+ NFCSTATUS status;
/* Check if a send is already ongoing */
if (LlcpTransport->pfLinkSendCb != NULL)
{
return NFCSTATUS_BUSY;
}
-
/* Save callback details */
LlcpTransport->pfLinkSendCb = pfSend_CB;
LlcpTransport->pLinkSendContext = pContext;
/* Call the link-level send function */
- return phFriNfc_Llcp_Send(LlcpTransport->pLlcp, psHeader, psSequence, psInfo, phFriNfc_LlcpTransport_Send_CB, (void*)LlcpTransport);
+ status = phFriNfc_Llcp_Send(LlcpTransport->pLlcp, psHeader, psSequence, psInfo, phFriNfc_LlcpTransport_Send_CB, (void*)LlcpTransport);
+ if (status != NFCSTATUS_PENDING && status != NFCSTATUS_SUCCESS) {
+ // Clear out callbacks
+ LlcpTransport->pfLinkSendCb = NULL;
+ LlcpTransport->pLinkSendContext = NULL;
+ }
+ return status;
}
diff --git a/src/phFriNfc_LlcpTransport_Connection.c b/src/phFriNfc_LlcpTransport_Connection.c
index a11945f..a40c505 100644
--- a/src/phFriNfc_LlcpTransport_Connection.c
+++ b/src/phFriNfc_LlcpTransport_Connection.c
@@ -316,6 +316,9 @@ static NFCSTATUS phFriNfc_Llcp_Send_ReceiveReady_Frame(phFriNfc_LlcpTransport_So
}
else
{
+ /* Set transport to pending */
+ pLlcpSocket->psTransport->bSendPending = TRUE;
+
/* Set the header of the RR frame */
pLlcpSocket->sLlcpHeader.dsap = pLlcpSocket->socket_dSap;
pLlcpSocket->sLlcpHeader.ptype = PHFRINFC_LLCP_PTYPE_RR;
@@ -356,6 +359,9 @@ static NFCSTATUS phFriNfc_Llcp_Send_ReceiveNotReady_Frame(phFriNfc_LlcpTransport
}
else
{
+ /* Set transport to pending */
+ pLlcpSocket->psTransport->bSendPending = TRUE;
+
/* Set the header of the RNR frame */
pLlcpSocket->sLlcpHeader.dsap = pLlcpSocket->socket_dSap;
pLlcpSocket->sLlcpHeader.ptype = PHFRINFC_LLCP_PTYPE_RNR;