not using thread.sleep

Not tested by me!

Co-Authored-By: bjornoleh <63544115+bjornoleh@users.noreply.github.com>
Co-Authored-By: Liroy van Hoewijk <4643445+liroyvh@users.noreply.github.com>
This commit is contained in:
Johan Degraeve 2024-03-21 16:00:05 +01:00 committed by Paul Plant
parent b67e7e1385
commit 60b13942a2
1 changed files with 5 additions and 1 deletions

View File

@ -289,7 +289,11 @@ class CGMG5Transmitter:BluetoothTransmitter, CGMTransmitter {
override func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
super.centralManager(central, didDisconnectPeripheral: peripheral, error: error)
let delayInSeconds = 2.0
DispatchQueue.main.asyncAfter(deadline: .now() + delayInSeconds) {
super.centralManager(central, didDisconnectPeripheral: peripheral, error: error)
}
if waitingPairingConfirmation {
// device has requested a pairing request and is now in a status of verifying if pairing was successfull or not, this by doing setNotify to writeCharacteristic. If a disconnect occurs now, it means pairing has failed (probably because user didn't approve it