Improv - BLE WiFi provisioning (#1807)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Jesse Hills
2021-06-08 11:56:21 +12:00
committed by GitHub
parent 33625e2dd3
commit a70a205ace
40 changed files with 2422 additions and 42 deletions
@@ -0,0 +1,40 @@
#pragma once
#include "ble_uuid.h"
#ifdef ARDUINO_ARCH_ESP32
#include <esp_gatt_defs.h>
#include <esp_gatts_api.h>
namespace esphome {
namespace esp32_ble {
class BLECharacteristic;
class BLEDescriptor {
public:
BLEDescriptor(ESPBTUUID uuid, uint16_t max_len = 100);
virtual ~BLEDescriptor();
bool do_create(BLECharacteristic *characteristic);
void set_value(const std::string value);
void set_value(uint8_t *data, size_t length);
void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param);
protected:
BLECharacteristic *characteristic_{nullptr};
ESPBTUUID uuid_;
uint16_t handle_{0xFFFF};
SemaphoreHandle_t create_lock_;
esp_attr_value_t value_;
esp_gatt_perm_t permissions_ = ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE;
};
} // namespace esp32_ble
} // namespace esphome
#endif