Я хочу получить все на устройствах Bluetooth. Я использую SwiftyBluetooth.
import SwiftyBluetooth
SwiftyBluetooth.scanForPeripherals(withServiceUUIDs: nil, timeoutAfter: 15) { scanResult in
switch scanResult {
case .scanStarted:
// The scan started meaning CBCentralManager scanForPeripherals(...) was called
print("scan Started")
case .scanResult(let peripheral, let advertisementData, let RSSI):
// A peripheral was found, your closure may be called multiple time with a .ScanResult enum case.
// You can save that peripheral for future use, or call some of its functions directly in this closure.
print("::::\(peripheral)")
self.peripheralArray.append(peripheral)
print("\(advertisementData)")
print("RSSI\(RSSI)")
case .scanStopped(let error):
print("error\(error)")
// The scan stopped, an error is passed if the scan stopped unexpectedly
}
}
Этот код дает мне названия Mi-групп и телевизоров, но не iPhone или телефонов android, чтобы получить телефоны.