Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions G7SensorKit/G7CGMManager/G7BluetoothManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ class G7BluetoothManager: NSObject {
// not start scanning again in that window: the sensor it just paired
// admits one display, and the session manager is claiming it.
guard delegate != nil else {
log.default("Not scanning: no delegate")
return
}

Expand All @@ -306,13 +307,17 @@ class G7BluetoothManager: NSObject {

let currentState = activePeripheral?.state ?? .disconnected
guard currentState != .connected else {
log.default("Not scanning: active peripheral is connected")
return
}

if let peripheralID = activePeripheralIdentifier, let peripheral = centralManager.retrievePeripherals(withIdentifiers: [peripheralID]).first {
log.default("Retrieved peripheral %{public}@", peripheral.identifier.uuidString)
handleDiscoveredPeripheral(peripheral)
} else {
if let peripheralID = activePeripheralIdentifier {
log.default("Could not retrieve peripheral %{public}@; active peripheral %{public}@", peripheralID.uuidString, activePeripheral?.identifier.uuidString ?? "none")
}
for peripheral in centralManager.retrieveConnectedPeripherals(withServices: [
SensorServiceUUID.advertisement.cbUUID,
SensorServiceUUID.cgmService.cbUUID
Expand Down