[codex] Add iOS BLE central background restore shim - #4770
Open
cagnulein wants to merge 13 commits into
Open
Conversation
…ein/qdomyos-zwift into watt-and-pace-not-colored
Revert all incorrect name changes introduced by the Python generator, add tile_watt_color_enabled and tile_pace_color_enabled manually, and delete tools/generate_settings_catalog.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The bluetooth-central background mode alone does not keep the app running: iOS suspends the process a few seconds after the screen goes off and only resumes it for very short windows when a BLE notification arrives. While suspended every QTimer stops, so homeform::update() and the per-device refresh timers freeze and the session stalls. Add an iOS keep alive built on an active AVAudioSession playing an inaudible looping buffer (the same trick the Flutter background execution plugins use). The session uses MixWithOthers so the music or podcast the user is listening to is never interrupted, and it is started only while a workout is running (Start) and stopped on Stop. A watchdog plus the interruption / media-services-reset observers restart the loop if iOS stops it behind our back. Also complete the CoreBluetooth restore shim: CoreBluetooth expects the delegate to implement centralManager:willRestoreState: when a restore identifier is used, so install a logging-only implementation on Qt's central manager at runtime, and log the relaunch-by-CoreBluetooth launch option. New setting: ios_background_keepalive (default on). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Xcode project is checked in and is not regenerated by the CI, so ios_background_keepalive.mm was never compiled (undefined symbols at link time) and ios_bluetooth_background.mm, added by the previous commit of this branch, was silently not built at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ActivityKit gives an app a limited budget of Live Activity updates while it is not in foreground. QZ pushes one update per second, which burns the budget in a few minutes: iOS then silently stops applying the new content, the Live Activity freezes and (past the stale date) it is rendered as outdated. Slow the updates down to one every 5 seconds while the app is not active, leaving the 1 Hz rate in foreground and leaving the HealthKit metrics at full rate. The inactivity timeout that auto-closes the Live Activity goes from 10 to 30 seconds, otherwise a single late BLE notification would close it while in background. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
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
Impact
This is a first central-side step for keeping physical BLE device connections recoverable when iOS suspends or restores the app. It intentionally leaves the peripheral/virtual BLE side untouched.
Validation