From 756c6721e9372667df7466570e170d59b69b1b11 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 27 Sep 2021 11:11:27 +1300 Subject: [PATCH] Fix NDEF URI casing (#2397) --- esphome/components/nfc/ndef_record_uri.cpp | 6 +++--- esphome/components/nfc/ndef_record_uri.h | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/esphome/components/nfc/ndef_record_uri.cpp b/esphome/components/nfc/ndef_record_uri.cpp index 8fd043a1de..9064f04f29 100644 --- a/esphome/components/nfc/ndef_record_uri.cpp +++ b/esphome/components/nfc/ndef_record_uri.cpp @@ -21,7 +21,7 @@ NdefRecordUri::NdefRecordUri(const std::vector &payload) { this->tnf_ = TNF_WELL_KNOWN; this->type_ = "U"; - this->set_URI(uri); + this->set_uri(uri); } std::vector NdefRecordUri::get_encoded_payload() { @@ -31,7 +31,7 @@ std::vector NdefRecordUri::get_encoded_payload() { uint8_t payload_prefix_length = 0x00; for (uint8_t i = 1; i < PAYLOAD_IDENTIFIERS_COUNT; i++) { std::string prefix = PAYLOAD_IDENTIFIERS[i]; - if (this->URI_.substr(0, prefix.length()).find(prefix) != std::string::npos) { + if (this->uri_.substr(0, prefix.length()).find(prefix) != std::string::npos) { payload_prefix = i; payload_prefix_length = prefix.length(); break; @@ -40,7 +40,7 @@ std::vector NdefRecordUri::get_encoded_payload() { data.push_back(payload_prefix); - data.insert(data.end(), this->URI_.begin() + payload_prefix_length, this->URI_.end()); + data.insert(data.end(), this->uri_.begin() + payload_prefix_length, this->uri_.end()); return data; } diff --git a/esphome/components/nfc/ndef_record_uri.h b/esphome/components/nfc/ndef_record_uri.h index 75f9e19ee0..4c21724c5c 100644 --- a/esphome/components/nfc/ndef_record_uri.h +++ b/esphome/components/nfc/ndef_record_uri.h @@ -49,27 +49,27 @@ class NdefRecordUri : public NdefRecord { public: NdefRecordUri(){}; NdefRecordUri(const std::vector &payload); - NdefRecordUri(const std::string &URI) { + NdefRecordUri(const std::string &uri) { this->tnf_ = TNF_WELL_KNOWN; this->type_ = "U"; - this->URI_ = URI; + this->uri_ = uri; }; - NdefRecordUri(const std::string &URI, const std::string &id) { + NdefRecordUri(const std::string &uri, const std::string &id) { this->tnf_ = TNF_WELL_KNOWN; this->type_ = "U"; - this->URI_ = URI; + this->uri_ = uri; this->id_ = id; }; NdefRecordUri(const NdefRecordUri &) = default; std::unique_ptr clone() const override { return make_unique(*this); }; - void set_URI(const std::string &URI) { this->URI_ = URI; }; + void set_uri(const std::string &uri) { this->uri_ = uri; }; std::vector get_encoded_payload() override; - const std::string &get_payload() const override { return this->URI_; }; + const std::string &get_payload() const override { return this->uri_; }; protected: - std::string URI_; + std::string uri_; }; } // namespace nfc