|
|
|
@ -89,6 +89,7 @@ class PairingController extends GetxController { |
|
|
|
|
|
|
|
// ========== 当前设备信息 ========== |
|
|
|
BluetoothDevice? _currentClassicDevice; |
|
|
|
String? _verifiedDeviceName; |
|
|
|
String? _verifiedDeviceAddress; |
|
|
|
TextEditingController codeInputController = TextEditingController(); |
|
|
|
|
|
|
|
@ -542,11 +543,11 @@ class PairingController extends GetxController { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
Logger.i(_tag, '开始BLE设备关联: $_verifiedDeviceAddress'); |
|
|
|
Logger.i(_tag, '开始BLE设备关联: $_verifiedDeviceName:$_verifiedDeviceAddress'); |
|
|
|
|
|
|
|
// 调用BLE管理器的关联方法 |
|
|
|
final success = await _bleManager.startDeviceAssociation( |
|
|
|
deviceNamePattern: 'Voitrans', // 或者使用 _currentClassicDevice?.name |
|
|
|
deviceNamePattern: _verifiedDeviceName!, |
|
|
|
macAddress: _verifiedDeviceAddress!, |
|
|
|
); |
|
|
|
|
|
|
|
@ -658,6 +659,7 @@ class PairingController extends GetxController { |
|
|
|
_bleManager.stopScan(); |
|
|
|
deviceCode.value = code; |
|
|
|
String? uuids = deviceInfo["id"]; |
|
|
|
_verifiedDeviceName = device.name; |
|
|
|
_verifiedDeviceAddress = uuids; |
|
|
|
print('找到匹配设备,获取到 uuids: $uuids'); |
|
|
|
//检查是否已经绑定 |
|
|
|
@ -688,6 +690,7 @@ class PairingController extends GetxController { |
|
|
|
if (code != "") { |
|
|
|
_bleManager.stopScan(); |
|
|
|
deviceCode.value = code; |
|
|
|
_verifiedDeviceName = device.name; |
|
|
|
_verifiedDeviceAddress = device.address; |
|
|
|
//检查是否已经绑定 |
|
|
|
final existingDevice = User.instance.devices.firstWhere( |
|
|
|
@ -719,7 +722,6 @@ class PairingController extends GetxController { |
|
|
|
} |
|
|
|
await Future.delayed(Duration(seconds: 1)); |
|
|
|
} |
|
|
|
|
|
|
|
return 1; |
|
|
|
} |
|
|
|
return 0; |
|
|
|
|