Skip to content

Wire pump BLE heartbeat to the CGM reading schedule (dev backport) - #2473

Open
loopkitdev wants to merge 1 commit into
LoopKit:devfrom
loopkitdev:backport/wire-pump-ble-heartbeat-dev
Open

Wire pump BLE heartbeat to the CGM reading schedule (dev backport)#2473
loopkitdev wants to merge 1 commit into
LoopKit:devfrom
loopkitdev:backport/wire-pump-ble-heartbeat-dev

Conversation

@loopkitdev

Copy link
Copy Markdown
Contributor

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 a PumpHeartbeatRequest — 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 sends nil.

Single change in updatePumpManagerBLEHeartbeatPreference() (DeviceDataManager.swift), swapping the old setMustProvideBLEHeartbeat(_:) call for the new setBLEHeartbeatRequest(_:). processCGMReadingResult already calls this method after every reading, so the pump's heartbeat cadence tracks the actual CGM schedule.

Dependency

⚠️ Requires the LoopKit setBLEHeartbeatRequest / PumpHeartbeatRequest API 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@dev workspace with #599 applied and OmnipodKit on loopandlearn ble-heartbeat (LoopWorkspace scheme, iOS simulator): BUILD SUCCEEDED, 0 errors.

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants