mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Fix NDEF URI casing (#2397)
This commit is contained in:
parent
4c390d9f9f
commit
756c6721e9
2 changed files with 10 additions and 10 deletions
|
@ -21,7 +21,7 @@ NdefRecordUri::NdefRecordUri(const std::vector<uint8_t> &payload) {
|
|||
|
||||
this->tnf_ = TNF_WELL_KNOWN;
|
||||
this->type_ = "U";
|
||||
this->set_URI(uri);
|
||||
this->set_uri(uri);
|
||||
}
|
||||
|
||||
std::vector<uint8_t> NdefRecordUri::get_encoded_payload() {
|
||||
|
@ -31,7 +31,7 @@ std::vector<uint8_t> 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<uint8_t> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,27 +49,27 @@ class NdefRecordUri : public NdefRecord {
|
|||
public:
|
||||
NdefRecordUri(){};
|
||||
NdefRecordUri(const std::vector<uint8_t> &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<NdefRecord> clone() const override { return make_unique<NdefRecordUri>(*this); };
|
||||
|
||||
void set_URI(const std::string &URI) { this->URI_ = URI; };
|
||||
void set_uri(const std::string &uri) { this->uri_ = uri; };
|
||||
|
||||
std::vector<uint8_t> 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
|
||||
|
|
Loading…
Reference in a new issue