20 esp_ble_gattc_cb_param_t *param) {
22 case ESP_GATTC_SEARCH_CMPL_EVT: {
25 ESP_LOGW(TAG,
"Characteristic %s was not found in service %s", this->
char_uuid_.
to_string().c_str(),
26 this->service_uuid_.to_string().c_str());
33 ESP_LOGD(TAG,
"Write type: ESP_GATT_WRITE_TYPE_RSP");
36 ESP_LOGD(TAG,
"Write type: ESP_GATT_WRITE_TYPE_NO_RSP");
38 ESP_LOGE(TAG,
"Characteristic %s does not allow writing with%s response", this->
char_uuid_.
to_string().c_str(),
39 this->require_response_ ?
"" :
"out");
42 this->
node_state = espbt::ClientState::ESTABLISHED;
44 this->parent()->address_str().c_str());
45 this->
node_state = espbt::ClientState::ESTABLISHED;
48 case ESP_GATTC_WRITE_CHAR_EVT: {
49 if (param->write.handle == this->char_handle_) {
50 if (param->write.status != 0)
51 ESP_LOGW(TAG,
"[%s] Write error, status=%d", this->
char_uuid_.
to_string().c_str(), param->write.status);
61 if (this->
node_state != espbt::ClientState::ESTABLISHED) {
62 ESP_LOGW(TAG,
"[%s] Not connected to BLE client. State update can not be written.",
66 uint8_t state_as_uint = (uint8_t)
state;
70 sizeof(state_as_uint), &state_as_uint, this->
write_type_, ESP_GATT_AUTH_REQ_NONE);
71 if (err != ESP_GATT_OK)