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: RecordType/RecordVCard.h
- Revision:
- 9:689c1f56f359
- Parent:
- 8:473f6e0b03df
- Child:
- 12:ed4d9b8d1410
--- a/RecordType/RecordVCard.h Tue Dec 22 15:34:06 2015 +0000 +++ b/RecordType/RecordVCard.h Fri Jan 08 15:26:21 2016 +0000 @@ -4,7 +4,7 @@ * @author ST / Central Labs * @version V1.0.0 * @date 16 Nov 2015 - * @brief RecordVCard implementation + * @brief {@link RecordMimeType} that contains a VCard data ****************************************************************************** * @attention * @@ -44,11 +44,10 @@ namespace NDefLib { -//https://en.wikipedia.org/wiki/VCard - /** - * Specialize the mimeType record for store a VCard information. + * Specialize the {@link RecordMimeType} for store a VCard information. * this record handle the VCard version 3 format + * @see https://en.wikipedia.org/wiki/VCard */ class RecordVCard: public RecordMimeType { public: @@ -132,22 +131,39 @@ mContentIsChange=true; return mCardInfo[type]; } - + + /** + * get the record type + * @return TYPE_MIME_VCARD + */ virtual RecordType_t getType() const { return TYPE_MIME_VCARD; } //getType - + /** + * @return update the record content and return the number of + * bytes needed for store this record + */ virtual uint16_t getByteLength() { updateContentInfoString(); return RecordMimeType::getByteLength(); } + /** + * update the content and write it on the buffer + * @param[out] buffer buffer where write the record content + * @return number or write bytes + * @see Record#write + */ virtual uint16_t write(uint8_t *buffer){ updateContentInfoString(); return RecordMimeType::write(buffer); } + /** + * compare 2 object + * @return true if the records have the same Vcard information + */ bool operator==(const RecordVCard &other){ return (mCardInfo==other.mCardInfo); } @@ -157,12 +173,15 @@ private: VCardInfo_t mCardInfo; - //buffer containing the Vcard representation for this record - std::string mCardInfoString; + + std::string mCardInfoString; ///< buffer containing the Vcard representation for this record + + bool mContentIsChange; ///< true if we have to upadte the string rappresentation of the data - bool mContentIsChange; - - void updateContentInfoString(); + /** + * generate a string rappresentation of the vcard info + */ + void updateContentInfoString(); /** * check if in the string that start in position offset, is present a known