1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-14 01:02:19 +01:00

Add stop action for ble scanning (#3799)

This commit is contained in:
Jesse Hills
2022-09-14 14:57:45 +12:00
committed by GitHub
parent 49465223a4
commit b3cca5dcb6
4 changed files with 51 additions and 13 deletions

View File

@@ -191,6 +191,7 @@ class ESP32BLETracker : public Component {
void print_bt_device_info(const ESPBTDevice &device);
void start_scan();
void stop_scan();
protected:
/// The FreeRTOS task managing the bluetooth interface.
@@ -243,19 +244,6 @@ class ESP32BLETracker : public Component {
// NOLINTNEXTLINE
extern ESP32BLETracker *global_esp32_ble_tracker;
template<typename... Ts> class ESP32BLEStartScanAction : public Action<Ts...> {
public:
ESP32BLEStartScanAction(ESP32BLETracker *parent) : parent_(parent) {}
TEMPLATABLE_VALUE(bool, continuous)
void play(Ts... x) override {
this->parent_->set_scan_continuous(this->continuous_.value(x...));
this->parent_->start_scan();
}
protected:
ESP32BLETracker *parent_;
};
} // namespace esp32_ble_tracker
} // namespace esphome