|
|
|
@ -290,7 +290,7 @@ private var cmdReplyType: UInt8 = 0 |
|
|
|
// 完整UUID |
|
|
|
cbuuid = CBUUID(string: uuidStr) |
|
|
|
} else { |
|
|
|
os_log("⚠️ 无效的UUID格式: %{public}@", log: logger, type: .warning, uuidStr) |
|
|
|
os_log("⚠️ 无效的UUID格式: %{public}@", log: logger, type: .default, uuidStr) |
|
|
|
continue |
|
|
|
} |
|
|
|
serviceUUIDs.append(cbuuid) |
|
|
|
@ -300,11 +300,13 @@ private var cmdReplyType: UInt8 = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 开始扫描,使用构建的服务UUID数组进行过滤 |
|
|
|
manager.scanForPeripherals(withServices: serviceUUIDs.isEmpty ? nil : serviceUUIDs, options: [ |
|
|
|
// // 开始扫描,使用构建的服务UUID数组进行过滤 |
|
|
|
// manager.scanForPeripherals(withServices: serviceUUIDs.isEmpty ? nil : serviceUUIDs, options: [ |
|
|
|
// CBCentralManagerScanOptionAllowDuplicatesKey: true // 允许重复以获取更新的广播数据 |
|
|
|
// ]) |
|
|
|
manager.scanForPeripherals(withServices: nil , options: [ |
|
|
|
CBCentralManagerScanOptionAllowDuplicatesKey: true // 允许重复以获取更新的广播数据 |
|
|
|
]) |
|
|
|
|
|
|
|
let filterInfo = serviceUUIDs.isEmpty ? "无过滤" : "过滤器数量: \(serviceUUIDs.count)" |
|
|
|
os_log("🔍 开始扫描BLE设备(%{public}@),超时时间: %.1f秒", log: logger, type: .info, filterInfo, timeout) |
|
|
|
|
|
|
|
|