ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
esphome::esp32_ble::BLEAdvertising Class Reference

#include <ble_advertising.h>

Public Member Functions

 BLEAdvertising (uint32_t advertising_cycle_time)
 
void loop ()
 
void add_service_uuid (ESPBTUUID uuid)
 
void remove_service_uuid (ESPBTUUID uuid)
 
void set_manufacturer_data (const std::vector< uint8_t > &data)
 
void set_appearance (uint16_t appearance)
 
void set_service_data (const std::vector< uint8_t > &data)
 
void set_service_data (std::span< const uint8_t > data)
 
void set_include_name (bool include_name)
 
void set_priority_uuid (ESPBTUUID uuid)
 Give uuid and the service data the advertising packet; the rest moves to the scan response.
 
void clear_priority_uuid ()
 
void register_raw_advertisement_callback (std::function< void(bool)> &&callback)
 
void start ()
 
void stop ()
 
void request_start ()
 Send from the next loop(): a burst of refreshes becomes one send instead of flooding the Bluetooth task queue.
 
void cancel_start ()
 

Protected Member Functions

esp_err_t services_advertisement_ ()
 

Protected Attributes

esp_ble_adv_params_t advertising_params_
 
std::vector< ESPBTUUID > advertising_uuids_
 
std::vector< std::function< void(bool)> > raw_advertisements_callbacks_
 
const uint32_t advertising_cycle_time_
 
uint32_t last_advertisement_time_ {0}
 
std::array< uint8_t, MAX_DATA_LEN > manufacturer_data_
 
std::array< uint8_t, MAX_DATA_LEN > service_data_
 
ESPBTUUID priority_uuid_
 
uint16_t appearance_ {0}
 
int8_t current_adv_index_ {-1}
 
uint8_t manufacturer_data_len_ {0}
 
uint8_t service_data_len_ {0}
 
bool include_name_in_adv_ {false}
 
bool start_pending_ {false}
 

Static Protected Attributes

static constexpr size_t MAX_DATA_LEN = 29
 

Detailed Description

Definition at line 18 of file ble_advertising.h.

Constructor & Destructor Documentation

◆ BLEAdvertising()

esphome::esp32_ble::BLEAdvertising::BLEAdvertising ( uint32_t advertising_cycle_time)

Definition at line 40 of file ble_advertising.cpp.

Member Function Documentation

◆ add_service_uuid()

void esphome::esp32_ble::BLEAdvertising::add_service_uuid ( ESPBTUUID uuid)

Definition at line 50 of file ble_advertising.cpp.

◆ cancel_start()

void esphome::esp32_ble::BLEAdvertising::cancel_start ( )
inline

Definition at line 40 of file ble_advertising.h.

◆ clear_priority_uuid()

void esphome::esp32_ble::BLEAdvertising::clear_priority_uuid ( )
inline

Definition at line 33 of file ble_advertising.h.

◆ loop()

void esphome::esp32_ble::BLEAdvertising::loop ( )

Definition at line 127 of file ble_advertising.cpp.

◆ register_raw_advertisement_callback()

void esphome::esp32_ble::BLEAdvertising::register_raw_advertisement_callback ( std::function< void(bool)> && callback)

Definition at line 148 of file ble_advertising.cpp.

◆ remove_service_uuid()

void esphome::esp32_ble::BLEAdvertising::remove_service_uuid ( ESPBTUUID uuid)

Definition at line 51 of file ble_advertising.cpp.

◆ request_start()

void esphome::esp32_ble::BLEAdvertising::request_start ( )
inline

Send from the next loop(): a burst of refreshes becomes one send instead of flooding the Bluetooth task queue.

Definition at line 39 of file ble_advertising.h.

◆ services_advertisement_()

esp_err_t esphome::esp32_ble::BLEAdvertising::services_advertisement_ ( )
protected

Definition at line 72 of file ble_advertising.cpp.

◆ set_appearance()

void esphome::esp32_ble::BLEAdvertising::set_appearance ( uint16_t appearance)
inline

Definition at line 27 of file ble_advertising.h.

◆ set_include_name()

void esphome::esp32_ble::BLEAdvertising::set_include_name ( bool include_name)
inline

Definition at line 30 of file ble_advertising.h.

◆ set_manufacturer_data()

void esphome::esp32_ble::BLEAdvertising::set_manufacturer_data ( const std::vector< uint8_t > & data)

Definition at line 66 of file ble_advertising.cpp.

◆ set_priority_uuid()

void esphome::esp32_ble::BLEAdvertising::set_priority_uuid ( ESPBTUUID uuid)
inline

Give uuid and the service data the advertising packet; the rest moves to the scan response.

Definition at line 32 of file ble_advertising.h.

◆ set_service_data() [1/2]

void esphome::esp32_ble::BLEAdvertising::set_service_data ( const std::vector< uint8_t > & data)

Definition at line 62 of file ble_advertising.cpp.

◆ set_service_data() [2/2]

void esphome::esp32_ble::BLEAdvertising::set_service_data ( std::span< const uint8_t > data)

Definition at line 56 of file ble_advertising.cpp.

◆ start()

void esphome::esp32_ble::BLEAdvertising::start ( )

Definition at line 107 of file ble_advertising.cpp.

◆ stop()

void esphome::esp32_ble::BLEAdvertising::stop ( )

Definition at line 115 of file ble_advertising.cpp.

Field Documentation

◆ advertising_cycle_time_

const uint32_t esphome::esp32_ble::BLEAdvertising::advertising_cycle_time_
protected

Definition at line 53 of file ble_advertising.h.

◆ advertising_params_

esp_ble_adv_params_t esphome::esp32_ble::BLEAdvertising::advertising_params_
protected

Definition at line 48 of file ble_advertising.h.

◆ advertising_uuids_

std::vector<ESPBTUUID> esphome::esp32_ble::BLEAdvertising::advertising_uuids_
protected

Definition at line 49 of file ble_advertising.h.

◆ appearance_

uint16_t esphome::esp32_ble::BLEAdvertising::appearance_ {0}
protected

Definition at line 58 of file ble_advertising.h.

◆ current_adv_index_

int8_t esphome::esp32_ble::BLEAdvertising::current_adv_index_ {-1}
protected

Definition at line 59 of file ble_advertising.h.

◆ include_name_in_adv_

bool esphome::esp32_ble::BLEAdvertising::include_name_in_adv_ {false}
protected

Definition at line 62 of file ble_advertising.h.

◆ last_advertisement_time_

uint32_t esphome::esp32_ble::BLEAdvertising::last_advertisement_time_ {0}
protected

Definition at line 54 of file ble_advertising.h.

◆ manufacturer_data_

std::array<uint8_t, MAX_DATA_LEN> esphome::esp32_ble::BLEAdvertising::manufacturer_data_
protected

Definition at line 55 of file ble_advertising.h.

◆ manufacturer_data_len_

uint8_t esphome::esp32_ble::BLEAdvertising::manufacturer_data_len_ {0}
protected

Definition at line 60 of file ble_advertising.h.

◆ MAX_DATA_LEN

size_t esphome::esp32_ble::BLEAdvertising::MAX_DATA_LEN = 29
staticconstexprprotected

Definition at line 44 of file ble_advertising.h.

◆ priority_uuid_

ESPBTUUID esphome::esp32_ble::BLEAdvertising::priority_uuid_
protected

Definition at line 57 of file ble_advertising.h.

◆ raw_advertisements_callbacks_

std::vector<std::function<void(bool)> > esphome::esp32_ble::BLEAdvertising::raw_advertisements_callbacks_
protected

Definition at line 51 of file ble_advertising.h.

◆ service_data_

std::array<uint8_t, MAX_DATA_LEN> esphome::esp32_ble::BLEAdvertising::service_data_
protected

Definition at line 56 of file ble_advertising.h.

◆ service_data_len_

uint8_t esphome::esp32_ble::BLEAdvertising::service_data_len_ {0}
protected

Definition at line 61 of file ble_advertising.h.

◆ start_pending_

bool esphome::esp32_ble::BLEAdvertising::start_pending_ {false}
protected

Definition at line 63 of file ble_advertising.h.


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