BigLex
BigLex

Reputation: 3028

Advertise ANCS Service using Adafruit Feather 32u4 using AT Commands

I'm trying to implement the Apple Notification Center Service using an Adafruit Feather 32u4 Bluefruit LE to be able to receive notifications from my iPhone to the Feather board, sending them to my PC over Serial connection and dealing with them with some software that I wrote.

I set up the ANCS service and characteristics using the AT+GATTADDSERVICE and AT+GATTADDCHAR commands but when I try to make the device discoverable and to advertise the use of the ANCS service the device won't become discoverable.

This is the command that I use:

AT+GAPSETADVDATA=02-01-06-11-06-79-05-F4-31-B5-CE-4E-99-A4-0F-4B-1E-12-2D-00-D0

Where:

When I use the above command though, the device won't become discoverable. Do you know why?

While trying to troubleshoot the problem I noticed that if I try to advertise different services like an heart rate service and a device information service the device does become visible from other devices. This is the command that I used:

# Advertise as Discoverable and BLE only with 16-bit UUIDs 0x180D and 0x180A
AT+GAPSETADVDATA=02-01-06-05-02-0d-18-0a-18

Do you know why the device won't become visible when trying to advertise the ANCS service?

Thank you!

P.S. I'm new to the bluetooth protocol, sorry.

Upvotes: 0

Views: 157

Answers (1)

Michael Kotzjan
Michael Kotzjan

Reputation: 2673

Have a look at the specification of the ANCS you provided. It states:

Only one instance of the ANCS may be present on an NP. Due to the nature of iOS, the 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.

Further down you find figures that show that your iPhone is the NP and it is the one that might implement the ANCS.

ANCS: The Lifetime of a ios notification

Your Feather board would be the Central and is supposed to look for the service and connect to it. As @Paulw stated in the comments you have it the wrong way around.

Upvotes: 1

Related Questions