mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Bug fix of NFC message & records becoming inaccessible in on_tag lambdas (#2309)
This commit is contained in:
parent
5a90b83f63
commit
103ba4c696
2 changed files with 4 additions and 4 deletions
|
@ -22,7 +22,7 @@ class NdefMessage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::unique_ptr<NdefRecord>> &get_records() { return this->records_; };
|
const std::vector<std::shared_ptr<NdefRecord>> &get_records() { return this->records_; };
|
||||||
|
|
||||||
bool add_record(std::unique_ptr<NdefRecord> record);
|
bool add_record(std::unique_ptr<NdefRecord> record);
|
||||||
bool add_text_record(const std::string &text);
|
bool add_text_record(const std::string &text);
|
||||||
|
@ -32,7 +32,7 @@ class NdefMessage {
|
||||||
std::vector<uint8_t> encode();
|
std::vector<uint8_t> encode();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::unique_ptr<NdefRecord>> records_;
|
std::vector<std::shared_ptr<NdefRecord>> records_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nfc
|
} // namespace nfc
|
||||||
|
|
|
@ -43,13 +43,13 @@ class NfcTag {
|
||||||
std::vector<uint8_t> &get_uid() { return this->uid_; };
|
std::vector<uint8_t> &get_uid() { return this->uid_; };
|
||||||
const std::string &get_tag_type() { return this->tag_type_; };
|
const std::string &get_tag_type() { return this->tag_type_; };
|
||||||
bool has_ndef_message() { return this->ndef_message_ != nullptr; };
|
bool has_ndef_message() { return this->ndef_message_ != nullptr; };
|
||||||
const std::unique_ptr<NdefMessage> &get_ndef_message() { return this->ndef_message_; };
|
const std::shared_ptr<NdefMessage> &get_ndef_message() { return this->ndef_message_; };
|
||||||
void set_ndef_message(std::unique_ptr<NdefMessage> ndef_message) { this->ndef_message_ = std::move(ndef_message); };
|
void set_ndef_message(std::unique_ptr<NdefMessage> ndef_message) { this->ndef_message_ = std::move(ndef_message); };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<uint8_t> uid_;
|
std::vector<uint8_t> uid_;
|
||||||
std::string tag_type_;
|
std::string tag_type_;
|
||||||
std::unique_ptr<NdefMessage> ndef_message_;
|
std::shared_ptr<NdefMessage> ndef_message_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nfc
|
} // namespace nfc
|
||||||
|
|
Loading…
Reference in a new issue