Construct a NDEF Message. More...
#include <MessageBuilder.h>
Data Structures | |
| struct | PayloadBuilder |
| Build a record payload. More... | |
Public Member Functions | |
| MessageBuilder (const Span< uint8_t > &buffer) | |
| Create a new MessageBuilder that can be used to construct valid NDEF messages. More... | |
| bool | append_record (const RecordType &type, const RecordPayload &payload=RecordPayload(), bool is_last_record=false) |
| Append a new record to the message being built. More... | |
| bool | append_record (const RecordType &type, const PayloadBuilder &builder, bool is_last_record=false) |
| Append a new record to the message being built. More... | |
| bool | append_record (const Record &record, const PayloadBuilder *builder=NULL) |
| Append a new record to the message being built. More... | |
| void | reset () |
| Reset the builder state. More... | |
| void | reset (const Span< uint8_t > &buffer) |
| Reset the builder state and assign a new buffer to it. More... | |
| bool | is_message_complete () const |
| Return true if the message stored is complete and false otherwise. More... | |
| 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 not complete. More... | |
Static Public Member Functions | |
| static size_t | compute_record_size (const Record &record, const PayloadBuilder *builder=NULL) |
| Compute the size of a record. More... | |
Construct a NDEF Message.
Definition at line 37 of file MessageBuilder.h.
| MessageBuilder | ( | const Span< uint8_t > & | buffer | ) |
Create a new MessageBuilder that can be used to construct valid NDEF messages.
| buffer | The data buffer that will contain the NDEF message. |
| bool append_record | ( | const RecordType & | type, |
| const RecordPayload & | payload = RecordPayload(), |
||
| bool | is_last_record = false |
||
| ) |
Append a new record to the message being built.
| type | The type of the record to insert. |
| payload | The payload of the record (optional). |
| is_last_record | true if the record to insert is the last record of the payload or false otherwise. |
| bool append_record | ( | const RecordType & | type, |
| const PayloadBuilder & | builder, | ||
| bool | is_last_record = false |
||
| ) |
Append a new record to the message being built.
| type | The type of the record to insert. |
| builder | The builder of the payload. |
| is_last_record | true if the record to insert is the last record of the payload or false otherwise. |
| bool append_record | ( | const Record & | record, |
| const PayloadBuilder * | builder = NULL |
||
| ) |
Append a new record to the message being built.
| record | The record to insert. |
| builder | The builder that will construct the payload. |
|
static |
Compute the size of a record.
| record | The record used to compute the size. |
| builder | The payload builder if any. |
| 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 not complete.
| bool is_message_complete | ( | ) | const |
Return true if the message stored is complete and false otherwise.
| void reset | ( | ) |
Reset the builder state.
| void reset | ( | const Span< uint8_t > & | buffer | ) |
Reset the builder state and assign a new buffer to it.