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:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user