23 if (
call.get_mode().has_value()) {
28 pkt = this->
codec_->get_stop_request();
31 pkt = this->
codec_->get_start_request();
34 ESP_LOGW(TAG,
"Unsupported mode: %d",
mode);
38 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
39 pkt->
length, pkt->
data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);
44 if (
call.get_target_temperature().has_value()) {
47 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
48 pkt->length, pkt->data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);
57 case ESP_GATTC_DISCONNECT_EVT: {
63 case ESP_GATTC_SEARCH_CMPL_EVT: {
66 ESP_LOGW(TAG,
"[%s] No control service found at device, not an Anova..?", this->
get_name().c_str());
67 ESP_LOGW(TAG,
"[%s] Note, this component does not currently support Anova Nano.", this->
get_name().c_str());
75 ESP_LOGW(TAG,
"[%s] esp_ble_gattc_register_for_notify failed, status=%d", this->
get_name().c_str(),
status);
79 case ESP_GATTC_REG_FOR_NOTIFY_EVT: {
80 this->
node_state = espbt::ClientState::ESTABLISHED;
85 case ESP_GATTC_NOTIFY_EVT: {
86 if (param->notify.handle != this->char_handle_)
88 this->
codec_->decode(param->notify.value, param->notify.value_len);
89 if (this->
codec_->has_target_temp()) {
92 if (this->
codec_->has_current_temp()) {
95 if (this->
codec_->has_running()) {
98 if (this->
codec_->has_unit()) {
100 ESP_LOGD(TAG,
"Anova units is %s", this->
fahrenheit_ ?
"fahrenheit" :
"celsius");
109 pkt = this->
codec_->get_read_target_temp_request();
112 pkt = this->
codec_->get_read_current_temp_request();
118 if (pkt !=
nullptr) {
120 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
121 pkt->
length, pkt->
data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);
123 ESP_LOGW(TAG,
"[%s] esp_ble_gattc_write_char failed, status=%d", this->
parent_->
address_str().c_str(),
138 if (this->
node_state != espbt::ClientState::ESTABLISHED)
142 auto *pkt = this->
codec_->get_read_device_status_request();
146 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
147 pkt->length, pkt->data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);