A simple application providing an example of asynchronous access to the X-NUCLEO_NFC01A1 Dynamic NFC Tag board.
Dependencies: NDefLib X_NUCLEO_NFC01A1 mbed
Fork of HelloWord_Async_NFC01A1 by
X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board Firmware Package
Introduction
This firmware package includes Components Device Drivers, Board Support Package and example applications for STMicroelectronics X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board based on M24SR.
Example Application
The application provides a simple example of asynchronous access to the X-NUCLEO-NFC01A1 Dynamic NFC Tag Expansion Board. The program writes a URI link to the M24SR dynamic tag using the asynchronous programming model. The URI can then be retrieved from an NFC enabled smartphone/tablet.
A simpler example providing synchronous access to the tag is also available.
Diff: main.cpp
- Revision:
- 2:48e58c5086e8
- Parent:
- 1:f008324c60ab
- Child:
- 4:416db8919ca4
--- a/main.cpp Mon Feb 01 15:41:41 2016 +0000 +++ b/main.cpp Wed Feb 03 09:06:03 2016 +0000 @@ -42,7 +42,7 @@ * Chain of callback that will crate a Uri record and write it. * After each operation the class will switch on a led */ -class WriteUriCallbacks : public NDefLib::NDefNfcTag::Callback{ +class WriteUriCallbacks : public NDefLib::NDefNfcTag::Callbacks{ DigitalOut &mOnOpenSession; DigitalOut &mOnWrite; @@ -67,9 +67,9 @@ */ virtual void onSessionOpen(NDefLib::NDefNfcTag *tag,bool success){ if(!success){ - printf("Error OpenSession\n\r"); + printf("Error opening the session\r\n"); }//else - printf("Session Open\n\r"); + printf("Session opened\r\n"); //ask to have an interrupt when the command finish mOnOpenSession=1; NDefLib::Message msg; @@ -90,9 +90,9 @@ const NDefLib::Message&){ if(!success) - printf("Error writing tag!\n\r"); + printf("Error writing tag!\r\n"); else{ - printf("Tag Wrote!\n\r"); + printf("Tag written!\r\n"); mOnWrite=1; }//if-else tag->closeSession(); @@ -105,10 +105,10 @@ */ virtual void onSessionClose(NDefLib::NDefNfcTag*,bool success){ if(success){ - printf("Session closed\n\r"); + printf("Error closing the session\r\n"); mOnCloseSession=1; }else - printf("Error Session closed\n\r"); + printf("Error opening the session\r\n"); } };