mirror of
https://github.com/esphome/esphome.git
synced 2025-10-14 15:53:48 +01:00
[esp32_improv] Make device name visible to passive BLE scanners (#10918)
This commit is contained in:
@@ -43,7 +43,7 @@ void BLEAdvertising::remove_service_uuid(ESPBTUUID uuid) {
|
||||
this->advertising_uuids_.end());
|
||||
}
|
||||
|
||||
void BLEAdvertising::set_service_data(const std::vector<uint8_t> &data) {
|
||||
void BLEAdvertising::set_service_data(std::span<const uint8_t> data) {
|
||||
delete[] this->advertising_data_.p_service_data;
|
||||
this->advertising_data_.p_service_data = nullptr;
|
||||
this->advertising_data_.service_data_len = data.size();
|
||||
@@ -54,6 +54,10 @@ void BLEAdvertising::set_service_data(const std::vector<uint8_t> &data) {
|
||||
}
|
||||
}
|
||||
|
||||
void BLEAdvertising::set_service_data(const std::vector<uint8_t> &data) {
|
||||
this->set_service_data(std::span<const uint8_t>(data));
|
||||
}
|
||||
|
||||
void BLEAdvertising::set_manufacturer_data(const std::vector<uint8_t> &data) {
|
||||
delete[] this->advertising_data_.p_manufacturer_data;
|
||||
this->advertising_data_.p_manufacturer_data = nullptr;
|
||||
@@ -84,7 +88,7 @@ esp_err_t BLEAdvertising::services_advertisement_() {
|
||||
esp_err_t err;
|
||||
|
||||
this->advertising_data_.set_scan_rsp = false;
|
||||
this->advertising_data_.include_name = !this->scan_response_;
|
||||
this->advertising_data_.include_name = this->include_name_in_adv_ || !this->scan_response_;
|
||||
this->advertising_data_.include_txpower = !this->scan_response_;
|
||||
err = esp_ble_gap_config_adv_data(&this->advertising_data_);
|
||||
if (err != ESP_OK) {
|
||||
|
Reference in New Issue
Block a user