ESPHome 2025.10.2
Loading...
Searching...
No Matches
esphome::esp32_ble_server::BLEDescriptor Class Reference

#include <ble_descriptor.h>

Inheritance diagram for esphome::esp32_ble_server::BLEDescriptor:
esphome::esp32_ble_server::BLE2902

Public Member Functions

 BLEDescriptor (ESPBTUUID uuid, uint16_t max_len=100, bool read=true, bool write=true)
 
virtual ~BLEDescriptor ()
 
void do_create (BLECharacteristic *characteristic)
 
ESPBTUUID get_uuid () const
 
void set_value (std::vector< uint8_t > buffer)
 
void set_value (ByteBuffer buffer)
 
void gatts_event_handler (esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
 
bool is_created ()
 
bool is_failed ()
 
void on_write (std::function< void(std::span< const uint8_t >, uint16_t)> &&callback)
 

Protected Types

enum  State : uint8_t { FAILED = 0x00 , INIT , CREATING , CREATED }
 

Protected Attributes

BLECharacteristiccharacteristic_ {nullptr}
 
ESPBTUUID uuid_
 
uint16_t handle_ {0xFFFF}
 
esp_attr_value_t value_ {}
 
std::unique_ptr< std::function< void(std::span< const uint8_t >, uint16_t)> > on_write_callback_
 
esp_gatt_perm_t permissions_ {}
 
enum esphome::esp32_ble_server::BLEDescriptor::State INIT
 

Detailed Description

Definition at line 23 of file ble_descriptor.h.

Member Enumeration Documentation

◆ State

Enumerator
FAILED 
INIT 
CREATING 
CREATED 

Definition at line 55 of file ble_descriptor.h.

Constructor & Destructor Documentation

◆ BLEDescriptor()

esphome::esp32_ble_server::BLEDescriptor::BLEDescriptor ( ESPBTUUID uuid,
uint16_t max_len = 100,
bool read = true,
bool write = true )

Definition at line 17 of file ble_descriptor.cpp.

◆ ~BLEDescriptor()

esphome::esp32_ble_server::BLEDescriptor::~BLEDescriptor ( )
virtual

Definition at line 30 of file ble_descriptor.cpp.

Member Function Documentation

◆ do_create()

void esphome::esp32_ble_server::BLEDescriptor::do_create ( BLECharacteristic * characteristic)

Definition at line 32 of file ble_descriptor.cpp.

◆ gatts_event_handler()

void esphome::esp32_ble_server::BLEDescriptor::gatts_event_handler ( esp_gatts_cb_event_t event,
esp_gatt_if_t gatts_if,
esp_ble_gatts_cb_param_t * param )

Definition at line 60 of file ble_descriptor.cpp.

◆ get_uuid()

ESPBTUUID esphome::esp32_ble_server::BLEDescriptor::get_uuid ( ) const
inline

Definition at line 28 of file ble_descriptor.h.

◆ is_created()

bool esphome::esp32_ble_server::BLEDescriptor::is_created ( )
inline

Definition at line 35 of file ble_descriptor.h.

◆ is_failed()

bool esphome::esp32_ble_server::BLEDescriptor::is_failed ( )
inline

Definition at line 36 of file ble_descriptor.h.

◆ on_write()

void esphome::esp32_ble_server::BLEDescriptor::on_write ( std::function< void(std::span< const uint8_t >, uint16_t)> && callback)
inline

Definition at line 39 of file ble_descriptor.h.

◆ set_value() [1/2]

void esphome::esp32_ble_server::BLEDescriptor::set_value ( ByteBuffer buffer)
inline

Definition at line 31 of file ble_descriptor.h.

◆ set_value() [2/2]

void esphome::esp32_ble_server::BLEDescriptor::set_value ( std::vector< uint8_t > buffer)

Definition at line 49 of file ble_descriptor.cpp.

Field Documentation

◆ characteristic_

BLECharacteristic* esphome::esp32_ble_server::BLEDescriptor::characteristic_ {nullptr}
protected

Definition at line 45 of file ble_descriptor.h.

◆ handle_

uint16_t esphome::esp32_ble_server::BLEDescriptor::handle_ {0xFFFF}
protected

Definition at line 47 of file ble_descriptor.h.

◆ INIT

enum esphome::esp32_ble_server::BLEDescriptor::State esphome::esp32_ble_server::BLEDescriptor::INIT
protected

◆ on_write_callback_

std::unique_ptr<std::function<void(std::span<const uint8_t>, uint16_t)> > esphome::esp32_ble_server::BLEDescriptor::on_write_callback_
protected

Definition at line 51 of file ble_descriptor.h.

◆ permissions_

esp_gatt_perm_t esphome::esp32_ble_server::BLEDescriptor::permissions_ {}
protected

Definition at line 53 of file ble_descriptor.h.

◆ uuid_

ESPBTUUID esphome::esp32_ble_server::BLEDescriptor::uuid_
protected

Definition at line 46 of file ble_descriptor.h.

◆ value_

esp_attr_value_t esphome::esp32_ble_server::BLEDescriptor::value_ {}
protected

Definition at line 49 of file ble_descriptor.h.


The documentation for this class was generated from the following files: