diff --git a/xDripG5.xcodeproj/project.pbxproj b/xDripG5.xcodeproj/project.pbxproj index 1a164056..50b75c1c 100644 --- a/xDripG5.xcodeproj/project.pbxproj +++ b/xDripG5.xcodeproj/project.pbxproj @@ -794,7 +794,7 @@ CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = ResetTransmitter/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.loopkit.ResetTransmitter; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -821,7 +821,7 @@ CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = ResetTransmitter/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.3; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.loopkit.ResetTransmitter; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/xDripG5/BluetoothManager.swift b/xDripG5/BluetoothManager.swift index 4ca37d05..ca123708 100644 --- a/xDripG5/BluetoothManager.swift +++ b/xDripG5/BluetoothManager.swift @@ -98,7 +98,7 @@ class BluetoothManager: NSObject { // MARK: - Actions - func scanForPeripheral(after delay: TimeInterval = 0) { + func scanForPeripheral() { guard manager.state == .poweredOn else { return } @@ -108,24 +108,19 @@ class BluetoothManager: NSObject { return } - var connectOptions: [String: Any] = [:] - if #available(iOS 11.2, watchOS 4.1, *), delay > 0 { - connectOptions[CBConnectPeripheralOptionStartDelayKey] = delay - } - if let peripheralID = self.peripheral?.identifier, let peripheral = manager.retrievePeripherals(withIdentifiers: [peripheralID]).first { - log.info("Re-connecting to known peripheral %{public}@ in %.1fs", peripheral.identifier.uuidString, delay) + log.debug("Re-connecting to known peripheral %{public}@", peripheral.identifier.uuidString) self.peripheral = peripheral - self.manager.connect(peripheral, options: connectOptions) + self.manager.connect(peripheral) } else if let peripheral = manager.retrieveConnectedPeripherals(withServices: [ TransmitterServiceUUID.advertisement.cbUUID, TransmitterServiceUUID.cgmService.cbUUID ]).first, delegate == nil || delegate!.bluetoothManager(self, shouldConnectPeripheral: peripheral) { - log.info("Found system-connected peripheral: %{public}@", peripheral.identifier.uuidString) + log.debug("Found system-connected peripheral: %{public}@", peripheral.identifier.uuidString) self.peripheral = peripheral - self.manager.connect(peripheral, options: connectOptions) + self.manager.connect(peripheral) } else { - log.info("Scanning for peripherals") + log.debug("Scanning for peripherals") manager.scanForPeripherals(withServices: [ TransmitterServiceUUID.advertisement.cbUUID ], @@ -153,14 +148,10 @@ class BluetoothManager: NSObject { */ fileprivate func scanAfterDelay() { - if #available(iOS 11.2, watchOS 4.1, *) { - self.scanForPeripheral(after: TimeInterval(60 * 3)) - } else { - DispatchQueue.global(qos: DispatchQoS.QoSClass.utility).async { - Thread.sleep(forTimeInterval: 2) + DispatchQueue.global(qos: DispatchQoS.QoSClass.utility).async { + Thread.sleep(forTimeInterval: 2) - self.scanForPeripheral() - } + self.scanForPeripheral() } } diff --git a/xDripG5/PeripheralManager.swift b/xDripG5/PeripheralManager.swift index 4b30df0d..81c48431 100644 --- a/xDripG5/PeripheralManager.swift +++ b/xDripG5/PeripheralManager.swift @@ -101,7 +101,7 @@ extension PeripheralManager { func configureAndRun(_ block: @escaping (_ manager: PeripheralManager) -> Void) -> (() -> Void) { return { [unowned self] in if !self.needsConfiguration && self.peripheral.services == nil { - self.log.error("Configured peripheral has no services. Reconfiguring…") + self.log.debug("Configured peripheral has no services. Reconfiguring…") } if self.needsConfiguration || self.peripheral.services == nil {