This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.

Dependencies:   NDefLib X_NUCLEO_NFC01A1 mbed

Fork of X-MBED-NFC1 by Giovanni Visentini

This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.

The available demos are:

  • SAMPLE_WRITE_URL: write a tag with the ST home page URL
  • SAMPLE_COUNT_CLICK: create a custom tag to count and report the user button clicks.
  • SAMPLE_WRITE_AND_CHANGE_ALL: write a tag with all the supported records and update the tag contents when the user button is pressed.
  • SAMPLE_LOCK_TAG_CONTENT: use the M24SR component API to set the NFC tag as read-only.

To enable the different demos comment/uncomment the SAMPLE_* macros provided in main.cpp .

Revision:
0:674813bd5ec9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Type4NfcTag.h	Thu Nov 19 08:50:18 2015 +0000
@@ -0,0 +1,38 @@
+/*
+ * Type4NfcTag.h
+ *
+ *  Created on: Nov 5, 2015
+ *      Author: giovanni visentini
+ */
+
+#ifndef TYPE4NFCTAG_H_
+#define TYPE4NFCTAG_H_
+
+#include "NDefLib/Message.h"
+
+class Type4NfcTag {
+public:
+
+	virtual bool openSession(bool force=false)=0;
+	virtual bool closeSession()=0;
+
+	bool write(NDefLib::Message &msg){
+		const uint16_t length = msg.getByteLenght();
+		uint8_t *buffer = new uint8_t[length];
+		msg.write(buffer);
+		bool retValue =  writeByte(buffer,length);
+		delete [] buffer;
+		return retValue;
+	}
+
+	virtual bool read(void*)=0;
+
+	virtual ~Type4NfcTag(){};
+
+protected:
+	virtual bool writeByte(uint8_t *buffer,uint16_t lenght)=0;
+
+};
+
+#endif /* TYPE4NFCTAG_H_ */
+