Skip to content

Commit 8aaf768

Browse files
authored
Record sensor start event (LoopKit#19)
1 parent aa1b7db commit 8aaf768

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

G7SensorKit/G7CGMManager/G7CGMManager.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,16 @@ extension G7CGMManager: G7SensorDelegate {
294294
state.sensorID = name
295295
state.activatedAt = activatedAt
296296
}
297+
let event = PersistedCgmEvent(
298+
date: activatedAt,
299+
type: .sensorStart,
300+
deviceIdentifier: name,
301+
expectedLifetime: .hours(24 * 10 + 12),
302+
warmupPeriod: .hours(2)
303+
)
304+
delegate.notify { delegate in
305+
delegate?.cgmManager(self, hasNew: [event])
306+
}
297307
}
298308

299309
return shouldSwitchToNewSensor

0 commit comments

Comments
 (0)