ST / NDefLib

Dependents:   NFC M2M_2016_STM32 MyongjiElec_capstone1 IDW01M1_Cloud_IBM ... more

Fork of NDefLib by ST Expansion SW Team

Embed: (wiki syntax)

« Back to documentation index

Record Class Reference

Record Class Reference

Base class for a NDefRecord. More...

#include <Record.h>

Inherited by EmptyRecord, RecordAAR, RecordMimeType, RecordText, and RecordURI.

Public Types

enum  RecordType_t {
  TYPE_UNKNOWN, TYPE_TEXT, TYPE_AAR, TYPE_MIME,
  TYPE_URI, TYPE_URI_MAIL, TYPE_URI_SMS, TYPE_URI_GEOLOCATION,
  TYPE_MIME_VCARD, TYPE_WIFI_CONF
}
 

Enum used to identify the record type.

More...

Public Member Functions

void set_as_first_record ()
 Set the record as the first record in the message.
void set_as_last_record ()
 Set the record as the last record in the message.
bool is_last_record () const
 Check if it is the last record in the message.
bool is_first_record () const
 Check if it is the first record in the message.
void set_as_middle_record ()
 Set the record as generic (not the first one and not the last one)
bool is_middle_record () const
 Check if the record is in the middle of a chain.
virtual RecordType_t get_type () const
 Get tag type.
const RecordHeaderget_header () const
 Get the record header.
virtual uint16_t get_byte_length ()
 Number of bytes needed to store this record.
virtual uint16_t write (uint8_t *buffer)=0
 Write the record content into a buffer.

Detailed Description

Base class for a NDefRecord.

See also:
NFC Data Exchange Format (NDEF) Technical Specification NDEF 1.0

Definition at line 50 of file Record.h.


Member Enumeration Documentation

Enum used to identify the record type.

Enumerator:
TYPE_UNKNOWN 

UNKNOWN record.

TYPE_TEXT 

TEXT.

TYPE_AAR 

Android Archive record.

TYPE_MIME 

generic MIME type

TYPE_URI 

generic URI

TYPE_URI_MAIL 

Email URI record.

TYPE_URI_SMS 

SMS URI record.

TYPE_URI_GEOLOCATION 

position URI record

TYPE_MIME_VCARD 

VCard record.

TYPE_WIFI_CONF 

Wifi configuration.

Definition at line 56 of file Record.h.


Member Function Documentation

virtual uint16_t get_byte_length (  ) [virtual]

Number of bytes needed to store this record.

Returns:
size of the header + size of the record content

Reimplemented in RecordURI, RecordVCard, and RecordWifiConf.

Definition at line 140 of file Record.h.

const RecordHeader& get_header (  ) const

Get the record header.

Returns:
record header

Definition at line 132 of file Record.h.

virtual RecordType_t get_type (  ) const [virtual]

Get tag type.

This method should be overridden to return a valid type.
Returns:
tag type

Reimplemented in RecordAAR, RecordGeo, RecordMail, RecordMimeType, RecordSMS, RecordText, RecordURI, RecordVCard, and RecordWifiConf.

Definition at line 123 of file Record.h.

bool is_first_record (  ) const

Check if it is the first record in the message.

Returns:
true if it is the fist record in the message

Definition at line 98 of file Record.h.

bool is_last_record (  ) const

Check if it is the last record in the message.

Returns:
true if it is the last record in the message

Definition at line 90 of file Record.h.

bool is_middle_record (  ) const

Check if the record is in the middle of a chain.

Returns:
true if is not the fist or the last one

Definition at line 114 of file Record.h.

void set_as_first_record (  )

Set the record as the first record in the message.

Definition at line 75 of file Record.h.

void set_as_last_record (  )

Set the record as the last record in the message.

Definition at line 82 of file Record.h.

void set_as_middle_record (  )

Set the record as generic (not the first one and not the last one)

Definition at line 105 of file Record.h.

virtual uint16_t write ( uint8_t *  buffer ) [pure virtual]

Write the record content into a buffer.

Parameters:
[out]bufferbuffer to write the record content into, the buffer size must be almost Record#getByteLength bytes.
Returns:
number of written bytes

Implemented in EmptyRecord, RecordAAR, RecordMimeType, RecordText, RecordVCard, and RecordWifiConf.