ESPHome  2022.9.1
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(uint8_t *data, uint16_t size);
24 
25  void start();
26  void stop();
27 
28  protected:
30  esp_ble_adv_data_t advertising_data_;
31  esp_ble_adv_data_t scan_response_data_;
32  esp_ble_adv_params_t advertising_params_;
33  std::vector<ESPBTUUID> advertising_uuids_;
34 };
35 
36 } // namespace esp32_ble
37 } // namespace esphome
38 
39 #endif
void set_min_preferred_interval(uint16_t interval)
esp_ble_adv_params_t advertising_params_
void remove_service_uuid(ESPBTUUID uuid)
esp_ble_adv_data_t scan_response_data_
void set_manufacturer_data(uint8_t *data, uint16_t size)
Definition: a4988.cpp:4
std::vector< ESPBTUUID > advertising_uuids_
void set_scan_response(bool scan_response)