18#ifndef NFC_NDEF_MESSAGEBUILDER_H_
19#define NFC_NDEF_MESSAGEBUILDER_H_
23#include "platform/Span.h"
25#include "nfc/ndef/Record.h"
50 virtual size_t size()
const = 0;
92 bool is_last_record =
false
113 bool is_last_record =
false
174 void append_type_length(
const Record &record);
176 void append_id_length(
const Record &);
177 void append_type(
const Record &);
178 void append_id(
const Record &);
188 bool _message_started;
Construct a NDEF Message.
bool append_record(const RecordType &type, const PayloadBuilder &builder, bool is_last_record=false)
Append a new record to the message being built.
Span< const uint8_t > get_message() const
Return the buffer storing the data if the message is complete or an empty buffer if the message is no...
void reset(const Span< uint8_t > &buffer)
Reset the builder state and assign a new buffer to it.
static size_t compute_record_size(const Record &record, const PayloadBuilder *builder=NULL)
Compute the size of a record.
bool is_message_complete() const
Return true if the message stored is complete and false otherwise.
bool append_record(const RecordType &type, const RecordPayload &payload=RecordPayload(), bool is_last_record=false)
Append a new record to the message being built.
MessageBuilder(const Span< uint8_t > &buffer)
Create a new MessageBuilder that can be used to construct valid NDEF messages.
void reset()
Reset the builder state.
bool append_record(const Record &record, const PayloadBuilder *builder=NULL)
Append a new record to the message being built.
Span< const uint8_t > RecordPayload
Definition of a Record payload.
Nonowning view to a sequence of contiguous elements.
virtual void build(const Span< uint8_t > &buffer) const =0
Build the payload in a buffer that has the required size.
virtual size_t size() const =0
Return the size of the payload built by this object.
~PayloadBuilder()
Non virtual destructor.