M5Unit-NFC 0.0.3 git rev:59f5362
Loading...
Searching...
No Matches
m5::nfc::ndef::TLV Class Reference

NDEF TLV container. More...

#include <ndef_tlv.hpp>

Public Types

using container_type = std::vector<Record>
 

Public Member Functions

 TLV (const Tag t)
 
Tag tag () const
 Tag.
 
bool isTerminatorTLV () const
 Is termibator.
 
bool isMessageTLV () const
 Is Message?
 
bool isNullTLV () const
 Is Null TLV?
 
const container_type & records () const
 Get the records.
 
const std::vector< uint8_t > & payload () const
 Get the payload.
 
std::vector< uint8_t > & payload ()
 Get the payload.
 
uint32_t required () const
 Size required for encoding.
 
bool push_back (const Record &r)
 Push back the record.
 
void pop_back ()
 Removes the last record.
 
uint32_t encode (uint8_t *buf, const uint32_t blen) const
 Encode.
 
uint32_t decode (const uint8_t *buf, const uint32_t len)
 Decode.
 
void clear ()
 Clear internal buffers.
 
void dump ()
 

Static Public Attributes

static const TLV Terminator
 Terminator instance.
 

Detailed Description

NDEF TLV container.

Member Function Documentation

◆ clear()

void m5::nfc::ndef::TLV::clear ( )

Clear internal buffers.

Warning
Keep the tag

◆ decode()

uint32_t m5::nfc::ndef::TLV::decode ( const uint8_t * buf,
const uint32_t len )

Decode.

Parameters
bufPointer of the TLV
lenBuffer length
Return values
>0 Decoded length
==0 Error

◆ encode()

uint32_t m5::nfc::ndef::TLV::encode ( uint8_t * buf,
const uint32_t blen ) const

Encode.

Parameters
[out]bufBuffer
blenBuffer size
Return values
>0 Encoded length
==0 Error

◆ payload() [1/2]

std::vector< uint8_t > & m5::nfc::ndef::TLV::payload ( )
inline

Get the payload.

Precondition
Tag must NOT be Message

◆ payload() [2/2]

const std::vector< uint8_t > & m5::nfc::ndef::TLV::payload ( ) const
inline

Get the payload.

Precondition
Tag must NOT be Message

◆ push_back()

bool m5::nfc::ndef::TLV::push_back ( const Record & r)

Push back the record.

Parameters
rRecord
Returns
True if successful
Note
A copy of the Record is inserted at the end

◆ records()

const container_type & m5::nfc::ndef::TLV::records ( ) const
inline

Get the records.

Precondition
Tag must be Message