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.
Revision 10:a7834e6dd638, committed 2017-08-21
- Comitter:
- giovannivisentini
- Date:
- Mon Aug 21 12:20:40 2017 +0000
- Parent:
- 9:ed8eff7c4cf4
- Commit message:
- update NDefLib
Changed in this revision
| NDefLib.lib | Show annotated file Show diff for this revision Revisions of this file |
| WriteUriCallbacks.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/NDefLib.lib Tue Aug 08 12:42:16 2017 +0000 +++ b/NDefLib.lib Mon Aug 21 12:20:40 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ST/code/NDefLib/#31f727872290 +https://developer.mbed.org/teams/ST/code/NDefLib/#72c86cbd49be
--- a/WriteUriCallbacks.h Tue Aug 08 12:42:16 2017 +0000
+++ b/WriteUriCallbacks.h Mon Aug 21 12:20:40 2017 +0000
@@ -44,7 +44,7 @@
DigitalOut &mOnOpenSession;
DigitalOut &mOnWrite;
DigitalOut &mOnCloseSession;
- NDefLib::Message msg;
+ NDefLib::Message mMsg;
public:
@@ -71,10 +71,11 @@
//ask to have an interrupt when the command finish
mOnOpenSession=1;
- NDefLib::RecordURI rUri(NDefLib::RecordURI::HTTP_WWW,"http://www.st.com");
- msg.add_record(&rUri);
+ NDefLib::RecordURI *rUri =
+ new NDefLib::RecordURI(NDefLib::RecordURI::HTTP_WWW,"http://www.st.com");
+ mMsg.add_record(rUri);
- tag->write(msg);
+ tag->write(mMsg);
}
/**
@@ -83,9 +84,8 @@
* @param success true if the message is correctly wrote
* @param message wrote
*/
- virtual void on_message_write(NDefLib::NDefNfcTag *tag,bool success,
- const NDefLib::Message&) {
-
+ virtual void on_message_write(NDefLib::NDefNfcTag *tag,bool success) {
+ NDefLib::Message::remove_and_delete_all_record(mMsg);
if (!success) {
printf("Error writing tag!\r\n");
} else {
