Construct a NDEF Message.
More...
#include <MessageBuilder.h>
Construct a NDEF Message.
Definition at line 38 of file MessageBuilder.h.
◆ MessageBuilder()
Create a new MessageBuilder that can be used to construct valid NDEF messages.
- Parameters
-
buffer | The data buffer that will contain the NDEF message. |
◆ append_record() [1/3]
Append a new record to the message being built.
- Parameters
-
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. |
- Returns
- true if the record has been successfully inserted or false otherwise.
- Note
- insertion can fail if the message is already complete or if the size remaining in the message buffer is not large enough to makes the record inserted fit.
◆ append_record() [2/3]
Append a new record to the message being built.
- Parameters
-
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. |
- Returns
- true if the record has been successfully inserted or false otherwise.
- Note
- insertion can fail if the message is already complete or if the size remaining in the message buffer is not large enough to makes the record inserted fit.
◆ append_record() [3/3]
Append a new record to the message being built.
- Parameters
-
record | The record to insert. |
builder | The builder that will construct the payload. |
- Returns
- true if the record has been successfully inserted or false otherwise.
- Note
- insertion can fail if the message is already complete or if the size remaining in the message buffer is not large enough to makes the record inserted fit.
◆ compute_record_size()
Compute the size of a record.
- Parameters
-
record | The record used to compute the size. |
builder | The payload builder if any. |
- Returns
- The size of the payload for the record in input.
◆ reset() [1/2]
◆ reset() [2/2]
void reset |
( |
const Span< uint8_t > & |
buffer | ) |
|
Reset the builder state and assign a new buffer to it.
◆ is_message_complete()
bool is_message_complete |
( |
| ) |
const |
Return true if the message stored is complete and false otherwise.
- Returns
- true if the message is complete or false.
◆ get_message()
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.
- Returns
- The message built.