10#ifndef M5_UNIT_UNIFIED_NFC_NDEF_NDEF_TLV_HPP
11#define M5_UNIT_UNIFIED_NFC_NDEF_NDEF_TLV_HPP
29 using container_type = std::vector<Record>;
64 return _tag == Tag::Terminator;
72 return _tag == Tag::Message;
80 return _tag == Tag::Null;
87 inline const container_type&
records()
const
96 inline const std::vector<uint8_t>&
payload()
const
137 uint32_t
encode(uint8_t* buf,
const uint32_t blen)
const;
145 uint32_t
decode(
const uint8_t* buf,
const uint32_t len);
158 container_type _records{};
159 std::vector<uint8_t> _payload{};
NDEF Record.
Definition ndef_record.hpp:166
NDEF TLV container.
Definition ndef_tlv.hpp:27
std::vector< uint8_t > & payload()
Get the payload.
Definition ndef_tlv.hpp:105
bool push_back(const Record &r)
Push back the record.
Definition ndef_tlv.cpp:111
Tag tag() const
Tag.
Definition ndef_tlv.hpp:54
void clear()
Clear internal buffers.
Definition ndef_tlv.cpp:329
void dump()
Dump internal state for debugging.
Definition ndef_tlv.cpp:336
const std::vector< uint8_t > & payload() const
Get the payload.
Definition ndef_tlv.hpp:96
bool isMessageTLV() const
Is Message?
Definition ndef_tlv.hpp:70
static const TLV Terminator
Terminator instance.
Definition ndef_tlv.hpp:32
void pop_back()
Removes the last record.
Definition ndef_tlv.cpp:139
TLV(const Tag t)
Construct with the given Tag.
Definition ndef_tlv.hpp:42
uint32_t required() const
Size required for encoding.
Definition ndef_tlv.cpp:105
bool isNullTLV() const
Is Null TLV?
Definition ndef_tlv.hpp:78
bool isTerminatorTLV() const
Is terminator.
Definition ndef_tlv.hpp:62
~TLV()
Destructor.
Definition ndef_tlv.hpp:46
uint32_t decode(const uint8_t *buf, const uint32_t len)
Decode.
Definition ndef_tlv.cpp:217
uint32_t encode(uint8_t *buf, const uint32_t blen) const
Encode.
Definition ndef_tlv.cpp:160
TLV()
Default ctor (Tag::Null)
Definition ndef_tlv.hpp:35
const container_type & records() const
Get the records.
Definition ndef_tlv.hpp:87
Top level namespace of M5Stack.
Tag
TLV(Tag,Length,Value) tag for type2/5.
Definition ndef.hpp:42