23 esp_ble_gattc_cb_param_t *param) {
25 case ESP_GATTC_SEARCH_CMPL_EVT: {
28 ESP_LOGW(TAG,
"Characteristic %s was not found in service %s", this->
char_uuid_.
to_string().c_str(),
29 this->service_uuid_.to_string().c_str());
36 ESP_LOGD(TAG,
"Write type: ESP_GATT_WRITE_TYPE_RSP");
39 ESP_LOGD(TAG,
"Write type: ESP_GATT_WRITE_TYPE_NO_RSP");
41 ESP_LOGE(TAG,
"Characteristic %s does not allow writing with%s response", this->
char_uuid_.
to_string().c_str(),
42 this->require_response_ ?
"" :
"out");
45 this->
node_state = espbt::ClientState::ESTABLISHED;
47 this->parent()->address_str().c_str());
48 this->
node_state = espbt::ClientState::ESTABLISHED;
51 case ESP_GATTC_WRITE_CHAR_EVT: {
52 if (param->write.handle == this->char_handle_) {
53 if (param->write.status != 0)
54 ESP_LOGW(TAG,
"[%s] Write error, status=%d", this->
char_uuid_.
to_string().c_str(), param->write.status);
64 if (this->
node_state != espbt::ClientState::ESTABLISHED) {
65 ESP_LOGW(TAG,
"[%s] Not connected to BLE client. State update can not be written.",
69 uint8_t state_as_uint = (uint8_t)
state;
73 sizeof(state_as_uint), &state_as_uint, this->
write_type_, ESP_GATT_AUTH_REQ_NONE);
74 if (err != ESP_GATT_OK)