Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANCS Support #2217

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

ANCS Support #2217

wants to merge 27 commits into from

Conversation

cyberneel
Copy link

This PR Adds support for the Apple Notification Center Service (ANCS). It shows the Title and Subtitles as "Title - Subtitle" and the message is shown in the body of the InfiniTime notification. Accepting and Declining calls also worked.

The only "issue" right now is that you have to ReConnect after the first pair for ANCS discovery to go well. Maybe there is a way in the NimBLE stack to trigger ANCS Discovery after pairing change? Also, sometimes ANCS goes dormant and then works again. I think this could either be iOS throttling or

"ANCS is not guaranteed to always be present. As a result, the NC should look for and subscribe to the Service Changed characteristic of the GATT service in order to monitor for the potential publishing and unpublishing of the ANCS at any time."

Copy link

github-actions bot commented Jan 3, 2025

Build size and comparison to main:

Section Size Difference
text 381524B 8580B
data 948B 0B
bss 22720B 184B

@liamcharger
Copy link
Contributor

liamcharger commented Jan 3, 2025

For reference, closes #910

Instructions: since an encrypted connection is required before ANCS is available, you’ll need to disconnect your watch from your companion app after updating, then reconnect. You’ll get a passkey on your watch to enter into the dialog on your iPhone. After bonding, toggle off and on your iPhone’s Bluetooth, then tap InfiniTime in the list of bonded devices. Finally, you’ll get an alert asking you to allow your watch to read notifications. Click allow, and now you should start receiving notifications!

Something to note: as of now, since using ANCS creates a connection through iOS directly instead of through the companion app, the app will not be able to reconnect to InfiniTime without removing the bond, which results in ANCS being disabled until the steps above are repeated. We’re working on fixing this ;)

Update: this is fixed in the latest InfiniLink commit on the rebuild branch

NegativeAction = (1 << 4)
};

struct AncsNotitfication {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@mark9064 mark9064 added the new feature This thread is about a new feature label Jan 16, 2025
@mark9064
Copy link
Member

Does this implement subscribing to service changes? I think this is probably required given the ANCS can come and go at any time

I think the implementation of this is relatively simple, subscribe to the generic attribute service changed characteristic, and any time an indication is received service discovery should be performed again

@cyberneel
Copy link
Author

@mark9064 I didn't explicitly implement the service changed part, but in all my testing the watch was always able to recover from a disconnect and showed new notifications. So maybe there is something in the stack that handles this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature This thread is about a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants