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:
- 12:ed4d9b8d1410
- Parent:
- 9:689c1f56f359
- Child:
- 19:13d84b136a62
--- a/RecordType/RecordVCard.h Mon Jan 11 13:04:33 2016 +0000 +++ b/RecordType/RecordVCard.h Thu Jan 14 07:54:44 2016 +0000 @@ -45,14 +45,15 @@ namespace NDefLib { /** - * Specialize the {@link RecordMimeType} for store a VCard information. - * this record handle the VCard version 3 format + * Specialize the {@link RecordMimeType} to store VCard information. + * This record handles the VCard version 3 format. * @see https://en.wikipedia.org/wiki/VCard */ class RecordVCard: public RecordMimeType { public: + /** - * type of information that you can store inside the tag + * Type of information that you can store inside the tag */ typedef enum { ADDRESS, //!< ADDRESS @@ -89,30 +90,30 @@ } VCardField_t; /** - * type used for store the vcard information + * Type used to store the vcard information. */ typedef std::map<VCardField_t, std::string> VCardInfo_t; /** - * create an RecordVCard reading the data from the buffer - * @param header record header already read - * @param buffer buffer where read the data + * Create a RecordVCard reading the data from the buffer. + * @param header Record header. + * @param buffer Buffer to read the data from. * @return an object of type RecordVCard or NULL - * @par free the pointer return by this function + * @par User is in charge of freeing the pointer returned by this function. */ static RecordVCard* parse(const RecordHeader &header, const uint8_t* buffer); /** - * create a record with the specific information - * @param info optional information to store in the record + * Create a record with the specific information. + * @param Info optional information to store into the record. */ explicit RecordVCard(const VCardInfo_t &info=VCardInfo_t()); /** - * get the specificic information stored in this record - * @param type type of information to get - * @return if present the information or an empty string + * Get the specific information stored in this record. + * @param Type type of information to get. + * @return if present, the information or an empty string */ const std::string& operator[](const VCardField_t &type)const { VCardInfo_t::const_iterator elem = mCardInfo.find(type); @@ -123,8 +124,8 @@ } /** - * get or set/change an information associated with this record - * @param type type of information to change + * Get or set/change an information associated with this record. + * @param type Type of information to change. * @return reference to the string information */ std::string& operator[](const VCardField_t &type) { @@ -133,7 +134,7 @@ } /** - * get the record type + * Get the record type. * @return TYPE_MIME_VCARD */ virtual RecordType_t getType() const { @@ -142,7 +143,7 @@ /** * @return update the record content and return the number of - * bytes needed for store this record + * bytes needed to store this record */ virtual uint16_t getByteLength() { updateContentInfoString(); @@ -150,9 +151,9 @@ } /** - * update the content and write it on the buffer - * @param[out] buffer buffer where write the record content - * @return number or write bytes + * Update the content and write it on the buffer. + * @param[out] buffer buffer to write the record content into. + * @return number of bytes written * @see Record#write */ virtual uint16_t write(uint8_t *buffer){ @@ -161,7 +162,7 @@ } /** - * compare 2 object + * Compare two objects. * @return true if the records have the same Vcard information */ bool operator==(const RecordVCard &other){ @@ -179,26 +180,26 @@ bool mContentIsChange; ///< true if we have to upadte the string rappresentation of the data /** - * generate a string rappresentation of the vcard info + * Generate a string representing the vcard info */ void updateContentInfoString(); /** - * check if in the string that start in position offset, is present a known - * vcard file, if yes it return type index, otherwise a negative number - * @param content string where search - * @param offset offset where start to search - * @return index of the field found or a negative number + * Check if the string that starts from the offset position is a valid + * vcard field. + * @param content String to search into. + * @param offset Search offset. + * @return type index of the found field or a negative number if not a valid vcard */ static int8_t findVCardFieldType(const std::string &content, uint16_t offset); /** - * search the end of a vcard field - * @param content string where search - * @param offset offset where start to search + * Return the lenght of a vcard field. + * @param Content string to search into. + * @param Offset search offset. * @return field length - * @par this function search the first sEndVCardTag appearance + * @par This function searches the first sEndVCardTag appearance. */ static uint16_t findVCardFieldDataLenght(const std::string &content, uint16_t offset);