Skip to content

Instantly share code, notes, and snippets.

@kitchen
Created May 27, 2019 03:37
Show Gist options
  • Save kitchen/b8b9744d2aec9c20cd4a894f082d8a3a to your computer and use it in GitHub Desktop.
Save kitchen/b8b9744d2aec9c20cd4a894f082d8a3a to your computer and use it in GitHub Desktop.
step 2: scan for peripherals!
scanning for peripherals with the TNC service
found a peripheral: 9572E6EC-4A27-420E-BEFB-106B0F785839
extension TNC3Connector: CBCentralManagerDelegate {
func centralManagerDidUpdateState(_ central: CBCentralManager) {
print("CBCentralManager started")
print("scanning for peripherals with the TNC service")
let tnc3Service = CBUUID(string: "00000001-BA2A-46C9-AE49-01B0961F68BB") // the TNC service UUID
central.scanForPeripherals(withServices: [tnc3Service])
}
func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
print("found a peripheral: \(peripheral.identifier)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment