mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 17:05:21 +01:00
Added access to ble_scan_result_evt_param as get_scan_result (#2854)
This commit is contained in:
parent
4bb58b2de9
commit
a79c6aa9e0
2 changed files with 4 additions and 0 deletions
|
@ -483,6 +483,7 @@ optional<ESPBLEiBeacon> ESPBLEiBeacon::from_manufacturer_data(const ServiceData
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESPBTDevice::parse_scan_rst(const esp_ble_gap_cb_param_t::ble_scan_result_evt_param ¶m) {
|
void ESPBTDevice::parse_scan_rst(const esp_ble_gap_cb_param_t::ble_scan_result_evt_param ¶m) {
|
||||||
|
this->scan_result_ = param;
|
||||||
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] = param.bda[i];
|
this->address_[i] = param.bda[i];
|
||||||
this->address_type_ = param.ble_addr_type;
|
this->address_type_ = param.ble_addr_type;
|
||||||
|
|
|
@ -97,6 +97,8 @@ class ESPBTDevice {
|
||||||
|
|
||||||
const std::vector<ServiceData> &get_service_datas() const { return service_datas_; }
|
const std::vector<ServiceData> &get_service_datas() const { return service_datas_; }
|
||||||
|
|
||||||
|
const esp_ble_gap_cb_param_t::ble_scan_result_evt_param &get_scan_result() const { return scan_result_; }
|
||||||
|
|
||||||
optional<ESPBLEiBeacon> get_ibeacon() const {
|
optional<ESPBLEiBeacon> get_ibeacon() const {
|
||||||
for (auto &it : this->manufacturer_datas_) {
|
for (auto &it : this->manufacturer_datas_) {
|
||||||
auto res = ESPBLEiBeacon::from_manufacturer_data(it);
|
auto res = ESPBLEiBeacon::from_manufacturer_data(it);
|
||||||
|
@ -121,6 +123,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_{};
|
||||||
|
esp_ble_gap_cb_param_t::ble_scan_result_evt_param scan_result_{};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ESP32BLETracker;
|
class ESP32BLETracker;
|
||||||
|
|
Loading…
Reference in a new issue