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