25 esp_ble_gattc_cb_param_t *param) {
27 case ESP_GATTC_SEARCH_CMPL_EVT: {
30 char char_buf[esp32_ble::UUID_STR_LEN];
31 char service_buf[esp32_ble::UUID_STR_LEN];
32 ESP_LOGW(TAG,
"Characteristic %s was not found in service %s", this->
char_uuid_.
to_str(char_buf),
33 this->service_uuid_.to_str(service_buf));
40 ESP_LOGD(TAG,
"Write type: ESP_GATT_WRITE_TYPE_RSP");
43 ESP_LOGD(TAG,
"Write type: ESP_GATT_WRITE_TYPE_NO_RSP");
45 char char_buf[esp32_ble::UUID_STR_LEN];
46 ESP_LOGE(TAG,
"Characteristic %s does not allow writing with%s response", this->
char_uuid_.
to_str(char_buf),
47 this->require_response_ ?
"" :
"out");
50 this->
node_state = espbt::ClientState::ESTABLISHED;
51 char char_buf[esp32_ble::UUID_STR_LEN];
52 ESP_LOGD(TAG,
"Found characteristic %s on device %s", this->
char_uuid_.
to_str(char_buf),
53 this->parent()->address_str());
54 this->
node_state = espbt::ClientState::ESTABLISHED;
57 case ESP_GATTC_WRITE_CHAR_EVT: {
58 if (param->write.handle == this->char_handle_) {
59 if (param->write.status != 0) {
60 char char_buf[esp32_ble::UUID_STR_LEN];
61 ESP_LOGW(TAG,
"[%s] Write error, status=%d", this->
char_uuid_.
to_str(char_buf), param->write.status);
72 char char_buf[esp32_ble::UUID_STR_LEN];
73 if (this->
node_state != espbt::ClientState::ESTABLISHED) {
74 ESP_LOGW(TAG,
"[%s] Not connected to BLE client. State update can not be written.",
78 uint8_t state_as_uint = (uint8_t)
state;
79 ESP_LOGV(TAG,
"[%s] Write State: %d", this->
char_uuid_.
to_str(char_buf), state_as_uint);
82 sizeof(state_as_uint), &state_as_uint, this->
write_type_, ESP_GATT_AUTH_REQ_NONE);
83 if (err != ESP_GATT_OK)
84 ESP_LOGW(TAG,
"[%s] Write error, err=%d", this->
char_uuid_.
to_str(char_buf), err);