|
|
|
@ -788,17 +788,9 @@ class PairingController extends GetxController with WidgetsBindingObserver { |
|
|
|
Future<int> 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 |
|
|
|
|