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
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.
Diff: Record.h
- Revision:
- 12:ed4d9b8d1410
- Parent:
- 10:9f34b0cfefe4
- Child:
- 18:cf1dd5c931c2
--- a/Record.h Mon Jan 11 13:04:33 2016 +0000 +++ b/Record.h Thu Jan 14 07:54:44 2016 +0000 @@ -4,7 +4,7 @@ * @author ST / Central Labs * @version V1.0.0 * @date 30 Nov 2015 - * @brief generic Record class + * @brief Generic Record class ****************************************************************************** * @attention * @@ -51,7 +51,7 @@ public: /** - * enum used for identify the record type + * Enum used to identify the record type. */ typedef enum { TYPE_UNKNOWN, //!< UNKNOWN record @@ -69,21 +69,21 @@ } /** - * set the record as the first record in the message + * Set the record as the first record in the message. */ void setAsFirstRecord() { mRecordHeader.setMB(true); } /** - * set the record as the last record in the message + * Set the record as the last record in the message. */ void setAsLastRecord() { mRecordHeader.setME(true); } /** - * tell if it is the last record + * Check if it is the last record in the message. * @return true if it is the last record in the message */ bool isLastRecord() const { @@ -91,7 +91,7 @@ } /** - * tell if it is the first record + * Check if it is the first record in the message. * @return true if it is the fist record in the message */ bool isFirstRecord() const { @@ -99,7 +99,7 @@ } /** - * set the record as generic (not the first one and not the last one) + * Set the record as generic (not the first one and not the last one) */ void setAsMiddleRecord() { mRecordHeader.setMB(false); @@ -107,7 +107,7 @@ } /** - * Tell if the record is in the middle of a chain + * Check if the record is in the middle of a chain. * @return true if is not the fist or the last one */ bool isMiddleRecord() const{ @@ -115,8 +115,9 @@ } /** - * get tag type - * @return tag type if not overwrite it return TYPE_UNKNOWN + * Get tag type. + * @par This method should be overridden to return a valid type. + * @return tag type */ virtual RecordType_t getType() const { return TYPE_UNKNOWN; @@ -124,25 +125,26 @@ /** - * get the record header for this record - * @return record header used for this record + * Get the record header. + * @return record header */ const RecordHeader& getHeader() const{ return mRecordHeader; } /** - * number of byte needed for store this record - * @return size header + size record content + * Number of bytes needed to store this record. + * @return size of the header + size of the record content */ virtual uint16_t getByteLength() { return mRecordHeader.getRecordLength(); } /** - * write the record content into a buffer - * @param[out] buffer buffer where write the record content, the buffer size must be almost getByteLength() bytes - * @return number of write bytes + * Write the record content into a buffer. + * @param[out] buffer buffer to write the record content into, the buffer size + * must be almost {@link Record#getByteLength} bytes. + * @return number of written bytes */ virtual uint16_t write(uint8_t *buffer)=0;