ESPHome  2024.11.3
ble_switch.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 #ifdef USE_ESP32
9 #include <esp_gattc_api.h>
10 
11 namespace esphome {
12 namespace ble_client {
13 
15 
16 class BLEClientSwitch : public switch_::Switch, public Component, public BLEClientNode {
17  public:
18  void dump_config() override;
19  void loop() override {}
20  void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
21  esp_ble_gattc_cb_param_t *param) override;
22  float get_setup_priority() const override { return setup_priority::DATA; }
23 
24  protected:
25  void write_state(bool state) override;
26 };
27 
28 } // namespace ble_client
29 } // namespace esphome
30 #endif
Base class for all switches.
Definition: switch.h:39
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param) override
Definition: ble_switch.cpp:17
void write_state(bool state) override
Definition: ble_switch.cpp:12
float get_setup_priority() const override
Definition: ble_switch.h:22
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
bool state
The current reported state of the binary sensor.
Definition: switch.h:53