|
|
|
@ -490,9 +490,11 @@ class PairingController extends GetxController { |
|
|
|
} else { |
|
|
|
final authcode_open = AppConfig.env("APP_AUTHCODE_OPEN") ?? ""; |
|
|
|
if (authcode_open == "true") { |
|
|
|
Logger.i(_tag, '进入手动验证流: ${device.name} (${device.address})'); |
|
|
|
//验证失败 进入手动授权 |
|
|
|
_transition(PairingState.manualbinding); |
|
|
|
} else { |
|
|
|
Logger.i(_tag, '设备不支持: ${device.name} (${device.address})'); |
|
|
|
_setError(ErrorType.deviceNotMatch, |
|
|
|
'pleaseConnectDeepSoundDevice'.tr); //请连接DeepSound设备 |
|
|
|
} |
|
|
|
@ -610,15 +612,21 @@ class PairingController extends GetxController { |
|
|
|
Future<int> authbindingDevice(BluetoothDevice device) async { |
|
|
|
// 检查设备名称是否包含 DeepSound 或 DeapSound |
|
|
|
final deviceName = device.name; |
|
|
|
|
|
|
|
DBProduct? product; |
|
|
|
// 检查是否已有BLE绑定的设备 |
|
|
|
final product = AppConfig.config.products |
|
|
|
.firstWhere((d) => d.devicename == device.name); |
|
|
|
/// 检查是否已有BLE绑定的设备 |
|
|
|
if (AppConfig.config.products.isNotEmpty) { |
|
|
|
final match = AppConfig.config.products.where( |
|
|
|
(d) => d.devicename == device.name, |
|
|
|
); |
|
|
|
product = match.isNotEmpty ? match.first : null; |
|
|
|
} |
|
|
|
|
|
|
|
final names = AppConfig.allproductNames(); |
|
|
|
// 检查是否已有绑定的设备 |
|
|
|
print("device.address${device.address}"); |
|
|
|
var existingDevice = User.instance.devices.firstWhere( |
|
|
|
if (User.instance.devices.isNotEmpty) { |
|
|
|
final existingDevice = User.instance.devices.firstWhere( |
|
|
|
(d) => |
|
|
|
d.devicetype == 1 && |
|
|
|
d.devicename == device.name && |
|
|
|
@ -635,9 +643,11 @@ class PairingController extends GetxController { |
|
|
|
// 已经绑定 |
|
|
|
return 9; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (Platform.isAndroid) { |
|
|
|
// 检查是否已有BLE绑定的设备 |
|
|
|
existingDevice = User.instance.devices.firstWhere( |
|
|
|
final existingDevice = User.instance.devices.firstWhere( |
|
|
|
(d) => |
|
|
|
d.devicetype == 2 && |
|
|
|
d.devicename == device.name && |
|
|
|
@ -751,7 +761,7 @@ class PairingController extends GetxController { |
|
|
|
} |
|
|
|
await Future.delayed(Duration(seconds: 1)); |
|
|
|
} |
|
|
|
if (product.devicetype == 2) { |
|
|
|
if (product != null && product.devicetype == 2) { |
|
|
|
//ble设备 必须要扫描到结果 |
|
|
|
return 0; |
|
|
|
} else { |
|
|
|
|