diff options
author | Jan Brands <jan.r.brands@nxp.com> | 2010-12-08 00:30:37 +0100 |
---|---|---|
committer | Nick Pelly <npelly@google.com> | 2010-12-07 23:12:38 -0800 |
commit | 74216af142920e0bce72ec3d9609ec86db211c69 (patch) | |
tree | 7de9c148be30bc650c8d251a089b932a22efced1 /src/phLibNfc_ndef_raw.c | |
parent | b2c5ac1e2d4dda413c4b3a66dc8a186e1dc5f6c4 (diff) | |
download | external_libnfc-nxp-74216af142920e0bce72ec3d9609ec86db211c69.zip external_libnfc-nxp-74216af142920e0bce72ec3d9609ec86db211c69.tar.gz external_libnfc-nxp-74216af142920e0bce72ec3d9609ec86db211c69.tar.bz2 |
NDEF tag R/W-R/O status functionality from Bangalore
Provides all the states as defined by the NFC-Forum.
Change-Id: I369138404e679b49613a391a9487766160afd8e2
Diffstat (limited to 'src/phLibNfc_ndef_raw.c')
-rw-r--r-- | src/phLibNfc_ndef_raw.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/phLibNfc_ndef_raw.c b/src/phLibNfc_ndef_raw.c index ac29d70..4c3d647 100644 --- a/src/phLibNfc_ndef_raw.c +++ b/src/phLibNfc_ndef_raw.c @@ -856,6 +856,7 @@ void phLibNfc_Ndef_CheckNdef_Cb(void *pContext,NFCSTATUS status) Ndef_Info.ActualNdefMsgLength = 0; Ndef_Info.MaxNdefMsgLength = 0; + Ndef_Info.NdefCardState = PHLIBNFC_NDEF_CARD_INVALID; if(pLibNfc_Ctxt != gpphLibContext) { /*wrong context returned from below layer*/ phOsalNfc_RaiseException(phOsalNfc_e_InternalErr,1); @@ -989,6 +990,39 @@ void phLibNfc_Ndef_CheckNdef_Cb(void *pContext,NFCSTATUS status) gpphLibContext->CBInfo.pClientCkNdefCntx = NULL; if(NULL != pClientCb) { + if (!RetStatus) + { + switch (pLibNfc_Ctxt->ndef_cntx.psNdefMap->CardState) + { + case PH_NDEFMAP_CARD_STATE_INITIALIZED: + { + Ndef_Info.NdefCardState = + PHLIBNFC_NDEF_CARD_INITIALISED; + break; + } + + case PH_NDEFMAP_CARD_STATE_READ_ONLY: + { + Ndef_Info.NdefCardState = + PHLIBNFC_NDEF_CARD_READ_ONLY; + break; + } + + case PH_NDEFMAP_CARD_STATE_READ_WRITE: + { + Ndef_Info.NdefCardState = + PHLIBNFC_NDEF_CARD_READ_WRITE; + break; + } + + default: + { + Ndef_Info.NdefCardState = + PHLIBNFC_NDEF_CARD_INVALID; + break; + } + } + } /* call the upper check ndef callback */ pClientCb(pUpperLayerContext,Ndef_Info,RetStatus); } @@ -1068,6 +1102,7 @@ STATIC void phLibNfc_Ndef_ChkNdef_Pchk_Cb(void *pContext, gpphLibContext->CBInfo.pClientCkNdefCntx = NULL; if(NULL != pClientCb) { + Ndef_Info.NdefCardState = PHLIBNFC_NDEF_CARD_INVALID; /* call the upper check ndef callback */ pClientCb(pUpperLayerContext,Ndef_Info,RetStatus); } |