ESPHome  2022.11.3
ble_uuid.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "esphome/core/helpers.h"
4 #include "esphome/core/hal.h"
5 
6 #ifdef USE_ESP32
7 
8 #include <string>
9 #include <esp_bt_defs.h>
10 
11 namespace esphome {
12 namespace esp32_ble {
13 
14 class ESPBTUUID {
15  public:
16  ESPBTUUID();
17 
18  static ESPBTUUID from_uint16(uint16_t uuid);
19 
20  static ESPBTUUID from_uint32(uint32_t uuid);
21 
22  static ESPBTUUID from_raw(const uint8_t *data);
23 
24  static ESPBTUUID from_raw(const std::string &data);
25 
26  static ESPBTUUID from_uuid(esp_bt_uuid_t uuid);
27 
28  ESPBTUUID as_128bit() const;
29 
30  bool contains(uint8_t data1, uint8_t data2) const;
31 
32  bool operator==(const ESPBTUUID &uuid) const;
33  bool operator!=(const ESPBTUUID &uuid) const { return !(*this == uuid); }
34 
35  esp_bt_uuid_t get_uuid();
36 
37  std::string to_string();
38 
39  protected:
40  esp_bt_uuid_t uuid_;
41 };
42 
43 } // namespace esp32_ble
44 } // namespace esphome
45 
46 #endif
bool operator==(const ESPBTUUID &uuid) const
Definition: ble_uuid.cpp:134
static ESPBTUUID from_uuid(esp_bt_uuid_t uuid)
Definition: ble_uuid.cpp:91
static ESPBTUUID from_uint32(uint32_t uuid)
Definition: ble_uuid.cpp:21
static ESPBTUUID from_uint16(uint16_t uuid)
Definition: ble_uuid.cpp:15
bool operator!=(const ESPBTUUID &uuid) const
Definition: ble_uuid.h:33
bool contains(uint8_t data1, uint8_t data2) const
Definition: ble_uuid.cpp:116
Definition: a4988.cpp:4
static ESPBTUUID from_raw(const uint8_t *data)
Definition: ble_uuid.cpp:27
ESPBTUUID as_128bit() const
Definition: ble_uuid.cpp:100