Utility library to read and write Ndef messages from/to a Type4 NFC tag

Dependents:   NFC M2M_2016_STM32 MyongjiElec_capstone1 IDW01M1_Cloud_IBM ... more

Fork of NDefLib by ST Expansion SW Team

NDEF NFC library

This library provides an abstract API to create NDEF formatted messages and records and to read/write them from/to a Type4 NFC Tag.

Implementations

At the moment, the NDEF API is implemented by X_NUCLEO_NFC01A1 and X_NUCLEO_NFC02A1 Dynamic NFC Tag libraries respectively driving the X-NUCLEO-NFC01A1 and X-NUCLEO-NFC02A1 boards.

Revision:
21:72c86cbd49be
Parent:
20:31f727872290
--- a/NDefNfcTag.h	Wed Jul 12 12:33:42 2017 +0000
+++ b/NDefNfcTag.h	Mon Aug 21 12:02:31 2017 +0000
@@ -74,9 +74,8 @@
 			 * @param tag Tag where the message is written.
 			 * @param success True if the operation has success.
 			 */
-			virtual void on_message_write(NDefNfcTag *tag,bool success,
-					const Message &msg){
-				(void)tag;(void)success; (void)msg;
+			virtual void on_message_write(NDefNfcTag *tag,bool success){
+				(void)tag;(void)success;
 
 			};
 
@@ -161,21 +160,21 @@
 	 */
 	virtual bool write(Message &msg) {
 		if (!is_session_open()) {
-			mCallBack->on_message_write(this,false,msg);
+			mCallBack->on_message_write(this,false);
 			return false;
 		}
 
 		const uint16_t length = msg.get_byte_length();
 		uint8_t *buffer = new uint8_t[length];
 		if (buffer==NULL){ //impossible to allocate the buffer
-			mCallBack->on_message_write(this,false,msg);
+			mCallBack->on_message_write(this,false);
 			return false;
 		}
 
 		msg.write(buffer);
 
 		mCallBackStatus.callOwner=this;
-		mCallBackStatus.msg=&msg;
+		mCallBackStatus.msg=NULL;
 
 		return writeByte(buffer, length,0,NDefNfcTag::onWriteMessageCallback,&mCallBackStatus);
 	}
@@ -265,7 +264,7 @@
 		bool status,const uint8_t *buffer, uint16_t ){
 		delete [] buffer;
 
-		internalState->callOwner->mCallBack->on_message_write(internalState->callOwner,status,*internalState->msg);
+		internalState->callOwner->mCallBack->on_message_write(internalState->callOwner,status);
 
 		return status;
 	}