Repository navigation
Give each fresh pod its own Bluetooth address - #37
Merged
Merged
Conversation
A DASH and an Omnipod 5 were served from the adapter's own address, but with different data characteristics. iOS kept what it had cached for that address, so after a mode switch the phone wouldn't pair until its Bluetooth was turned off and on. A fresh pod now gets a random static address, saved in the state file. The simulator sets the adapter to it after opening the device and advertises from it, so the phone sees each fresh pod as a new device, as with real pods. A pod from an older state file has no saved address and keeps the adapter's address, so a phone already paired with it still finds it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
itsmojo
approved these changes
Nov 25, 2026
itsmojo
left a comment
There was a problem hiding this comment.
LGTM and works in repeated tests. Nice to have this fixed!
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.
Ever since
-mode o5was added, switching the simulator between DASH and Omnipod 5 meant the phone wouldn't pair with the pod until its Bluetooth was turned off and on.Both modes were served from the adapter's own address, with the same pod service but different data characteristics. A DASH uses
…2442, and an Omnipod 5 uses…2443. iOS kept what it had cached for that address, so after a mode switch the phone still had the other mode's details. Turning Bluetooth off and on was the only thing that cleared it, and it always did. Other steps, including force-quitting Loop, didn't help, so the stale state was in iOS, not in the app.A real pod has its own address, so this never comes up with real pods. Adding a Service Changed characteristic to the simulator's GATT server was tried first, and it didn't help.
Change
-freshgives the pod a random static Bluetooth address, saved in the state file asble_address.ble_address. That pod keeps the adapter's address, so a phone already paired with it still finds it. The log says so and suggests-fresh.-transport impossibledoesn't use the adapter, so it's unaffected.Testing
go test ./pkg/bluetooth/passes on the Pi, including new tests that generated addresses are valid random static addresses and differ, and that the parser rejects bad input.-mode dash -freshand-mode o5 -freshseveral times. Each pod paired without cycling Bluetooth.-fresh. Loop kept talking to the same pod.🤖 Generated with Claude Code