Commit 3df740de authored by Philip Brechler's avatar Philip Brechler

Connect to already paired devices

parent bc7ab0d8
......@@ -66,7 +66,7 @@ class BluetoothManager: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate
var centralManager: CBCentralManager!
/// card10 main service
let card10ServiceUUID = CBUUID(string: "42230200-2342-2342-2342-234223422342")
let card10ServiceUUID = CBUUID(string: "0x42230200-2342-2342-2342-234223422342")
/// Time update characteristic (write)
let card10TimeCharacteristic = CBUUID(string: "42230201-2342-2342-2342-234223422342")
/// Vibra characteristic (write)
......@@ -133,6 +133,10 @@ class BluetoothManager: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate
foundPeripheral = []
subscribers.forEach { $0.value?.didFindNewPeripherals(self.foundPeripheral) }
let connectedDevices = centralManager.retrieveConnectedPeripherals(withServices: [card10ServiceUUID])
for device in connectedDevices {
centralManager.connect(device, options: nil)
}
centralManager.scanForPeripherals(withServices: nil, options: nil)
print("scan started")
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment