18 #include <esp_gap_ble_api.h> 19 #include <esp_gattc_api.h> 20 #include <esp_gatts_api.h> 57 virtual void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) = 0;
62 virtual void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
63 esp_ble_gattc_cb_param_t *param) = 0;
68 virtual void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if,
69 esp_ble_gatts_cb_param_t *param) = 0;
74 virtual void ble_before_disabled_event_handler() = 0;
82 this->advertising_cycle_time_ = advertising_cycle_time;
89 void setup()
override;
91 void dump_config()
override;
92 float get_setup_priority()
const override;
95 void advertising_start();
96 void advertising_set_service_data(
const std::vector<uint8_t> &data);
97 void advertising_set_manufacturer_data(
const std::vector<uint8_t> &data);
98 void advertising_add_service_uuid(
ESPBTUUID uuid);
99 void advertising_remove_service_uuid(
ESPBTUUID uuid);
100 void advertising_register_raw_advertisement_callback(std::function<
void(
bool)> &&callback);
106 this->ble_status_event_handlers_.push_back(handler);
111 static void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param);
112 static void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param);
113 static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param);
115 void real_gatts_event_handler_(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param);
116 void real_gattc_event_handler_(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param);
117 void real_gap_event_handler_(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param);
120 bool ble_dismantle_();
121 bool ble_pre_setup_();
122 void advertising_init_();
132 esp_ble_io_cap_t io_cap_{ESP_IO_CAP_NONE};
void play(Ts... x) override
uint64_t ble_addr_to_uint64(const esp_bd_addr_t address)
virtual void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)=0
std::vector< GAPEventHandler * > gap_event_handlers_
std::vector< GATTcEventHandler * > gattc_event_handlers_
void set_advertising_cycle_time(uint32_t advertising_cycle_time)
uint32_t get_advertising_cycle_time() const
Queue< BLEEvent > ble_events_
uint32_t advertising_cycle_time_
std::vector< GATTsEventHandler * > gatts_event_handlers_
void register_gatts_event_handler(GATTsEventHandler *handler)
optional< std::string > name_
Base class for all automation conditions.
Nothing has been initialized yet.
void play(Ts... x) override
void register_ble_status_event_handler(BLEStatusEventHandler *handler)
std::vector< BLEStatusEventHandler * > ble_status_event_handlers_
bool check(Ts... x) override
void set_enable_on_boot(bool enable_on_boot)
void register_gap_event_handler(GAPEventHandler *handler)
Implementation of SPI Controller mode.
BLE should be disabled on next loop.
void set_io_capability(IoCapability io_capability)
BLE should be enabled on next loop.
void set_name(const std::string &name)
void register_gattc_event_handler(GATTcEventHandler *handler)
BLEAdvertising * advertising_