5static const char *
const TAG =
"nfc.helpers";
10 if (!
tag.has_ndef_message()) {
14 auto records =
message->get_records();
15 for (
const auto &record : records) {
16 std::string payload = record->get_payload();
17 size_t pos = payload.find(HA_TAG_ID_PREFIX);
18 if (
pos != std::string::npos) {
19 return payload.substr(
pos +
sizeof(HA_TAG_ID_PREFIX) - 1);
26 static const char ALPHANUM[] =
"0123456789abcdef";
27 std::string uri = HA_TAG_ID_PREFIX;
28 for (
int i = 0; i < 8; i++) {
32 for (
int j = 0; j < 3; j++) {
33 for (
int i = 0; i < 4; i++) {
38 for (
int i = 0; i < 12; i++) {
41 ESP_LOGD(TAG,
"Payload to be written: %s", uri.c_str());
const LogString * message
std::string get_ha_tag_ndef(NfcTag &tag)
std::string get_random_ha_tag_ndef()
bool has_ha_tag_ndef(NfcTag &tag)
uint32_t random_uint32()
Return a random 32-bit unsigned integer.