ESPHome  2024.12.2
ble_binary_output.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 #ifdef USE_ESP32
9 #include <esp_gattc_api.h>
10 namespace esphome {
11 namespace ble_client {
12 
14 
16  public:
17  void dump_config() override;
18  void loop() override {}
19  float get_setup_priority() const override { return setup_priority::DATA; }
20  void set_service_uuid16(uint16_t uuid) { this->service_uuid_ = espbt::ESPBTUUID::from_uint16(uuid); }
21  void set_service_uuid32(uint32_t uuid) { this->service_uuid_ = espbt::ESPBTUUID::from_uint32(uuid); }
22  void set_service_uuid128(uint8_t *uuid) { this->service_uuid_ = espbt::ESPBTUUID::from_raw(uuid); }
23  void set_char_uuid16(uint16_t uuid) { this->char_uuid_ = espbt::ESPBTUUID::from_uint16(uuid); }
24  void set_char_uuid32(uint32_t uuid) { this->char_uuid_ = espbt::ESPBTUUID::from_uint32(uuid); }
25  void set_char_uuid128(uint8_t *uuid) { this->char_uuid_ = espbt::ESPBTUUID::from_raw(uuid); }
26  void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
27  esp_ble_gattc_cb_param_t *param) override;
28  void set_require_response(bool response) { this->require_response_ = response; }
29 
30  protected:
31  void write_state(bool state) override;
35  uint16_t char_handle_{};
36  esp_gatt_char_prop_t char_props_{};
37  esp_gatt_write_type_t write_type_{};
38 };
39 
40 } // namespace ble_client
41 } // namespace esphome
42 
43 #endif
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
void write_state(bool state) override
static ESPBTUUID from_uint32(uint32_t uuid)
Definition: ble_uuid.cpp:22
static ESPBTUUID from_uint16(uint16_t uuid)
Definition: ble_uuid.cpp:16
float get_setup_priority() const override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
static ESPBTUUID from_raw(const uint8_t *data)
Definition: ble_uuid.cpp:28
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param) override
bool state
Definition: fan.h:34