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>;
37 explicit TLV(
const Tag t) : _tag{t}
52 return _tag == Tag::Terminator;
57 return _tag == Tag::Message;
62 return _tag == Tag::Null;
68 inline const container_type&
records()
const
76 inline const std::vector<uint8_t>&
payload()
const
110 uint32_t
encode(uint8_t* buf,
const uint32_t blen)
const;
118 uint32_t
decode(
const uint8_t* buf,
const uint32_t len);
130 container_type _records{};
131 std::vector<uint8_t> _payload{};
NDEF Record.
Definition ndef_record.hpp:117
NDEF TLV container.
Definition ndef_tlv.hpp:27
std::vector< uint8_t > & payload()
Get the payload.
Definition ndef_tlv.hpp:84
bool push_back(const Record &r)
Push back the record.
Definition ndef_tlv.cpp:111
Tag tag() const
Tag.
Definition ndef_tlv.hpp:45
void clear()
Clear internal buffers.
Definition ndef_tlv.cpp:328
const std::vector< uint8_t > & payload() const
Get the payload.
Definition ndef_tlv.hpp:76
bool isMessageTLV() const
Is Message?
Definition ndef_tlv.hpp:55
static const TLV Terminator
Terminator instance.
Definition ndef_tlv.hpp:32
void pop_back()
Removes the last record.
Definition ndef_tlv.cpp:139
uint32_t required() const
Size required for encoding.
Definition ndef_tlv.cpp:105
bool isNullTLV() const
Is Null TLV?
Definition ndef_tlv.hpp:60
bool isTerminatorTLV() const
Is termibator.
Definition ndef_tlv.hpp:50
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
const container_type & records() const
Get the records.
Definition ndef_tlv.hpp:68
Top level namespace of M5stack.
Tag
TLV(Tag,Length,Value) tag for type2/5.
Definition ndef.hpp:42