6 static const char *
const TAG =
"nfc.ndef_record_uri";
10 ESP_LOGE(TAG,
"Record payload too short");
14 uint8_t payload_identifier = payload[0];
16 std::string uri(payload.begin() + 1, payload.end());
18 if (payload_identifier > 0x00 && payload_identifier <= PAYLOAD_IDENTIFIERS_COUNT) {
19 uri.insert(0, PAYLOAD_IDENTIFIERS[payload_identifier]);
22 this->
tnf_ = TNF_WELL_KNOWN;
28 std::vector<uint8_t> data;
30 uint8_t payload_prefix = 0x00;
31 uint8_t payload_prefix_length = 0x00;
32 for (uint8_t i = 1; i < PAYLOAD_IDENTIFIERS_COUNT; i++) {
33 std::string prefix = PAYLOAD_IDENTIFIERS[i];
34 if (this->
uri_.substr(0, prefix.length()).find(prefix) != std::string::npos) {
36 payload_prefix_length = prefix.length();
41 data.push_back(payload_prefix);
43 data.insert(data.end(), this->
uri_.begin() + payload_prefix_length, this->
uri_.end());
std::vector< uint8_t > get_encoded_payload() override
void set_uri(const std::string &uri)
Implementation of SPI Controller mode.