mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Restore access to BLEScanResult as get_scan_result (#9148)
This commit is contained in:
		| @@ -522,6 +522,7 @@ optional<ESPBLEiBeacon> ESPBLEiBeacon::from_manufacturer_data(const ServiceData | |||||||
| } | } | ||||||
|  |  | ||||||
| void ESPBTDevice::parse_scan_rst(const BLEScanResult &scan_result) { | void ESPBTDevice::parse_scan_rst(const BLEScanResult &scan_result) { | ||||||
|  |   this->scan_result_ = &scan_result; | ||||||
|   for (uint8_t i = 0; i < ESP_BD_ADDR_LEN; i++) |   for (uint8_t i = 0; i < ESP_BD_ADDR_LEN; i++) | ||||||
|     this->address_[i] = scan_result.bda[i]; |     this->address_[i] = scan_result.bda[i]; | ||||||
|   this->address_type_ = static_cast<esp_ble_addr_type_t>(scan_result.ble_addr_type); |   this->address_type_ = static_cast<esp_ble_addr_type_t>(scan_result.ble_addr_type); | ||||||
|   | |||||||
| @@ -85,6 +85,9 @@ class ESPBTDevice { | |||||||
|  |  | ||||||
|   const std::vector<ServiceData> &get_service_datas() const { return service_datas_; } |   const std::vector<ServiceData> &get_service_datas() const { return service_datas_; } | ||||||
|  |  | ||||||
|  |   // Exposed through a function for use in lambdas | ||||||
|  |   const BLEScanResult &get_scan_result() const { return *scan_result_; } | ||||||
|  |  | ||||||
|   bool resolve_irk(const uint8_t *irk) const; |   bool resolve_irk(const uint8_t *irk) const; | ||||||
|  |  | ||||||
|   optional<ESPBLEiBeacon> get_ibeacon() const { |   optional<ESPBLEiBeacon> get_ibeacon() const { | ||||||
| @@ -111,6 +114,7 @@ class ESPBTDevice { | |||||||
|   std::vector<ESPBTUUID> service_uuids_{}; |   std::vector<ESPBTUUID> service_uuids_{}; | ||||||
|   std::vector<ServiceData> manufacturer_datas_{}; |   std::vector<ServiceData> manufacturer_datas_{}; | ||||||
|   std::vector<ServiceData> service_datas_{}; |   std::vector<ServiceData> service_datas_{}; | ||||||
|  |   const BLEScanResult *scan_result_{nullptr}; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| class ESP32BLETracker; | class ESP32BLETracker; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user