ESPHome 2026.2.1
Loading...
Searching...
No Matches
ble_text_sensor.h
Go to the documentation of this file.
1#pragma once
2
7
8#ifdef USE_ESP32
9#include <esp_gattc_api.h>
10
11namespace esphome::ble_client {
12
14
16 public:
17 void loop() override;
18 void update() 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 void dump_config() override;
22 void set_service_uuid16(uint16_t uuid) { this->service_uuid_ = espbt::ESPBTUUID::from_uint16(uuid); }
23 void set_service_uuid32(uint32_t uuid) { this->service_uuid_ = espbt::ESPBTUUID::from_uint32(uuid); }
24 void set_service_uuid128(uint8_t *uuid) { this->service_uuid_ = espbt::ESPBTUUID::from_raw(uuid); }
25 void set_char_uuid16(uint16_t uuid) { this->char_uuid_ = espbt::ESPBTUUID::from_uint16(uuid); }
26 void set_char_uuid32(uint32_t uuid) { this->char_uuid_ = espbt::ESPBTUUID::from_uint32(uuid); }
27 void set_char_uuid128(uint8_t *uuid) { this->char_uuid_ = espbt::ESPBTUUID::from_raw(uuid); }
28 void set_descr_uuid16(uint16_t uuid) { this->descr_uuid_ = espbt::ESPBTUUID::from_uint16(uuid); }
29 void set_descr_uuid32(uint32_t uuid) { this->descr_uuid_ = espbt::ESPBTUUID::from_uint32(uuid); }
30 void set_descr_uuid128(uint8_t *uuid) { this->descr_uuid_ = espbt::ESPBTUUID::from_raw(uuid); }
31 void set_enable_notify(bool notify) { this->notify_ = notify; }
32 uint16_t handle;
33
34 protected:
35 bool notify_;
39};
40
41} // namespace esphome::ble_client
42#endif
This class simplifies creating components that periodically check a state.
Definition component.h:512
void set_service_uuid128(uint8_t *uuid)
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param) override