The ANCS Client Application is an example that implements the Apple Notification Center Service using the hardware delivered in the nRF51 Development Kit.
For detailed information about the Apple Notification Center Service, visit Apple's Developer pages.
The application will accept many kinds of iOS generated notifications and print them to the nRF6350 Display module. When the application receives a notification, it will send a Get Notification Attributes command to the iOS device, requesting the attributes of a specific iOS notification. For this application, the Get Notification Attribute command will always request the attributes:
- NotificationAttributeIDTitle
- NotificationAttributeIDMessage
If a response, in form of a Title and Message, is returned from the iOS device to this Get Notification Attribute command, the response will be printed on the UART.
- Note
- This application is not power optimized!
-
The application will stop advertising after 3 minutes and go to system-off mode. Push the button 1 restart advertising.
Setup
The name of the example is experimental_ble_app_ancs_s110_pca10028. If you are not using the Keil Pack Installer, you can find the source code and project file of the example in the following folder: <InstallFolder>\Nordic\nrf51\examples\ble_peripheral\experimental_ble_app_ancs
Button assignments:
- Button 1: Wake up from system-off and restart advertising.
- Button 2: Wake up, erase all bonds, and restart advertising; send iOS notification message contents on UART.
Testing
Test the ANCS Client Application with the nRF Toolbox app, which is available on both iOS (Apple Store) and Android (Google Play).
You can also test the application with the Master Control Panel by performing the following steps:
- Make sure that a UART terminal is set up on your computer.
- Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
- In the Master Control Panel, create the Apple Notification Center Service (ANCS) server by doing the following steps:
- Click File -> Server Setup. In the window that opened up, click File -> Load setup.
- In the resulting window, navigate to ble_app_ancs folder and load the file named ANCS_central.bin.
- It is important to keep the 'Server Setup' window opened.
- Select the device from Master Control Panel (the device will be advertising as 'ANCC'), then connect, bond and perform service discovery.
- Observe that the BSP_INDICATE_CONNECTED state is indicated.
- Observe that the server is started.
- Upon bonding, verify in the 'Server Setup', that the Client Characteristic Configuration descriptor (CCCD) for 0x120D and 0xC6E9 are set to 0001.
- Set the value of characteristic 0x120D to 00-01-06-02-01-02-03-04 in the 'Server Setup', and press 'update'.
- Verify that the UART has received: Email\n Added 01020304.
- Verify in the 'Server Setup', that the Client Characteristic Configuration descriptor (CCCD) for 0xD8F3 is updated to 00-01-06-03-04-01-20-00-03-20-00.
- The response on 0xD8F3 is a Get Notification Attribute command, requesting the Title and Message for the Email notification.
- Respond in the 'Server Setup', by setting the Client Characteristic Configuration descriptor (CCCD) for 0xC6E9 to 00-01-02-03-04-01-03-00-6E-52-46-03-03-00-34-32-32.
- Verify that the UART console connected to the device shows: nRF422
- Disconnect from the Master Control Panel and observe that the BSP_INDICATE_ADVERTISING state is indicated.
- Wait until the application goes to system-off (BSP_INDICATE_IDLE).
- Press button 0 and connect to the Master Control Panel. Observe that the BSP_INDICATE_CONNECTED state is indicated.
- Disconnect from the Master Control Panel.