ESPHome
2026.1.0-dev
Loading...
Searching...
No Matches
esphome
components
ble_client
switch
ble_switch.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
esphome/components/ble_client/ble_client.h
"
5
#include "
esphome/components/esp32_ble_tracker/esp32_ble_tracker.h
"
6
#include "
esphome/components/switch/switch.h
"
7
8
#ifdef USE_ESP32
9
#include <esp_gattc_api.h>
10
11
namespace
esphome::ble_client
{
12
13
namespace
espbt
=
esphome::esp32_ble_tracker
;
14
15
class
BLEClientSwitch
:
public
switch_::Switch
,
public
Component
,
public
BLEClientNode
{
16
public
:
17
void
dump_config
()
override
;
18
void
loop
()
override
{}
19
void
gattc_event_handler
(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
20
esp_ble_gattc_cb_param_t *param)
override
;
21
22
protected
:
23
void
write_state
(
bool
state
)
override
;
24
};
25
26
}
// namespace esphome::ble_client
27
#endif
ble_client.h
esphome::Component
Definition
component.h:75
esphome::ble_client::BLEClientNode
Definition
ble_client.h:26
esphome::ble_client::BLEClientSwitch
Definition
ble_switch.h:15
esphome::ble_client::BLEClientSwitch::loop
void loop() override
Definition
ble_switch.h:18
esphome::ble_client::BLEClientSwitch::dump_config
void dump_config() override
Definition
ble_switch.cpp:31
esphome::ble_client::BLEClientSwitch::write_state
void write_state(bool state) override
Definition
ble_switch.cpp:11
esphome::ble_client::BLEClientSwitch::gattc_event_handler
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:16
esphome::switch_::Switch
Base class for all switches.
Definition
switch.h:39
esphome::switch_::Switch::state
bool state
The current reported state of the binary sensor.
Definition
switch.h:56
component.h
esp32_ble_tracker.h
esphome::ble_client
Definition
automation.cpp:5
esphome::esp32_ble_tracker
Definition
automation.h:8
switch.h
Generated by
1.12.0