mirror of
https://github.com/esphome/esphome.git
synced 2026-02-27 17:34:22 -07:00
[esp32_ble_client] Let failed OPEN_EVT in DISCONNECTING state fall through to existing handler
Instead of a separate early-return for DISCONNECTING state, let the failed OPEN_EVT fall through to the existing failed-status handler which already transitions to IDLE.
This commit is contained in:
@@ -299,16 +299,6 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
ESP_LOGD(TAG, "[%d] [%s] ESP_GATTC_OPEN_EVT in IDLE state (status=%d), ignoring", this->connection_index_,
|
||||
this->address_str_, param->open.status);
|
||||
break;
|
||||
} else if (this->state() == espbt::ClientState::DISCONNECTING) {
|
||||
// When a connection fails to establish, the ESP-IDF stack sends DISCONNECT_EVT
|
||||
// (which we now transition to DISCONNECTING) followed by OPEN_EVT with a failure status.
|
||||
// No CLOSE_EVT will follow since no GATT connection was established, so this
|
||||
// failed OPEN_EVT is the terminal event — transition to IDLE here.
|
||||
ESP_LOGD(TAG, "[%d] [%s] ESP_GATTC_OPEN_EVT in DISCONNECTING state (status=%d), completing disconnection",
|
||||
this->connection_index_, this->address_str_, param->open.status);
|
||||
this->set_state(espbt::ClientState::IDLE);
|
||||
this->conn_id_ = UNSET_CONN_ID;
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->state() != espbt::ClientState::CONNECTING) {
|
||||
|
||||
Reference in New Issue
Block a user