mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 14:43:51 +00:00
tweak
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "ble_uuid.h"
|
||||
|
||||
#ifdef USE_ESP32
|
||||
#ifdef USE_ESP32_BLE_DEVICE
|
||||
#ifdef USE_ESP32_BLE_UUID
|
||||
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
@@ -191,5 +191,5 @@ std::string ESPBTUUID::to_string() const {
|
||||
|
||||
} // namespace esphome::esp32_ble
|
||||
|
||||
#endif // USE_ESP32_BLE_DEVICE
|
||||
#endif // USE_ESP32_BLE_UUID
|
||||
#endif // USE_ESP32
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "esphome/core/helpers.h"
|
||||
|
||||
#ifdef USE_ESP32
|
||||
#ifdef USE_ESP32_BLE_DEVICE
|
||||
#ifdef USE_ESP32_BLE_UUID
|
||||
|
||||
#include <string>
|
||||
#include <esp_bt_defs.h>
|
||||
@@ -43,5 +43,5 @@ class ESPBTUUID {
|
||||
|
||||
} // namespace esphome::esp32_ble
|
||||
|
||||
#endif // USE_ESP32_BLE_DEVICE
|
||||
#endif // USE_ESP32_BLE_UUID
|
||||
#endif // USE_ESP32
|
||||
|
||||
@@ -447,6 +447,7 @@ def parse_properties(char_conf):
|
||||
|
||||
def parse_uuid(uuid):
|
||||
# If the UUID is a int, use from_uint32
|
||||
cg.add_define("USE_ESP32_BLE_UUID")
|
||||
if isinstance(uuid, int):
|
||||
return ESPBTUUID_ns.from_uint32(uuid)
|
||||
# Otherwise, use ESPBTUUID_ns.from_raw
|
||||
|
||||
@@ -373,6 +373,7 @@ async def _add_ble_features():
|
||||
# Add feature-specific defines based on what's needed
|
||||
if BLEFeatures.ESP_BT_DEVICE in _required_features:
|
||||
cg.add_define("USE_ESP32_BLE_DEVICE")
|
||||
cg.add_define("USE_ESP32_BLE_UUID")
|
||||
|
||||
|
||||
ESP32_BLE_START_SCAN_ACTION_SCHEMA = cv.Schema(
|
||||
|
||||
@@ -33,12 +33,14 @@ enum AdvertisementParserType {
|
||||
RAW_ADVERTISEMENTS,
|
||||
};
|
||||
|
||||
#ifdef USE_ESP32_BLE_DEVICE
|
||||
#ifdef USE_ESP32_BLE_UUID
|
||||
struct ServiceData {
|
||||
ESPBTUUID uuid;
|
||||
adv_data_t data;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef USE_ESP32_BLE_DEVICE
|
||||
class ESPBLEiBeacon {
|
||||
public:
|
||||
ESPBLEiBeacon() { memset(&this->beacon_data_, 0, sizeof(this->beacon_data_)); }
|
||||
|
||||
Reference in New Issue
Block a user