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:
12:ed4d9b8d1410
Parent:
8:473f6e0b03df
Child:
18:cf1dd5c931c2
--- a/RecordHeader.h	Mon Jan 11 13:04:33 2016 +0000
+++ b/RecordHeader.h	Thu Jan 14 07:54:44 2016 +0000
@@ -43,7 +43,7 @@
 namespace NDefLib {
 
 /**
- * Record header class
+ * Record header class.
  * @see NFC Data Exchange Format (NDEF) Technical Specification NDEF 1.0
  */
 class RecordHeader {
@@ -51,7 +51,7 @@
 public:
 
 	/**
-	 * record type format
+	 * Record type format
 	 */
 	typedef enum TypeNameFormat {
 		Empty = 0x00,          //!< Empty
@@ -71,8 +71,8 @@
 	}
 
 	/**
-	 * set the message begin flag
-	 * @param value true if the record is the first of the message
+	 * Set the 'message begin' flag.
+	 * @param value True if the record is the first within the message.
 	 */
 	void setMB(bool value) {
 		if (value)
@@ -82,7 +82,7 @@
 	}//setMB
 
 	/**
-	 * get the message being flag
+	 * Check the 'message begin' flag.
 	 * @return true if it is the first record in the message
 	 */
 	bool getMB() const {
@@ -90,8 +90,8 @@
 	}//getMB
 
 	/**
-	 * set the message end flag
-	 * @param value true if it is the last record in the message
+	 * Set the 'message end' flag.
+	 * @param value True if it is the last record in the message.
 	 */
 	void setME(bool value) {
 		if (value)
@@ -101,7 +101,7 @@
 	}//setME
 
 	/**
-	 * get the message end flag
+	 * Check the 'message end' flag.
 	 * @return true if it is the last record in the message
 	 */
 	bool getME() const {
@@ -109,9 +109,9 @@
 	}//getME
 
 	/**
-	 * set the Chunk flag
-	 * @param value true if the record is in the first record chunk or a middle record
-	 * chunk of a chunked payload
+	 * Set the 'Chunk' flag.
+	 * @param value True if the record is in the first record chunk or in a middle record
+	 * chunk of a chunked payload.
 	 */
 	void setCF(bool value) {
 		if (value)
@@ -121,8 +121,8 @@
 	}//getCF
 
 	/**
-	 * get the Chunk flag value
-	 * @return true if the record is in the first record chunk or a middle record
+	 * Check the 'Chunk' flag value.
+	 * @return true if the record is in the first record chunk or in a middle record
 	 * chunk of a chunked payload
 	 */
 	bool getCF() const {
@@ -130,8 +130,8 @@
 	}//getCF
 
 	/**
-	 * set the short record flag value
-	 * @param value true if the record size can be encoded with 8 bits
+	 * Set the 'Short record' flag value.
+	 * @param value True if the record size can be encoded with 8 bits.
 	 */
 	void setSR(bool value) {
 		if (value)
@@ -141,16 +141,16 @@
 	}//setSR
 
 	/**
-	 * get the Short record flag
-	 * @return true if we are using the short range header format
+	 * Check the 'Short record' flag.
+	 * @return true if the short range header format is set
 	 */
 	bool getSR() const {
 		return (headerFlags & 0x10) != 0;
 	}//getSR
 
 	/**
-	 * set the ID length flag
-	 * @param value true if we will use the id length value in the record
+	 * Set the 'ID length' flag.
+	 * @param value True if the 'ID length' value is used.
 	 */
 	void setIL(bool value) {
 		if (value)
@@ -160,16 +160,16 @@
 	}//setIL
 
 	/**
-	 * get the ID length flag
-	 * @param value true if we will use the id length value in the record
+	 * Check the 'ID length' flag.
+	 * @param value True if 'ID length' is set.
 	 */
 	bool getIL() const {
 		return (headerFlags & 0x08) != 0;
 	}//getIL
 
 	/**
-	 * set the type name format field
-	 * @param value record type name format
+	 * Set the type name format field.
+	 * @param value Record type name format.
 	 */
 	void setFNT(const TypeNameFormat_t value) {
 		uint8_t temp = (uint8_t) value;
@@ -179,7 +179,7 @@
 	}//setFNT
 
 	/**
-	 * get the record type name
+	 * Get the record type name.
 	 * @return type name format of the record
 	 */
 	TypeNameFormat_t getFNT() const {
@@ -187,8 +187,8 @@
 	}
 
 	/**
-	 * set the record payload length
-	 * @par this function will update the SR field as needed
+	 * Set the record payload length.
+	 * @par This function will update the SR field as needed.
 	 * @param length payload length
 	 */
 	void setPayloadLength(uint32_t length) {
@@ -197,7 +197,7 @@
 	}
 
 	/**
-	 * get the payload length
+	 * Get the payload length.
 	 * @return payload length
 	 */
 	uint32_t getPayloadLength() const {
@@ -205,23 +205,23 @@
 	}
 
 	/**
-	 * set the type length
-	 * @param size
+	 * Set the type length.
+	 * @param size.
 	 */
 	void setTypeLength(uint8_t size) {
 		typeLength = size;
 	}
 
 	/**
-	 * get the type length
-	 * @return
+	 * Get the type length.
+	 * @return type length
 	 */
 	uint8_t getTypeLength() const {
 		return typeLength;
 	}
 
 	/**
-	 * get the number of byte needed for store this record
+	 * Get the number of bytes needed to store this record.
 	 * @return 3 or 6
 	 */
 	uint16_t getRecordLength() const {
@@ -229,8 +229,8 @@
 	}
 
 	/**
-	 * store the header information in the buffer
-	 * @param[out] outBuffer buffer where write the header
+	 * Store the header information in the buffer.
+	 * @param[out] outBuffer Buffer to write the header into.
 	 * @return number of write bytes
 	 */
 	uint8_t writeHeader(uint8_t *outBuffer) const {
@@ -254,8 +254,8 @@
 	} //writeHeader
 
 	/**
-	 * load an header from a buffer
-	 * @param buffer buffer where read the header
+	 * Load an header from a buffer.
+	 * @param buffer Buffer to load the header from.
 	 * @return number of read bytes
 	 */
 	uint16_t loadHeader(const uint8_t * const buffer) {
@@ -275,9 +275,9 @@
 	} //loadHeader
 
 	/**
-	 * equal operator
-	 * @param other other object to compare
-	 * @return true if the 2 record header are equals
+	 * Equal operator.
+	 * @param other Other object to compare with.
+	 * @return true if the two record headers are equal
 	 */
 	bool operator==(const RecordHeader &other) const{
 		return (headerFlags==other.headerFlags) &&