![](/media/cache/group/ST_logo_2020_blue_V_cmyk.jpg.50x50_q85.jpg)
M24SR NFC example. Simple application to asynchronously write and read an URL from a M24SR tag.
Dependencies: M24SR NDefLib mbed
This simple application provides an example of usage of the M24SR NFC Tag component library.
It is derived from the HelloWorld_Async_NFC01A1 application and currently supports X-NUCLEO-NFC01A1 and ST-Discovery-L475E-IOT01A.
Revision 2:6751a7b70582, committed 2017-08-21
- Comitter:
- giovannivisentini
- Date:
- Mon Aug 21 12:25:45 2017 +0000
- Parent:
- 1:2805113f2386
- 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 |
diff -r 2805113f2386 -r 6751a7b70582 NDefLib.lib --- a/NDefLib.lib Tue Aug 08 14:46:43 2017 +0000 +++ b/NDefLib.lib Mon Aug 21 12:25:45 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ST/code/NDefLib/#31f727872290 +https://developer.mbed.org/teams/ST/code/NDefLib/#72c86cbd49be
diff -r 2805113f2386 -r 6751a7b70582 WriteUriCallbacks.h --- a/WriteUriCallbacks.h Tue Aug 08 14:46:43 2017 +0000 +++ b/WriteUriCallbacks.h Mon Aug 21 12:25:45 2017 +0000 @@ -44,7 +44,7 @@ DigitalOut &mOnOpenSession; DigitalOut &mOnWrite; DigitalOut &mOnCloseSession; - NDefLib::Message *msg; + NDefLib::Message *mMsg; public: @@ -73,10 +73,10 @@ mOnCloseSession=0; NDefLib::RecordURI *rUri = new NDefLib::RecordURI(NDefLib::RecordURI::HTTP_WWW,"http://www.st.com"); - msg = new NDefLib::Message(); - msg->add_record(rUri); + mMsg = new NDefLib::Message(); + mMsg->add_record(rUri); - tag->write(*msg); + tag->write(*mMsg); } /** @@ -85,8 +85,7 @@ * @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) { if (!success) { printf("Error writing tag!\r\n"); @@ -95,8 +94,8 @@ mOnWrite=1; }//if-else - NDefLib::Message::remove_and_delete_all_record(*msg); - delete msg; + NDefLib::Message::remove_and_delete_all_record(*mMsg); + delete mMsg; tag->close_session(); }