26 auto mode_val =
call.get_mode();
27 if (mode_val.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 auto target_temp =
call.get_target_temperature();
49 if (target_temp.has_value()) {
50 auto *pkt = this->
codec_->get_set_target_temp_request(*target_temp);
52 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
53 pkt->length, pkt->data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);
62 case ESP_GATTC_DISCONNECT_EVT: {
68 case ESP_GATTC_SEARCH_CMPL_EVT: {
71 ESP_LOGW(TAG,
"[%s] No control service found at device, not an Anova..?", this->
get_name().c_str());
72 ESP_LOGW(TAG,
"[%s] Note, this component does not currently support Anova Nano.", this->
get_name().c_str());
80 ESP_LOGW(TAG,
"[%s] esp_ble_gattc_register_for_notify failed, status=%d", this->
get_name().c_str(),
status);
84 case ESP_GATTC_REG_FOR_NOTIFY_EVT: {
85 this->
node_state = espbt::ClientState::ESTABLISHED;
90 case ESP_GATTC_NOTIFY_EVT: {
91 if (param->notify.handle != this->char_handle_)
93 this->
codec_->decode(param->notify.value, param->notify.value_len);
94 if (this->
codec_->has_target_temp()) {
97 if (this->
codec_->has_current_temp()) {
100 if (this->
codec_->has_running()) {
103 if (this->
codec_->has_unit()) {
105 ESP_LOGD(TAG,
"Anova units is %s", this->
fahrenheit_ ?
"fahrenheit" :
"celsius");
114 pkt = this->
codec_->get_read_target_temp_request();
117 pkt = this->
codec_->get_read_current_temp_request();
123 if (pkt !=
nullptr) {
125 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
126 pkt->
length, pkt->
data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);
142 if (this->
node_state != espbt::ClientState::ESTABLISHED)
150 pkt = this->
codec_->get_read_device_status_request();
153 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
154 pkt->
length, pkt->
data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);