22 esp_ble_gattc_cb_param_t *param) {
24 case ESP_GATTC_SEARCH_CMPL_EVT: {
27 ESP_LOGW(TAG,
"Characteristic %s was not found in service %s", this->
char_uuid_.
to_string().c_str(),
28 this->service_uuid_.to_string().c_str());
35 ESP_LOGD(TAG,
"Write type: ESP_GATT_WRITE_TYPE_RSP");
38 ESP_LOGD(TAG,
"Write type: ESP_GATT_WRITE_TYPE_NO_RSP");
40 ESP_LOGE(TAG,
"Characteristic %s does not allow writing with%s response", this->
char_uuid_.
to_string().c_str(),
41 this->require_response_ ?
"" :
"out");
44 this->
node_state = espbt::ClientState::ESTABLISHED;
46 this->parent()->address_str());
47 this->
node_state = espbt::ClientState::ESTABLISHED;
50 case ESP_GATTC_WRITE_CHAR_EVT: {
51 if (param->write.handle == this->char_handle_) {
52 if (param->write.status != 0)
53 ESP_LOGW(TAG,
"[%s] Write error, status=%d", this->
char_uuid_.
to_string().c_str(), param->write.status);
63 if (this->
node_state != espbt::ClientState::ESTABLISHED) {
64 ESP_LOGW(TAG,
"[%s] Not connected to BLE client. State update can not be written.",
68 uint8_t state_as_uint = (uint8_t)
state;
72 sizeof(state_as_uint), &state_as_uint, this->
write_type_, ESP_GATT_AUTH_REQ_NONE);
73 if (err != ESP_GATT_OK)