This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.
Dependencies: NDefLib X_NUCLEO_NFC01A1 mbed
Fork of X-MBED-NFC1 by
This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.
The available demos are:
- SAMPLE_WRITE_URL: write a tag with the ST home page URL
- SAMPLE_COUNT_CLICK: create a custom tag to count and report the user button clicks.
- SAMPLE_WRITE_AND_CHANGE_ALL: write a tag with all the supported records and update the tag contents when the user button is pressed.
- SAMPLE_LOCK_TAG_CONTENT: use the M24SR component API to set the NFC tag as read-only.
To enable the different demos comment/uncomment the SAMPLE_* macros provided in main.cpp .
Diff: Samples/sampleAsync_lockWriteTag.cpp
- Revision:
- 15:94c98d2aa235
- Parent:
- 14:3b604972b89f
- Child:
- 17:d8d3d2088cac
--- a/Samples/sampleAsync_lockWriteTag.cpp Wed Aug 31 13:06:13 2016 +0000
+++ b/Samples/sampleAsync_lockWriteTag.cpp Wed Aug 31 13:58:17 2016 +0000
@@ -86,14 +86,15 @@
if(status!=NFC_SUCCESS)
return onError(status);
mIsComamndRunning=true;
-
+ printf("Session Opened\r\n");
tag->SelectApplication();
}
virtual void onSelectedApplication(Nfc *tag,NFC_StatusTypeDef status){
if(status!=NFC_SUCCESS)
return onError(status);
-
+
+ printf("Select application\r\n");
tag->SelectNDEFfile(0x0001);
}
@@ -101,19 +102,23 @@
if(status!=NFC_SUCCESS)
return onError(status);
+ printf("Select NDef\r\n");
tag->DisableAllPassword(M24SR::DEFAULT_PASSWORD);
}
virtual void onDisableAllPassword(Nfc *tag, NFC_StatusTypeDef status){
if(status!=NFC_SUCCESS)
return onError(status);
-
+
+ printf("Disable all Password\r\n");
tag->Deselect();
}
virtual void onDeselect(Nfc *,NFC_StatusTypeDef status){
if(status!=NFC_SUCCESS)
return onError(status);
+
+ printf("Close Application\r\n");
mIsComamndRunning=false;
}
@@ -173,19 +178,22 @@
virtual void onSessionOpen(Nfc *,NFC_StatusTypeDef status){
if(status!=NFC_SUCCESS)
return onError(status);
+ printf("Session Open\r\n");
mNfcTag.SelectApplication();
}
virtual void onSelectedApplication(Nfc *,NFC_StatusTypeDef status){
if(status!=NFC_SUCCESS)
return onError(status);
+
+ printf("Select Application\r\n");
mNfcTag.SelectNDEFfile(0x0001);
}
virtual void onSelectedNDEFFile(Nfc *,NFC_StatusTypeDef status){
if(status!=NFC_SUCCESS)
return onError(status);
-
+ printf("Select NDef file\r\n");
if(mIsReadOnly){
mNfcTag.EnableReadOnly(M24SR::DEFAULT_PASSWORD);
}else
@@ -196,7 +204,7 @@
virtual void onEnableReadOnly(Nfc *,NFC_StatusTypeDef status){
if(status!=NFC_SUCCESS)
return onError(status);
-
+ printf("Ready only Enabled\r\n");
if(!mIsReadOnly) //if in the meantime the status change
mNfcTag.DisableReadOnly(M24SR::DEFAULT_PASSWORD);
else{
@@ -209,7 +217,7 @@
virtual void onDisableReadOnly(Nfc *,NFC_StatusTypeDef status){
if(status!=NFC_SUCCESS)
return onError(status);
-
+ printf("Ready only Disabled\r\n");
if(mIsReadOnly) //if in the meantime the status change
mNfcTag.EnableReadOnly(M24SR::DEFAULT_PASSWORD);
else{
@@ -222,6 +230,7 @@
virtual void onDeselect(Nfc *,NFC_StatusTypeDef status){
if(status!=NFC_SUCCESS)
return onError(status);
+ printf("Close Application\r\n");
mIsComamndRunning=false;
}
};
