summaryrefslogtreecommitdiffstats
path: root/src/phFriNfc_NdefMap.c
diff options
context:
space:
mode:
authorMartijn Coenen <martijn.coenen@nxp.com>2010-12-16 23:24:55 +0100
committerNick Pelly <npelly@google.com>2010-12-16 16:49:43 -0800
commit80ee29b88ec489e2bbf6ae446692229d36755429 (patch)
tree9592b7c752c315b6474f72b76b9dc220991290cc /src/phFriNfc_NdefMap.c
parentd75796b759f9baac8facf22f1b6c6bcfbc51161e (diff)
downloadexternal_libnfc-nxp-80ee29b88ec489e2bbf6ae446692229d36755429.zip
external_libnfc-nxp-80ee29b88ec489e2bbf6ae446692229d36755429.tar.gz
external_libnfc-nxp-80ee29b88ec489e2bbf6ae446692229d36755429.tar.bz2
Add support for makeLowLevelReadonly() in libnfc.
Implemented for T1T and T2T. There's also added code for formatting Desfire EV1, but it will not be used by the current implementation (DesFIRE doesn't have NdefFormatable tech). Change-Id: Iec1b85b560fbf800291fd307b56ab84328737635
Diffstat (limited to 'src/phFriNfc_NdefMap.c')
-rw-r--r--src/phFriNfc_NdefMap.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/phFriNfc_NdefMap.c b/src/phFriNfc_NdefMap.c
index a0389e4..89fc4b3 100644
--- a/src/phFriNfc_NdefMap.c
+++ b/src/phFriNfc_NdefMap.c
@@ -617,6 +617,47 @@ NFCSTATUS phFriNfc_NdefMap_WrNdef( phFriNfc_NdefMap_t *NdefMap,
return status;
}
+#ifdef FRINFC_READONLY_NDEF
+NFCSTATUS
+phFriNfc_NdefMap_ConvertToReadOnly (
+ phFriNfc_NdefMap_t *NdefMap)
+{
+ NFCSTATUS result = NFCSTATUS_PENDING;
+
+
+ /* Check for ndefmap context and relevant state. Else return error*/
+ if (NULL == NdefMap)
+ {
+ result = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_INVALID_PARAMETER);
+ }
+ else if ((NdefMap->CompletionRoutine->CompletionRoutine == NULL)
+ || (NdefMap->CompletionRoutine->Context == NULL))
+ {
+ result = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_INVALID_PARAMETER);
+ }
+ else
+ {
+ switch (NdefMap->CardType)
+ {
+ case PH_FRINFC_NDEFMAP_TOPAZ_CARD:
+ case PH_FRINFC_NDEFMAP_TOPAZ_DYNAMIC_CARD:
+ {
+ result = phFriNfc_TopazMap_ConvertToReadOnly (NdefMap);
+ break;
+ }
+
+ default:
+ {
+ result = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
+ break;
+ }
+ }
+ }
+ return result;
+}
+#endif /* #ifdef FRINFC_READONLY_NDEF */
+
/*!
* Check whether a particular Remote Device is NDEF compliant.
*