ESPHome  2024.12.2
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  static ESPBTUUID from_raw_reversed(const uint8_t *data);
24 
25  static ESPBTUUID from_raw(const std::string &data);
26 
27  static ESPBTUUID from_uuid(esp_bt_uuid_t uuid);
28 
29  ESPBTUUID as_128bit() const;
30 
31  bool contains(uint8_t data1, uint8_t data2) const;
32 
33  bool operator==(const ESPBTUUID &uuid) const;
34  bool operator!=(const ESPBTUUID &uuid) const { return !(*this == uuid); }
35 
36  esp_bt_uuid_t get_uuid() const;
37 
38  std::string to_string() const;
39 
40  protected:
41  esp_bt_uuid_t uuid_;
42 };
43 
44 } // namespace esp32_ble
45 } // namespace esphome
46 
47 #endif
bool operator==(const ESPBTUUID &uuid) const
Definition: ble_uuid.cpp:143
static ESPBTUUID from_uuid(esp_bt_uuid_t uuid)
Definition: ble_uuid.cpp:97
static ESPBTUUID from_uint32(uint32_t uuid)
Definition: ble_uuid.cpp:22
static ESPBTUUID from_uint16(uint16_t uuid)
Definition: ble_uuid.cpp:16
bool operator!=(const ESPBTUUID &uuid) const
Definition: ble_uuid.h:34
std::string to_string() const
Definition: ble_uuid.cpp:171
bool contains(uint8_t data1, uint8_t data2) const
Definition: ble_uuid.cpp:125
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
static ESPBTUUID from_raw(const uint8_t *data)
Definition: ble_uuid.cpp:28
ESPBTUUID as_128bit() const
Definition: ble_uuid.cpp:109
static ESPBTUUID from_raw_reversed(const uint8_t *data)
Definition: ble_uuid.cpp:34
esp_bt_uuid_t get_uuid() const
Definition: ble_uuid.cpp:170