You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I scan for all peripherals without specifying a service like the following, I get a certain number of devices that support service 180A (Device Information), as evidenced by the logs printed by discoverServices:
RZBUserInteraction.setEnabled(true)RZBUserInteraction.setTimeout(5)vartags=[Tag]()
central.scanForPeripherals(withServices:nil, options:nil){(scanInfo, scanError)in
if let error = scanError {
if let bluetoothError =RZBluetoothError(rawValue:UInt(error._code)){
if bluetoothError ==.timeoutError {completion(.success(tags))}else{print("Failed to scan for peripherals because \(String(describing: bluetoothError))")}}else{print("Failed to scan for peripherals because \(String(describing: error))")}}else if let info = scanInfo {letperipheral= info.peripheral
if(!tags.contains(where:{ tag ->Boolin
tag.uuid == peripheral.identifier.uuidString
})){
tags.append(Tag(
id:nil,
uuid: peripheral.identifier.uuidString,
name: peripheral.name,
RSSI: info.rssi.intValue
))
peripheral.discoverServiceUUIDs([CBUUID(string:"180A")], completion:{ error in
if let error = error {print("Failed to discover services for \(peripheral.identifier.uuidString) because \(String(describing: error))")}else{print("Peripheral \(peripheral.identifier.uuidString) supports 180A")}})}}}
But if I scan specifically for peripherals that advertise that 180A service, I get zero device, as evidenced by the fact that the breakpoint I place on let peripheral = info.peripheral is never triggered.
RZBUserInteraction.setEnabled(true)RZBUserInteraction.setTimeout(5)vartags=[Tag]()
central.scanForPeripherals(withServices:[CBUUID(string:"180A")], options:nil){(scanInfo, scanError)in
if let error = scanError {
if let bluetoothError =RZBluetoothError(rawValue:UInt(error._code)){
if bluetoothError ==.timeoutError {completion(.success(tags))}else{print("Failed to scan for peripherals because \(String(describing: bluetoothError))")}}else{print("Failed to scan for peripherals because \(String(describing: error))")}}else if let info = scanInfo {letperipheral= info.peripheral
if(!tags.contains(where:{ tag ->Boolin
tag.uuid == peripheral.identifier.uuidString
})){
tags.append(Tag(
id:nil,
uuid: peripheral.identifier.uuidString,
name: peripheral.name,
RSSI: info.rssi.intValue
))
peripheral.discoverServiceUUIDs([CBUUID(string:"180A")], completion:{ error in
if let error = error {print("Failed to discover services for \(peripheral.identifier.uuidString) because \(String(describing: error))")}else{print("Peripheral \(peripheral.identifier.uuidString) supports 180A")}})}}}
Am I forgetting something?
The text was updated successfully, but these errors were encountered:
Issue
When I scan for all peripherals without specifying a service like the following, I get a certain number of devices that support service 180A (Device Information), as evidenced by the logs printed by discoverServices:
But if I scan specifically for peripherals that advertise that 180A service, I get zero device, as evidenced by the fact that the breakpoint I place on
let peripheral = info.peripheral
is never triggered.Am I forgetting something?
The text was updated successfully, but these errors were encountered: