2022-10-03 23:45:06 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifdef USE_ESP32
|
|
|
|
|
|
|
|
#include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h"
|
|
|
|
|
|
|
|
#include "ble_characteristic.h"
|
|
|
|
|
2022-11-24 01:12:55 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2022-10-03 23:45:06 +02:00
|
|
|
namespace esphome {
|
|
|
|
namespace esp32_ble_client {
|
|
|
|
|
|
|
|
namespace espbt = esphome::esp32_ble_tracker;
|
|
|
|
|
|
|
|
class BLEClientBase;
|
|
|
|
|
|
|
|
class BLEService {
|
|
|
|
public:
|
|
|
|
~BLEService();
|
2022-11-28 01:28:02 +01:00
|
|
|
bool parsed = false;
|
2022-10-03 23:45:06 +02:00
|
|
|
espbt::ESPBTUUID uuid;
|
|
|
|
uint16_t start_handle;
|
|
|
|
uint16_t end_handle;
|
|
|
|
std::vector<BLECharacteristic *> characteristics;
|
|
|
|
BLEClientBase *client;
|
|
|
|
void parse_characteristics();
|
2022-11-28 19:49:41 +01:00
|
|
|
void release_characteristics();
|
2022-10-03 23:45:06 +02:00
|
|
|
BLECharacteristic *get_characteristic(espbt::ESPBTUUID uuid);
|
|
|
|
BLECharacteristic *get_characteristic(uint16_t uuid);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace esp32_ble_client
|
|
|
|
} // namespace esphome
|
|
|
|
|
|
|
|
#endif // USE_ESP32
|