27 if (
call.get_mode().has_value()) {
32 pkt = this->
codec_->get_stop_request();
35 pkt = this->
codec_->get_start_request();
38 ESP_LOGW(TAG,
"Unsupported mode: %d",
mode);
42 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
43 pkt->
length, pkt->
data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);
48 if (
call.get_target_temperature().has_value()) {
51 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
52 pkt->length, pkt->data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);
61 case ESP_GATTC_DISCONNECT_EVT: {
67 case ESP_GATTC_SEARCH_CMPL_EVT: {
70 ESP_LOGW(TAG,
"[%s] No control service found at device, not an Anova..?", this->
get_name().c_str());
71 ESP_LOGW(TAG,
"[%s] Note, this component does not currently support Anova Nano.", this->
get_name().c_str());
79 ESP_LOGW(TAG,
"[%s] esp_ble_gattc_register_for_notify failed, status=%d", this->
get_name().c_str(),
status);
83 case ESP_GATTC_REG_FOR_NOTIFY_EVT: {
84 this->
node_state = espbt::ClientState::ESTABLISHED;
89 case ESP_GATTC_NOTIFY_EVT: {
90 if (param->notify.handle != this->char_handle_)
92 this->
codec_->decode(param->notify.value, param->notify.value_len);
93 if (this->
codec_->has_target_temp()) {
96 if (this->
codec_->has_current_temp()) {
99 if (this->
codec_->has_running()) {
102 if (this->
codec_->has_unit()) {
104 ESP_LOGD(TAG,
"Anova units is %s", this->
fahrenheit_ ?
"fahrenheit" :
"celsius");
113 pkt = this->
codec_->get_read_target_temp_request();
116 pkt = this->
codec_->get_read_current_temp_request();
122 if (pkt !=
nullptr) {
124 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
125 pkt->
length, pkt->
data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);
127 ESP_LOGW(TAG,
"[%s] esp_ble_gattc_write_char failed, status=%d", this->
parent_->
address_str().c_str(),
142 if (this->
node_state != espbt::ClientState::ESTABLISHED)
146 auto *pkt = this->
codec_->get_read_device_status_request();
150 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
151 pkt->length, pkt->data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);