Commit f27d5a2b authored by Philip Brechler's avatar Philip Brechler

Keep a strong reference on the peripheral after discovery to be able to use it

parent 0ff09b4c
......@@ -135,6 +135,7 @@ class BluetoothManager: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate
let connectedDevices = centralManager.retrieveConnectedPeripherals(withServices: [card10ServiceUUID])
for device in connectedDevices {
foundPeripheral.append(FoundPeripheral.init(peripheral: device, advertisementName: "card10-connected", rssi: 100))
centralManager.connect(device, options: nil)
}
centralManager.scanForPeripherals(withServices: nil, options: nil)
......
......@@ -158,7 +158,7 @@ extension ConnectedViewController {
pollingTimer?.setEventHandler { [weak self] in
self?.pollValues()
self?.setRandomBackgroundLedColors()
// self?.setRandomBackgroundLedColors()
}
pollingTimer?.resume()
}
......
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