Browse Source

修复逻辑,修复版定

weicu
fdp 1 year ago
parent
commit
87b2e0cff5
  1. 28
      lib/modules/pairing/controllers/pairing_controller.dart
  2. 7
      local_plugins/ble_service/ios/ble_service/Sources/ble_service/BleService.swift

28
lib/modules/pairing/controllers/pairing_controller.dart

@ -660,14 +660,26 @@ class PairingController extends GetxController {
String? uuids = deviceInfo["id"];
_verifiedDeviceAddress = uuids;
print('找到匹配设备,获取到 uuids: $uuids');
// 检查是否已经绑定
// if (User.instance.earphonelicense != "" &&
// User.instance.earphonemac == device.address) {
// // 已经绑定
// return 10;
// } else {
return 1;
// }
//检查是否已经绑定
final existingDevice = User.instance.devices.firstWhere(
(d) =>
d.devicetype == 2 &&
d.license != "" &&
d.devicemac == device.address,
orElse: () => UserDevice(
id: -1,
uid: '',
devicetype: -1,
devicename: '',
devicemac: '',
license: ''),
);
if (existingDevice.id != -1) {
// 已经绑定
return 10;
} else {
return 1;
}
}
} else if (Platform.isAndroid) {
// Android设备,提取15-24字节的授权码

7
local_plugins/ble_service/ios/ble_service/Sources/ble_service/BleService.swift

@ -229,7 +229,12 @@ private var cmdReplyType: UInt8 = 0
isScanning = true
// 移除服务UUID过滤,扫描所有设备
// // 移除服务UUID过滤,扫描所有设备
// manager.scanForPeripherals(withServices: nil, options: [
// CBCentralManagerScanOptionAllowDuplicatesKey: true // 允许重复以获取更新的广播数据
// ])
let serviceUUIDs = [BleConst.SERVICE_UUID, BleConst.SERVICE_UUID1]
manager.scanForPeripherals(withServices: nil, options: [
CBCentralManagerScanOptionAllowDuplicatesKey: true // 允许重复以获取更新的广播数据
])

Loading…
Cancel
Save