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
Parent:
0:651138e1c1af
--- 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();
     }