|
M5Unit-NFC 0.0.3 git rev:59f5362
|
#include <ndef_record.hpp>
Public Member Functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Record (const TNF tnf) noexcept | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uint32_t | required () const | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Size required for encoding. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uint32_t | encode (uint8_t *buf, const uint32_t blen) const | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Encode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uint32_t | decode (const uint8_t *buf, const uint32_t blen) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Decode. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void | clear () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Clear. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void | dump () const | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dump record for debug. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Attribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Attribute & | attribute () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const Attribute & | attribute () const | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TNF | tnf () const | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
If TNF is TNF::Media, type is MIME type string e.g. "text/plain" , "image/png"... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const char * | type () const | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void | setType (const char *s) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Identifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uint32_t | identifierSize () const | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Gets the identifier size. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const uint8_t * | identifier () const | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Gets the identifier pointer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void | setIdentifier (const uint8_t *id, const uint32_t len) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Set the identifier. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void | clearIdentifier () | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Clear the identifier. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Payload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::string | payloadAsString () const | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Obtain the payload as a string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uint32_t | payloadSize () const | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Gets the payload size. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const uint8_t * | payload () const | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Gets the payload pointer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void | setPayload (const uint8_t *data, const uint32_t len) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Set the payload data. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Payload helper for TNF::Wellknown | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool | setTextPayload (const char *str, const char *lang) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Set text to the payload. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool | setURIPayload (const char *uri, URIProtocol protocol) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Set URI to the payload. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Protected Member Functions | |
| bool | apply_nested_message () |
| void | set_text_payload (const char *str, const char *lang) |
| void | set_uri_payload (const char *uri, URIProtocol protocol) |
Friends | |
| bool | operator== (const Record &a, const Record &b) |
| Equal? | |
NDEF Record.
| uint32_t m5::nfc::ndef::Record::decode | ( | const uint8_t * | buf, |
| const uint32_t | blen ) |
Decode.
| buf | Pointer of the NDEF Record |
| blen | Buffer length |
| > | 0 Decoded length |
| == | 0 Error |
| uint32_t m5::nfc::ndef::Record::encode | ( | uint8_t * | buf, |
| const uint32_t | blen ) const |
Encode.
| [out] | buf | Buffer |
| blen | Buffer size |
| > | 0 Encoded length |
| == | 0 Error |
|
inline |
Set the identifier.
| id | Pointer of the identifier |
| len | identifier length |
|
inline |
Set the payload data.
| data | Pointer of the data |
| len | data length |
| bool m5::nfc::ndef::Record::setTextPayload | ( | const char * | str, |
| const char * | lang ) |
Set text to the payload.
| str | String as UTF-8 |
| lang | ISO/IANA language code. e.g. "en" |
| bool m5::nfc::ndef::Record::setURIPayload | ( | const char * | uri, |
| URIProtocol | protocol ) |
Set URI to the payload.
| uri | URI full text e.g. https://www.example.com |
| protocol | URIProtocol |