Repository navigation
Fixes failed reconnection after a SystemMemoryReset - #100
Merged
Merged
Conversation
When iOS had a SystemMemoryReset, the sensor failed to reconnect. A session relaunched by Bluetooth state restoration knows its sensor only through the bluetooth manager, which records the identifier when the restored peripheral is made active. resumeScanning() then replaced that identifier with the persisted one, and in Dexcom-app mode the persisted one was always nil: the manager wrote it from the sensor's credentials inside the didDiscoverNewSensor callback, before the sensor had updated them. The rescan after the next disconnect had nothing to retrieve and, with the peripheral still active, nothing to scan for, so bluetoothd had no reason to wake the app again. A phone reboot reproduces it: the first disconnect after the relaunch is followed by no connect request, while other apps on the same sensor reconnect within seconds, and the stall lasts until the next relaunch. The discovery callback now carries the identifier the sensor was found under, so the manager persists a real value. resumeScanning() no longer touches the identifier at all; every write to the credentials already reaches the bluetooth manager through init, reconfigure and discovery. Installs that have already persisted nil are protected by the second change, and pick up a real identifier at their next sensor.
Contributor
|
Thanks! |
ps2
added a commit
to LoopKit/LoopWorkspace
that referenced
this pull request
Oct 22, 2026
- G7SensorKit: calibration reply decoding and stale calibration expiry (LoopKit/G7SensorKit#98), reconnect after a SystemMemoryReset (LoopKit/G7SensorKit#100), temporary sensor issue in settings (LoopKit/G7SensorKit#99) - LoopSupport: view the diagnostic report before sharing or sending it (LoopKit/LoopSupport#42) - OmnipodKit: pump view signal loss uses the last response time (loopandlearn/OmnipodKit#196) - EversenseKit: retry GetTxCertificate with tx_flags inverted on the 365 (LoopKit/EversenseKit#8)
dnzxy
pushed a commit
to loopandlearn/G7SensorKit
that referenced
this pull request
Oct 23, 2026
When iOS had a SystemMemoryReset, the sensor failed to reconnect. A session relaunched by Bluetooth state restoration knows its sensor only through the bluetooth manager, which records the identifier when the restored peripheral is made active. resumeScanning() then replaced that identifier with the persisted one, and in Dexcom-app mode the persisted one was always nil: the manager wrote it from the sensor's credentials inside the didDiscoverNewSensor callback, before the sensor had updated them. The rescan after the next disconnect had nothing to retrieve and, with the peripheral still active, nothing to scan for, so bluetoothd had no reason to wake the app again. A phone reboot reproduces it: the first disconnect after the relaunch is followed by no connect request, while other apps on the same sensor reconnect within seconds, and the stall lasts until the next relaunch. The discovery callback now carries the identifier the sensor was found under, so the manager persists a real value. resumeScanning() no longer touches the identifier at all; every write to the credentials already reaches the bluetooth manager through init, reconfigure and discovery. Installs that have already persisted nil are protected by the second change, and pick up a real identifier at their next sensor. (cherry picked from commit 512cd78)
kristinkand
added a commit
to kristinkand/G7SensorKit
that referenced
this pull request
Oct 23, 2026
…yReset (LoopKit#100, Sam King) # Conflicts: # G7SensorKitTests/G7CGMManagerTests.swift
kristinkand
added a commit
to kristinkand/G7SensorKit
that referenced
this pull request
Oct 23, 2026
…yReset (LoopKit#100, Sam King) # Conflicts: # G7SensorKitTests/G7CGMManagerTests.swift
kristinkand
added a commit
to kristinkand/G7SensorKit
that referenced
this pull request
Oct 23, 2026
…yReset (LoopKit#100, Sam King) # Conflicts: # G7SensorKitTests/G7CGMManagerTests.swift
kristinkand
added a commit
to kristinkand/G7SensorKit
that referenced
this pull request
Oct 24, 2026
…yReset (LoopKit#100, Sam King) # Conflicts: # G7SensorKitTests/G7CGMManagerTests.swift
kristinkand
added a commit
to kristinkand/G7SensorKit
that referenced
this pull request
Oct 24, 2026
…yReset (LoopKit#100, Sam King) # Conflicts: # G7SensorKitTests/G7CGMManagerTests.swift
EJM0
pushed a commit
to EJM0/G7SensorKit
that referenced
this pull request
Oct 24, 2026
…yReset (LoopKit#100, Sam King) # Conflicts: # G7SensorKitTests/G7CGMManagerTests.swift
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.
When iOS had a SystemMemoryReset, the sensor failed to reconnect. A
session relaunched by Bluetooth state restoration knows its sensor
only through the bluetooth manager, which records the identifier when
the restored peripheral is made active. resumeScanning() then replaced
that identifier with the persisted one, and in Dexcom-app mode the
persisted one was always nil: the manager wrote it from the sensor's
credentials inside the didDiscoverNewSensor callback, before the
sensor had updated them. The rescan after the next disconnect had
nothing to retrieve and, with the peripheral still active, nothing to
scan for, so bluetoothd had no reason to wake the app again. A phone
reboot reproduces it: the first disconnect after the relaunch is
followed by no connect request, while other apps on the same sensor
reconnect within seconds, and the stall lasts until the next relaunch.
The discovery callback now carries the identifier the sensor was found
under, so the manager persists a real value. resumeScanning() no longer
touches the identifier at all; every write to the credentials already
reaches the bluetooth manager through init, reconfigure and discovery.
Installs that have already persisted nil are protected by the second
change, and pick up a real identifier at their next sensor.