From 493bfaf76a6e1c0f529d1a7d3cba27ad53706fed Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 1 Aug 2025 11:02:48 -1000 Subject: [PATCH] cleanup --- esphome/components/api/api_connection.cpp | 2 +- esphome/components/bluetooth_proxy/bluetooth_proxy.cpp | 10 ++++++---- esphome/components/bluetooth_proxy/bluetooth_proxy.h | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index a6c037d2c2..5fff270c99 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -1105,7 +1105,7 @@ void APIConnection::bluetooth_gatt_notify(const BluetoothGATTNotifyRequest &msg) bool APIConnection::send_subscribe_bluetooth_connections_free_response( const SubscribeBluetoothConnectionsFreeRequest &msg) { - bluetooth_proxy::global_bluetooth_proxy->send_connections_free(); + bluetooth_proxy::global_bluetooth_proxy->send_connections_free(this); return true; } diff --git a/esphome/components/bluetooth_proxy/bluetooth_proxy.cpp b/esphome/components/bluetooth_proxy/bluetooth_proxy.cpp index a9a68e25c5..a59a33117a 100644 --- a/esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +++ b/esphome/components/bluetooth_proxy/bluetooth_proxy.cpp @@ -428,11 +428,13 @@ void BluetoothProxy::send_device_connection(uint64_t address, bool connected, ui this->api_connection_->send_message(call, api::BluetoothDeviceConnectionResponse::MESSAGE_TYPE); } void BluetoothProxy::send_connections_free() { - if (this->api_connection_ == nullptr) - return; + if (this->api_connection_ != nullptr) { + this->send_connections_free(this->api_connection_); + } +} - this->api_connection_->send_message(this->connections_free_response_, - api::BluetoothConnectionsFreeResponse::MESSAGE_TYPE); +void BluetoothProxy::send_connections_free(api::APIConnection *api_connection) { + api_connection->send_message(this->connections_free_response_, api::BluetoothConnectionsFreeResponse::MESSAGE_TYPE); } void BluetoothProxy::send_gatt_services_done(uint64_t address) { diff --git a/esphome/components/bluetooth_proxy/bluetooth_proxy.h b/esphome/components/bluetooth_proxy/bluetooth_proxy.h index 8e7462c660..83cb7f374c 100644 --- a/esphome/components/bluetooth_proxy/bluetooth_proxy.h +++ b/esphome/components/bluetooth_proxy/bluetooth_proxy.h @@ -81,6 +81,7 @@ class BluetoothProxy : public esp32_ble_tracker::ESPBTDeviceListener, public Com void send_device_connection(uint64_t address, bool connected, uint16_t mtu = 0, esp_err_t error = ESP_OK); void send_connections_free(); + void send_connections_free(api::APIConnection *api_connection); void send_gatt_services_done(uint64_t address); void send_gatt_error(uint64_t address, uint16_t handle, esp_err_t error); void send_device_pairing(uint64_t address, bool paired, esp_err_t error = ESP_OK);