diff options
author | Sylvain Fonteneau <sylvain.fonteneau@trusted-logic.com> | 2010-11-29 13:46:26 +0100 |
---|---|---|
committer | Nick Pelly <npelly@google.com> | 2010-12-05 13:15:25 -0800 |
commit | 1927b9d35c5efe26676c1dae78e3d1ab906f7586 (patch) | |
tree | 829412d83dab835960eb253766f180efd1f59fab | |
parent | c56a3c7bc332a6656bedf342236267b636051170 (diff) | |
download | external_libnfc-nxp-1927b9d35c5efe26676c1dae78e3d1ab906f7586.zip external_libnfc-nxp-1927b9d35c5efe26676c1dae78e3d1ab906f7586.tar.gz external_libnfc-nxp-1927b9d35c5efe26676c1dae78e3d1ab906f7586.tar.bz2 |
Prevent sending data over LLCP until link is up.
Change-Id: I11e80e9778934e40e57c58dbc9f56f319d015f80
-rw-r--r-- | src/phFriNfc_Llcp.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/phFriNfc_Llcp.c b/src/phFriNfc_Llcp.c index ddecb05..c17cad9 100644 --- a/src/phFriNfc_Llcp.c +++ b/src/phFriNfc_Llcp.c @@ -1391,7 +1391,12 @@ NFCSTATUS phFriNfc_Llcp_Send( phFriNfc_Llcp_t *Llcp, Llcp->pfSendCB = pfSend_CB; Llcp->pSendContext = pContext; - if (Llcp->state != PHFRINFC_LLCP_STATE_OPERATION_SEND) + if (Llcp->state == PHFRINFC_LLCP_STATE_OPERATION_SEND) + { + /* Ready to send */ + result = phFriNfc_Llcp_InternalSend(Llcp, psHeader, psSequence, psInfo); + } + else if (Llcp->state == PHFRINFC_LLCP_STATE_OPERATION_RECV) { /* Not ready to send, save send params for later use */ Llcp->psSendHeader = psHeader; @@ -1401,8 +1406,8 @@ NFCSTATUS phFriNfc_Llcp_Send( phFriNfc_Llcp_t *Llcp, } else { - /* No send pending, send immediately */ - result = phFriNfc_Llcp_InternalSend(Llcp, psHeader, psSequence, psInfo); + /* Incorrect state for sending ! */ + result = PHNFCSTVAL(CID_FRI_NFC_LLCP, NFCSTATUS_INVALID_STATE);; } return result; } |