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: {
71 "[%s] No control service found at device, not an Anova..?\n"
72 "[%s] Note, this component does not currently support Anova Nano.",
81 ESP_LOGW(TAG,
"[%s] esp_ble_gattc_register_for_notify failed, status=%d", this->
get_name().c_str(),
status);
85 case ESP_GATTC_REG_FOR_NOTIFY_EVT: {
86 this->
node_state = espbt::ClientState::ESTABLISHED;
91 case ESP_GATTC_NOTIFY_EVT: {
92 if (param->notify.handle != this->char_handle_)
94 this->
codec_->decode(param->notify.value, param->notify.value_len);
95 if (this->
codec_->has_target_temp()) {
98 if (this->
codec_->has_current_temp()) {
101 if (this->
codec_->has_running()) {
104 if (this->
codec_->has_unit()) {
106 ESP_LOGD(TAG,
"Anova units is %s", this->
fahrenheit_ ?
"fahrenheit" :
"celsius");
115 pkt = this->
codec_->get_read_target_temp_request();
118 pkt = this->
codec_->get_read_current_temp_request();
124 if (pkt !=
nullptr) {
126 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
127 pkt->
length, pkt->
data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);
143 if (this->
node_state != espbt::ClientState::ESTABLISHED)
147 auto *pkt = this->
codec_->get_read_device_status_request();
151 esp_ble_gattc_write_char(this->
parent_->
get_gattc_if(), this->parent_->get_conn_id(), this->char_handle_,
152 pkt->length, pkt->data, ESP_GATT_WRITE_TYPE_NO_RSP, ESP_GATT_AUTH_REQ_NONE);