Wire pump BLE heartbeat to the CGM reading schedule (dev backport) - #2473
Open
loopkitdev wants to merge 1 commit into
Open
Wire pump BLE heartbeat to the CGM reading schedule (dev backport)#2473loopkitdev wants to merge 1 commit into
loopkitdev wants to merge 1 commit into
Conversation
Send the pump a PumpHeartbeatRequest (last CGM reading date + expected reading interval) when it must provide the BLE heartbeat, or nil when the CGM wakes the app itself, via the setBLEHeartbeatRequest API. The last-reading time is refreshed after every CGM reading (processCGMReadingResult already calls updatePumpManagerBLEHeartbeatPreference), so the pump's heartbeat cadence tracks the actual reading schedule. Requires the LoopKit setBLEHeartbeatRequest API on dev (LoopKit dev backport).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backports the Loop-side heartbeat wiring to the dev line (dev counterpart of #2469 on
next-dev). When a pump must provide its own BLE heartbeat, Loop now sends it aPumpHeartbeatRequest— the last CGM reading date + expected reading interval — so the pump can schedule its next heartbeat to arrive just after the next reading is due. When the CGM can wake the app itself, it sendsnil.Single change in
updatePumpManagerBLEHeartbeatPreference()(DeviceDataManager.swift), swapping the oldsetMustProvideBLEHeartbeat(_:)call for the newsetBLEHeartbeatRequest(_:).processCGMReadingResultalready calls this method after every reading, so the pump's heartbeat cadence tracks the actual CGM schedule.Dependency
setBLEHeartbeatRequest/PumpHeartbeatRequestAPI on dev — LoopKit/LoopKit#599 (dev backport of #596). This will not compile on stock dev until #599 merges.Testing
Built in a
LoopKit/LoopWorkspace@devworkspace with #599 applied and OmnipodKit on loopandlearnble-heartbeat(LoopWorkspace scheme, iOS simulator): BUILD SUCCEEDED, 0 errors.