ESPHome  2024.5.2
ble_advertising.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
5 #ifdef USE_ESP32
6 
7 #include <esp_gap_ble_api.h>
8 #include <esp_gatts_api.h>
9 
10 namespace esphome {
11 namespace esp32_ble {
12 
13 class ESPBTUUID;
14 
16  public:
18 
19  void add_service_uuid(ESPBTUUID uuid);
20  void remove_service_uuid(ESPBTUUID uuid);
21  void set_scan_response(bool scan_response) { this->scan_response_ = scan_response; }
22  void set_min_preferred_interval(uint16_t interval) { this->advertising_data_.min_interval = interval; }
23  void set_manufacturer_data(const std::vector<uint8_t> &data);
24  void set_service_data(const std::vector<uint8_t> &data);
25 
26  void start();
27  void stop();
28 
29  protected:
31  esp_ble_adv_data_t advertising_data_;
32  esp_ble_adv_data_t scan_response_data_;
33  esp_ble_adv_params_t advertising_params_;
34  std::vector<ESPBTUUID> advertising_uuids_;
35 };
36 
37 } // namespace esp32_ble
38 } // namespace esphome
39 
40 #endif
void set_min_preferred_interval(uint16_t interval)
void set_service_data(const std::vector< uint8_t > &data)
esp_ble_adv_params_t advertising_params_
void set_manufacturer_data(const std::vector< uint8_t > &data)
void remove_service_uuid(ESPBTUUID uuid)
esp_ble_adv_data_t scan_response_data_
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
std::vector< ESPBTUUID > advertising_uuids_
void set_scan_response(bool scan_response)