Ancs ble fixes#20
Open
mfalkvidd wants to merge 2 commits into
Open
Conversation
Delay BLE service discovery until the link is encrypted instead of starting it immediately after connection. Some phones appear to reject or ignore ANCS setup while pairing/security is still in progress, leaving notifications stuck until Bluetooth is toggled on the phone. Also make ANCS descriptor setup more robust by discovering CCCDs one at a time, using each characteristic's actual handle range, subscribing sequentially, and finishing discovery only once subscription state is known.
Start BLE service discovery only after the connection has reached an encrypted state instead of using the generic BleConnected delay. iOS only exposes and authorizes ANCS after pairing/security is complete, so the old timer-based path could race the pairing flow and miss ANCS entirely. In that case the notification permission dialog would not appear until a later Bluetooth reconnect. Also tighten the ANCS setup path so descriptor discovery and CCCD writes are serialized and scoped to the actual Notification Source and Data Source characteristics. This removes the bogus write to the ANCS service end handle and avoids treating the Control Point as a subscribable characteristic. Finally, fix the advertising data to describe ANCS correctly. InfiniTime is an ANCS client, not an ANCS server, so the ANCS UUID should not be advertised as a local service. Keep DFU in the local 128-bit service UUID list and place ANCS in the scan response as a 128-bit Service Solicitation UUID. This keeps the legacy advertising payload within size limits and should make LE scanners such as bluetoothctl behave more reliably.
Collaborator
|
@cyberneel can you look over this :)) |
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.
Sorry, there were two commits to fix the ble ancs issues. The patch isn't that small unfortunately. But it works, and maybe it is possible to make it smaller before merging by removing changes that aren't strictly required.
Disclosure: I used Codex to find the problem and implement the patch.