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:
1:a0eeb478a45a
Parent:
0:04b82ae7aa43
Child:
2:760e36ba9c23
--- a/Record.h	Thu Nov 19 08:49:47 2015 +0000
+++ b/Record.h	Tue Nov 24 14:33:06 2015 +0000
@@ -101,7 +101,7 @@
 				setSR(playloadLenght<=255);
 			}
 
-			uint32_t getPlayloadLenght(){
+			uint32_t getPlayloadLenght()const{
 				return playloadLenght;
 			}
 
@@ -109,6 +109,10 @@
 				typeLenght=size;
 			}
 
+			uint8_t getTypeLenght()const{
+				return typeLenght;
+			}
+
 			uint16_t getRecordLength()const{
 				return (getSR() ? 3 : 6) + typeLenght+playloadLenght;
 			}
@@ -130,7 +134,7 @@
 				return index;
 			}//writeHeader
 
-			uint16_t loadHeader(uint8_t *buffer){
+			uint16_t loadHeader(const uint8_t *const buffer){
 				uint32_t index=0;
 				headerFlags=buffer[index++];
 				typeLenght=buffer[index++];
@@ -153,6 +157,17 @@
 
 		};
 
+	typedef enum {
+		TYPE_UNKNOWN,
+		TYPE_TEXT,
+		TYPE_AAR,
+		TYPE_MIME,
+		TYPE_URI,
+		TYPE_URI_MAIL,
+		TYPE_SMS,
+		TYPE_GEOLOCATION
+	}RecordType_t;
+
 	Record(){}
 
 	void setAsFirstRecord(){
@@ -172,6 +187,10 @@
 		mRecordHeader.setME(false);
 	}
 
+	virtual RecordType_t getType()const{
+		return TYPE_UNKNOWN;
+	}//getType
+
 	virtual uint16_t getByteLenght(){
 		return mRecordHeader.getRecordLength();
 	}