mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	[bluetooth_proxy] Remove V1 connection support (#10107)
This commit is contained in:
		| @@ -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; | ||||
|   | ||||
| @@ -209,8 +209,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"); | ||||
| @@ -239,12 +238,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_); | ||||
| @@ -306,6 +302,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; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user