1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 15:18:16 +00:00
This commit is contained in:
J. Nick Koston 2025-02-21 18:54:22 -06:00
parent 70ad2867dd
commit 62ded364b7
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View File

@ -130,10 +130,10 @@ void BLEClientBase::disconnect() {
this->set_state(espbt::ClientState::DISCONNECTING); this->set_state(espbt::ClientState::DISCONNECTING);
return; return;
} }
this->_unconditional_disconnect(); this->_unconditional_disconnect_();
} }
void BLEClientBase::_unconditional_disconnect() { void BLEClientBase::_unconditional_disconnect_() {
// Disconnect without checking the state. // Disconnect without checking the state.
ESP_LOGI(TAG, "[%d] [%s] Disconnecting.", this->connection_index_, this->address_str_.c_str()); ESP_LOGI(TAG, "[%d] [%s] Disconnecting.", this->connection_index_, this->address_str_.c_str());
if (this->conn_id_ == UNSET_CONN_ID) { if (this->conn_id_ == UNSET_CONN_ID) {
@ -209,7 +209,7 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
// Disconnect was requested before after connecting started, // Disconnect was requested before after connecting started,
// but before the connection was established. Now that we have // but before the connection was established. Now that we have
// this->conn_id_ set, we can disconnect it. // this->conn_id_ set, we can disconnect it.
this->_unconditional_disconnect(); this->_unconditional_disconnect_();
this->conn_id_ = UNSET_CONN_ID; this->conn_id_ = UNSET_CONN_ID;
break; break;
} }
@ -236,7 +236,7 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
// Disconnect was requested before after connecting started, // Disconnect was requested before after connecting started,
// but before the connection was established. Now that we have // but before the connection was established. Now that we have
// this->conn_id_ set, we can disconnect it. // this->conn_id_ set, we can disconnect it.
this->_unconditional_disconnect(); this->_unconditional_disconnect_();
this->conn_id_ = UNSET_CONN_ID; this->conn_id_ = UNSET_CONN_ID;
} }
break; break;

View File

@ -39,7 +39,7 @@ class BLEClientBase : public espbt::ESPBTClient, public Component {
void connect() override; void connect() override;
esp_err_t pair(); esp_err_t pair();
void disconnect() override; void disconnect() override;
void _unconditional_disconnect(); void _unconditional_disconnect_();
void release_services(); void release_services();
bool connected() { return this->state_ == espbt::ClientState::ESTABLISHED; } bool connected() { return this->state_ == espbt::ClientState::ESTABLISHED; }