【发布时间】:2017-01-24 08:20:17
【问题描述】:
任何人都可以帮助我提供用于汽车免提外围设备连接的 UUID,因此我可以调用 scanForPeripherals withServices: [SOME UUID] 而不是 nil,并且只返回免提。是否有用于此的 UUID 或 CBUUID?我希望这可以在服务级别完成,不需要看特性。如果您能帮助我,请提前致谢。
func centralManagerDidUpdateState(_ central: CBCentralManager) {
if central.state == .poweredOn {
self.centralManager.scanForPeripherals(withServices: [UUID HERE] , options: nil)
} else {
print("central not powered on")
}
}
func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
print("peripheral discovered")
peripheralLabel.text = peripheral.name
}
【问题讨论】:
标签: swift bluetooth core-bluetooth