1 #include "ble_characteristic.h" 3 #include "ble_service.h" 10 namespace esp32_ble_client {
12 static const char *
const TAG =
"esp32_ble_client";
23 this->descriptors.clear();
29 esp_gattc_descr_elem_t result;
35 this->
handle, &result, &count, offset);
36 if (status == ESP_GATT_INVALID_OFFSET || status == ESP_GATT_NOT_FOUND) {
39 if (status != ESP_GATT_OK) {
40 ESP_LOGW(TAG,
"[%d] [%s] esp_ble_gattc_get_all_descr error, status=%d",
50 desc->
handle = result.handle;
63 if (desc->uuid == uuid)
75 if (desc->handle == handle)
83 auto status = esp_ble_gattc_write_char(client->get_gattc_if(), client->get_conn_id(), this->
handle, new_val_size,
84 new_val, write_type, ESP_GATT_AUTH_REQ_NONE);
86 ESP_LOGW(TAG,
"[%d] [%s] Error sending write value to BLE gattc server, status=%d",
93 return write_value(new_val, new_val_size, ESP_GATT_WRITE_TYPE_NO_RSP);
BLECharacteristic * characteristic
esp_err_t write_value(uint8_t *new_val, int16_t new_val_size)
uint16_t get_conn_id() const
void release_descriptors()
std::string address_str() const
BLEDescriptor * get_descriptor_by_handle(uint16_t handle)
static ESPBTUUID from_uuid(esp_bt_uuid_t uuid)
static ESPBTUUID from_uint16(uint16_t uuid)
uint8_t get_connection_index() const
BLEDescriptor * get_descriptor(espbt::ESPBTUUID uuid)
std::vector< BLEDescriptor * > descriptors
std::string to_string() const
Implementation of SPI Controller mode.