ANCS Support#2217
Conversation
Currently, the notification UID, Event ID and Category are shown.
Data source is not working properly, the Characteristic and/or descriptor isn't being found correctly
Datasource seems to go off and on.
Need to iron out some things like characteristics disappearing and reappearing.
Also added constants to set lengths for the title, subtitle, and message.
…essage is in the body.
Accepting and Declining works
|
Build size and comparison to main:
|
|
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 { |
|
Sigh, meant to merge instead of rebase Never again will I use the github.com buttons |
|
@Crefix notifications are still sent multiple times in some cases and the simulator build needs to be fixed |
|
@liamcharger is this with the PR that @tituscmd proposed? |
|
Also, I had a fix for the simulator build locally somewhere. But I do remember it being a simple fix. |
No, just updated from main. You can just merge that PR in your fork
Yep, just one or two lines, iirc |
While on topic, sorry for not getting to that better solution we talked about in that PR yet. It's exam season so I tend to be quite busy with school. I think for now the PR is fine as it stands since it doesn't make the watch crash anymore. If that PR makes this one more likely to be merged, I think we can bother with an even better solution later. How does that sound to you? |
|
Getting this forward sounds good. Let's improve it in the next iteration if it is still functional. |
Fix race condition in ANCS discovery by adding MaybeFinishDiscovery helper NOTE: Going to merge this for now, and I will then add the functionality I talk about [here](#19 (review))
If by this you mean notifications appear on the phone but not on the watch, I have indeed had this happen |
I see, I am trying to figure out behavior. Could you maybe note symptoms of when these 2 glitches happen next time? |
It's very difficult, if at all possible, to figure out a cause. I have yet to find any correlation at all... |
|
@cyberneel, can you gather a checkbox-list of all current issues in the main description? |
|
About these little glitches that happen with ANCS, I think the thing where one ANCS notification appears on the watch multiple times happens when that notification is summarized by Apple Intelligence. This seems like a correlation I've made over the last few weeks/months, though I can't say that's exclusively it. |
|
@mark9064 can we get a workflow approval? Trying to test something out, but I can't get an environment set up for compiling right now ;) |
|
Triggered :) |
|
Hey, as an iOS user I'm really interested in seeing this merged into the main branch. Is there anything I can do to help get it over the finish line? Testing? Are there any known issues without any solutions in the works? |
|
Hey all, just wanted to post a little update on the current state of this pr :) Right now we just need:
On the companion (app) side, everything works perfectly with the exception of a rare issue where the battery char doesn't seem to be exposed/sending anything. I'm still not certain if it's related to these changes or not. If it is, it's likely related to extra pressure on the watch's resources resulting in dropped characteristics as @mark9064 mentioned |
|
I know C++ and I am an experienced reviewer, but I have zero experience with firmware programming, nor with Apple-specific APIs. Would it help if I reviewed cyberneel#20? |
|
@jgonggrijp absolutely! I just meant someone who knows what they're doing with cpp (unlike me) :) |
|
TL;DR: I have tested this for almost a week and found no unexpected issues. I recommend merging Thanks for pulling forward on merging this @liamcharger . I have been running the following configuration on my smartwatch since May 7th:
I know the local changes will not be a candidate for a PR until they have been moved to external flash so that's why they are only local. Notifications loose a lot of value for me without these changes though, so that's why I have local fixes. I still haven't resolved the resource issues I mentioned on discord, but I think they are entirely unrelated to this ANCS PR. I am running this on my only smartwatch, which I wear 24/7 so it gets a fair amount of testing. I get an average of about 40 notifications per day, from about 20 different apps. This is what I have observed:
|
|
@mfalkvidd thanks for this write-up! I'm not concerned about the functionality of this, I just want to make sure the code is up to standard. Maybe @mark9064 could take a look :) (sorry for all the mentions) And feel free to check out the latest InfiniLink version, the TestFlight is available again! |
|
Yes I installed the latest from TestFlight. Had to remove the watch from my phone's bluetooth devices and pair in the app. I got the paring code request, entered the code, was prompted to allow notifications and now I can receive notifications and use the app. One thing I noticed though: In General->About in the app, it says "ANCS Enabled: No". |
|
Perfect!
That value comes straight from iOS and is updated only when it connects to the watch on every launch. I don't really have a way to update it automatically, so the best you can do is just quit and reopen the app after enabling it |
|
Yup, that worked! It shows Yes now. Would it be possible to trigger a refresh of the value on a successful pairing event or similar? Might get a race condition for the ANCS registration though. Anyway, it is just cosmetic so no big deal. |
|
TIL iOS does actually expose a hook to this (thanks @mfalkvidd) so I've just pushed a commit that keeps it updated
Actually, it does change the behavior of notifications slightly. For example if we send a low battery notification to the phone, it will already go to the watch because of ancs. But when ancs isn't enabled, we need to send it to the watch manually. So if we didn't have this flag, said notification would get delivered twice |
Sent off initial review |
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