diff --git a/xdrip/BluetoothTransmitter/HeartBeat/Libre3HeartbeatBluetoothTransmitter.swift b/xdrip/BluetoothTransmitter/HeartBeat/Libre3HeartbeatBluetoothTransmitter.swift index 6de1aba6..a816dc0b 100644 --- a/xdrip/BluetoothTransmitter/HeartBeat/Libre3HeartbeatBluetoothTransmitter.swift +++ b/xdrip/BluetoothTransmitter/HeartBeat/Libre3HeartbeatBluetoothTransmitter.swift @@ -97,4 +97,21 @@ class Libre3HeartBeatBluetoothTransmitter: BluetoothTransmitter { } + override func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) { + + trace("didDiscoverCharacteristicsFor for peripheral with name %{public}@, for service with uuid %{public}@", log: log, category: ConstantsLog.categoryHeartBeatLibre3, type: .info, deviceName ?? "'unknown'", String(describing:service.uuid)) + + if let error = error { + trace(" didDiscoverCharacteristicsFor error: %{public}@", log: log, category: ConstantsLog.categoryBlueToothTransmitter, type: .error , error.localizedDescription) + } + + if let characteristics = service.characteristics { + for characteristic in characteristics { + peripheral.setNotifyValue(true, for: characteristic) + } + } else { + trace(" Did discover characteristics, but no characteristics listed. There must be some error.", log: log, category: ConstantsLog.categoryHeartBeatLibre3, type: .error) + } + } + } diff --git a/xdrip/View Controllers/Root View Controller/RootViewController.swift b/xdrip/View Controllers/Root View Controller/RootViewController.swift index 654d700b..ed2b5bfb 100644 --- a/xdrip/View Controllers/Root View Controller/RootViewController.swift +++ b/xdrip/View Controllers/Root View Controller/RootViewController.swift @@ -2230,9 +2230,9 @@ final class RootViewController: UIViewController, ObservableObject { @objc private func updateLabelsAndChart(overrideApplicationState: Bool = false, forceReset: Bool = false) { // TODO: Still crashing here... - DispatchQueue.main.async { - UserDefaults.standard.nightScoutSyncTreatmentsRequired = true - } +// DispatchQueue.main.async { +// UserDefaults.standard.nightScoutSyncTreatmentsRequired = true +// } // if glucoseChartManager not nil, then check if panned backward and if so then don't update the chart if let glucoseChartManager = glucoseChartManager {