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

RecordAAR Class Reference

Create a Record that can start an application in an Android mobile. More...

#include <RecordAAR.h>

Inherits NDefLib::Record.

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

 RecordAAR (const std::string &packageName)
 Build a new record.
virtual RecordType_t get_type () const
 Get the record type.
const std::string & get_package () const
 Get the package inside this record.
void set_package (const std::string &package)
 Change the package name of this record.
virtual uint16_t write (uint8_t *buffer)
 Write the record content into a buffer.
bool operator== (const RecordAAR &other) const
 compare two objects
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.
const RecordHeaderget_header () const
 Get the record header.
virtual uint16_t get_byte_length ()
 Number of bytes needed to store this record.

Static Public Member Functions

static RecordAARparse (const RecordHeader &header, const uint8_t *const buffer)
 Create an RecordAAR reading the data from the buffer.

Detailed Description

Create a Record that can start an application in an Android mobile.

The package data are copied inside the class.

Definition at line 51 of file RecordAAR.h.


Member Enumeration Documentation

enum RecordType_t [inherited]

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.


Constructor & Destructor Documentation

RecordAAR ( const std::string &  packageName ) [explicit]

Build a new record.

Parameters:
packageNamePackage of the application to start

Definition at line 45 of file RecordAAR.cpp.


Member Function Documentation

virtual uint16_t get_byte_length (  ) [virtual, inherited]

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 [inherited]

Get the record header.

Returns:
record header

Definition at line 132 of file Record.h.

const std::string& get_package (  ) const

Get the package inside this record.

Returns:
get the package inside this record

Definition at line 82 of file RecordAAR.h.

virtual RecordType_t get_type (  ) const [virtual]

Get the record type.

Returns:
TYPE_AAR

Reimplemented from Record.

Definition at line 74 of file RecordAAR.h.

bool is_first_record (  ) const [inherited]

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 [inherited]

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 [inherited]

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.

bool operator== ( const RecordAAR other ) const

compare two objects

Returns:
true if the records have the same package name

Definition at line 102 of file RecordAAR.h.

RecordAAR * parse ( const RecordHeader header,
const uint8_t *const  buffer 
) [static]

Create an RecordAAR reading the data from the buffer.

Parameters:
headerRecord header.
bufferBuffer to read the data from.
Returns:
an object of type recordAAR or NULL
User is in charge of freeing the pointer returned by this function.

Definition at line 63 of file RecordAAR.cpp.

void set_as_first_record (  ) [inherited]

Set the record as the first record in the message.

Definition at line 75 of file Record.h.

void set_as_last_record (  ) [inherited]

Set the record as the last record in the message.

Definition at line 82 of file Record.h.

void set_as_middle_record (  ) [inherited]

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

Definition at line 105 of file Record.h.

void set_package ( const std::string &  package )

Change the package name of this record.

Parameters:
packagenew package

Definition at line 90 of file RecordAAR.h.

uint16_t write ( uint8_t *  buffer ) [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

Implements Record.

Definition at line 53 of file RecordAAR.cpp.