From 8d6ebc8ffe2a08066154280eeaa79dd32ae8c713 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 6 Jul 2026 09:37:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E9=85=8D=E5=AF=B9?= =?UTF-8?q?=E5=90=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/pairing_controller.dart | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/lib/modules/pairing/controllers/pairing_controller.dart b/lib/modules/pairing/controllers/pairing_controller.dart index 6e40c7e2f..741b4c841 100644 --- a/lib/modules/pairing/controllers/pairing_controller.dart +++ b/lib/modules/pairing/controllers/pairing_controller.dart @@ -788,17 +788,9 @@ class PairingController extends GetxController with WidgetsBindingObserver { Future authbindingDevice(BluetoothDevice device) async { // 检查设备名称是否包含 DeepSound 或 DeapSound final deviceName = device.name; - DBProduct? product; - // 检查是否已有BLE绑定的设备 - // 检查是否已有BLE绑定的设备 - if (AppConfig.config.products.isNotEmpty) { - final match = AppConfig.config.products.where( - (d) => d.devicename.contains(deviceName), - ); - product = match.isNotEmpty ? match.first : null; - } + // 已移除“按设备名匹配 product”逻辑:设备名可被用户改名,不能作为是否支持的判据。 + // 是否支持的设备完全交给下面的 BLE 扫描(按 allproductUuids 过滤)+ 广播内 MAC 比对判定。 final currentBleState = await _bleManager.getConnectionState(); - final names = AppConfig.allproductNames(); final uuids = AppConfig.allproductUuids(); // 检查是否已有绑定的设备 print("device.address${device.address}"); @@ -867,7 +859,9 @@ class PairingController extends GetxController with WidgetsBindingObserver { } print( '获取到 deviceName: $deviceName address: ${device.address} uuids:$uuids'); - if (product != null && product.devicetype != 1) { + // 无条件做 BLE 扫描验证(不再依赖 product)。扫描按 allproductUuids 过滤, + // 命中后用广播内 MAC 与经典蓝牙地址比对确认,由此判定是否为支持的设备。 + { if (currentBleState == 2) { //已连接直接返回 return 9; @@ -989,10 +983,6 @@ class PairingController extends GetxController with WidgetsBindingObserver { await Future.delayed(Duration(seconds: 1)); } _bleManager.stopScan(); - // if (product != null && product.devicetype != 1) { - // //ble设备 必须要扫描到结果 - // return 0; - // } } return 0; //可以跳转1