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

RecordHeader Class Reference

RecordHeader Class Reference

Record header class. More...

#include <RecordHeader.h>

Public Types

enum  TypeNameFormat {
  Empty = 0x00, NFC_well_known = 0x01, Mime_media_type = 0x02, Absolute_URI = 0x03,
  NFC_external = 0x04, Unknown = 0x05, Unchanged = 0x06, Reserved = 0x07
}
 

Record type format.

More...
typedef enum
NDefLib::RecordHeader::TypeNameFormat 
TypeNameFormat_t
 Record type format.

Public Member Functions

void set_MB (bool value)
 Set the 'message begin' flag.
bool get_MB () const
 Check the 'message begin' flag.
void set_ME (bool value)
 Set the 'message end' flag.
bool get_ME () const
 Check the 'message end' flag.
void set_CF (bool value)
 Set the 'Chunk' flag.
bool get_CF () const
 Check the 'Chunk' flag value.
void set_SR (bool value)
 Set the 'Short record' flag value.
bool get_SR () const
 Check the 'Short record' flag.
void set_IL (bool value)
 Set the 'ID length' flag.
bool get_IL () const
 Check the 'ID length' flag.
void set_FNT (const TypeNameFormat_t value)
 Set the type name format field.
TypeNameFormat_t get_FNT () const
 Get the record type name.
void set_payload_length (uint32_t length)
 Set the record payload length.
uint32_t get_payload_length () const
 Get the payload length.
void set_type_length (uint8_t size)
 Set the type length.
uint8_t get_type_length () const
 Get the type length.
void set_id_length (uint8_t size)
 Set the id length.
uint8_t get_id_length () const
 Get the id length.
uint16_t get_record_length () const
 Get the number of bytes needed to store this record.
uint8_t write_header (uint8_t *outBuffer) const
 Store the header information in the buffer.
uint16_t load_header (const uint8_t *const buffer)
 Load an header from a buffer.
bool operator== (const RecordHeader &other) const
 Equal operator.

Detailed Description

Record header class.

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

Definition at line 49 of file RecordHeader.h.


Member Typedef Documentation


Member Enumeration Documentation

Record type format.

Enumerator:
Empty 

Empty.

NFC_well_known 

NFC_well_known.

Mime_media_type 

Mime_media_type.

Absolute_URI 

Absolute_URI.

NFC_external 

NFC_external.

Unknown 

Unknown.

Unchanged 

Unchanged.

Reserved 

Reserved.

Definition at line 56 of file RecordHeader.h.


Member Function Documentation

bool get_CF (  ) const

Check the 'Chunk' flag value.

Returns:
true if the record is in the first record chunk or in a middle record chunk of a chunked payload

Definition at line 131 of file RecordHeader.h.

TypeNameFormat_t get_FNT (  ) const

Get the record type name.

Returns:
type name format of the record

Definition at line 190 of file RecordHeader.h.

uint8_t get_id_length (  ) const

Get the id length.

Returns:
id length

Definition at line 245 of file RecordHeader.h.

bool get_IL (  ) const

Check the 'ID length' flag.

Parameters:
valueTrue if 'ID length' is set.

Definition at line 171 of file RecordHeader.h.

bool get_MB (  ) const

Check the 'message begin' flag.

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

Definition at line 89 of file RecordHeader.h.

bool get_ME (  ) const

Check the 'message end' flag.

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

Definition at line 109 of file RecordHeader.h.

uint32_t get_payload_length (  ) const

Get the payload length.

Returns:
payload length

Definition at line 208 of file RecordHeader.h.

uint16_t get_record_length (  ) const

Get the number of bytes needed to store this record.

Returns:
3 or 6

Definition at line 253 of file RecordHeader.h.

bool get_SR (  ) const

Check the 'Short record' flag.

Returns:
true if the short range header format is set

Definition at line 151 of file RecordHeader.h.

uint8_t get_type_length (  ) const

Get the type length.

Returns:
type length

Definition at line 224 of file RecordHeader.h.

uint16_t load_header ( const uint8_t *const   buffer )

Load an header from a buffer.

Parameters:
bufferBuffer to load the header from.
Returns:
number of read bytes

Definition at line 291 of file RecordHeader.h.

bool operator== ( const RecordHeader other ) const

Equal operator.

Parameters:
otherOther object to compare with.
Returns:
true if the two record headers are equal

Definition at line 318 of file RecordHeader.h.

void set_CF ( bool  value )

Set the 'Chunk' flag.

Parameters:
valueTrue if the record is in the first record chunk or in a middle record chunk of a chunked payload.

Definition at line 118 of file RecordHeader.h.

void set_FNT ( const TypeNameFormat_t  value )

Set the type name format field.

Parameters:
valueRecord type name format.

Definition at line 179 of file RecordHeader.h.

void set_id_length ( uint8_t  size )

Set the id length.

Parameters:
size.

Definition at line 232 of file RecordHeader.h.

void set_IL ( bool  value )

Set the 'ID length' flag.

Parameters:
valueTrue if the 'ID length' value is used.

Definition at line 159 of file RecordHeader.h.

void set_MB ( bool  value )

Set the 'message begin' flag.

Parameters:
valueTrue if the record is the first within the message.

Definition at line 77 of file RecordHeader.h.

void set_ME ( bool  value )

Set the 'message end' flag.

Parameters:
valueTrue if it is the last record in the message.

Definition at line 97 of file RecordHeader.h.

void set_payload_length ( uint32_t  length )

Set the record payload length.

This function will update the SR field as needed.
Parameters:
lengthpayload length

Definition at line 199 of file RecordHeader.h.

void set_SR ( bool  value )

Set the 'Short record' flag value.

Parameters:
valueTrue if the record size can be encoded with 8 bits.

Definition at line 139 of file RecordHeader.h.

void set_type_length ( uint8_t  size )

Set the type length.

Parameters:
size.

Definition at line 216 of file RecordHeader.h.

uint8_t write_header ( uint8_t *  outBuffer ) const

Store the header information in the buffer.

Parameters:
[out]outBufferBuffer to write the header into.
Returns:
number of write bytes

Definition at line 262 of file RecordHeader.h.