From 16a2677bcf27a6a907079a2b09345c9791689911 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 6 Aug 2025 09:55:01 -1000 Subject: [PATCH] [bluetooth_proxy] Remove V1 connection support --- esphome/components/api/api.proto | 2 +- .../components/bluetooth_proxy/bluetooth_proxy.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/esphome/components/api/api.proto b/esphome/components/api/api.proto index 67e91cc8e3..9d77ecdfa8 100644 --- a/esphome/components/api/api.proto +++ b/esphome/components/api/api.proto @@ -1442,7 +1442,7 @@ message BluetoothLERawAdvertisementsResponse { } enum BluetoothDeviceRequestType { - BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT = 0; + BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT = 0 [deprecated = true]; // V1 removed, use V3 variants BLUETOOTH_DEVICE_REQUEST_TYPE_DISCONNECT = 1; BLUETOOTH_DEVICE_REQUEST_TYPE_PAIR = 2; BLUETOOTH_DEVICE_REQUEST_TYPE_UNPAIR = 3; diff --git a/esphome/components/bluetooth_proxy/bluetooth_proxy.cpp b/esphome/components/bluetooth_proxy/bluetooth_proxy.cpp index b921877615..db29e4774f 100644 --- a/esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +++ b/esphome/components/bluetooth_proxy/bluetooth_proxy.cpp @@ -212,8 +212,7 @@ BluetoothConnection *BluetoothProxy::get_connection_(uint64_t address, bool rese void BluetoothProxy::bluetooth_device_request(const api::BluetoothDeviceRequest &msg) { switch (msg.request_type) { case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITH_CACHE: - case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITHOUT_CACHE: - case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT: { + case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITHOUT_CACHE: { auto *connection = this->get_connection_(msg.address, true); if (connection == nullptr) { ESP_LOGW(TAG, "No free connections available"); @@ -242,12 +241,9 @@ void BluetoothProxy::bluetooth_device_request(const api::BluetoothDeviceRequest if (msg.request_type == api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITH_CACHE) { connection->set_connection_type(espbt::ConnectionType::V3_WITH_CACHE); this->log_connection_info_(connection, "v3 with cache"); - } else if (msg.request_type == api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITHOUT_CACHE) { + } else { // BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITHOUT_CACHE connection->set_connection_type(espbt::ConnectionType::V3_WITHOUT_CACHE); this->log_connection_info_(connection, "v3 without cache"); - } else { - connection->set_connection_type(espbt::ConnectionType::V1); - this->log_connection_info_(connection, "v1"); } if (msg.has_address_type) { uint64_to_bd_addr(msg.address, connection->remote_bda_); @@ -309,6 +305,11 @@ void BluetoothProxy::bluetooth_device_request(const api::BluetoothDeviceRequest break; } + case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT: { + ESP_LOGE(TAG, "V1 connections removed"); + this->send_device_connection(msg.address, false); + break; + } } }