|
| 1 | +# ANCS Demo |
| 2 | + |
| 3 | +## Table of Contents |
| 4 | + |
| 5 | +* [**Introduction**](#Introduction) |
| 6 | +* [**Hardware Prerequisites**](#Hardware Prerequisites) |
| 7 | +* [**Software Prerequisites**](#Software Prerequisites) |
| 8 | +* [**Preprocessor Defines**](#Preprocessor Defines) |
| 9 | + * [**USE\_GUI\_COMPOSER**](#USE_GUI_COMPOSER) |
| 10 | + * [**USE\_WATCHDOG\_TIMER**](#USE_WATCHDOG_TIMER) |
| 11 | + * [**IGNORE\_PREEXISTING\_NOTIFICATIONS**](#IGNORE_PREEXISTING_NOTIFICATIONS) |
| 12 | +* [**Usage**](#Usage) |
| 13 | + * [**GUI Composer Demonstration**](#GUI Composer Demonstration) |
| 14 | + * [**UART Demonstration**](#UART Demonstration) |
| 15 | + |
| 16 | +## <a name="Introduction"></a>Introduction |
| 17 | + |
| 18 | +The ANCS project implements a simple Bluetooth low energy |
| 19 | +peripheral device acting as a GATT client which receives Apple notification data from a mobile Apple device acting as a GATT server. This project is meant to demonstrate a basic use of the Apple Notification Center Service or ANCS, and can be adapted for use in a variety personal electronic applications. The ANCS's specification can be found here: |
| 20 | +[**Apple Notification Center Service (ANCS) Specification**](https://developer.apple.com/library/content/documentation/CoreBluetooth/Reference/AppleNotificationCenterServiceSpecification/Introduction/Introduction.html). |
| 21 | + |
| 22 | +This project uses stack and app configurations that are summarized in the table below: |
| 23 | + |
| 24 | +App Build Configuration | Compatible Stack Configuration | Description |
| 25 | +----------------------------|--------------------------------|------------------------------------------------------------------- |
| 26 | +FlashROM_StackLibrary | FlashROM_Library | Application build configuration linked to Stack library (fully executable) |
| 27 | +FlashROM_StackLibrary_RCOSC | FlashROM_Library | Application build configuration linked to Stack library for 32-kHz crystal-less device configuration |
| 28 | + |
| 29 | +FlashROM configurations use the split image configuration, which is explained |
| 30 | +[**here**](../../../../../docs/blestack/ble_user_guide/html/cc2640/platform.html#split-image-configuration). |
| 31 | +FlashROM_Library configurations use the stack library configuration, which is |
| 32 | +explained [**here**](../../../../../docs/blestack/ble_user_guide/html/cc2640/platform.html#stack-library-configuration). |
| 33 | + |
| 34 | +This document discusses the procedure for using the ANCS |
| 35 | +application when the FlashROM or FlashROM_StackLibrary configurations are used. |
| 36 | +The FlashROM_StackLibrary_RCOSC configuration is discussed in the |
| 37 | +[**RCOSC section of the BLE-Stack User's Guide for Bluetooth 4.2**](../../../../../docs/blestack/ble_user_guide/html/ble-stack/index.html#using-32-khz-crystal-less-mode). |
| 38 | + |
| 39 | +## <a name="Hardware Prerequisites"></a>Hardware Prerequisites |
| 40 | + |
| 41 | +The default ANCS Demo configuration uses the |
| 42 | +[**LAUNCHXL-CC2640R2**](http://www.ti.com/tool/launchxl-cc2640r2). This hardware |
| 43 | +configuration is shown in the below image: |
| 44 | + |
| 45 | +<img src="resource/hardware_setup.jpg" width="300" height="400" /> |
| 46 | + |
| 47 | +For custom hardware, see the [**Running the SDK on Custom Boards section of the |
| 48 | +BLE-Stack User's Guide for Bluetooth 4.2**](../../../../../docs/blestack/ble_user_guide/html/ble-stack/index.html#running-the-sdk-on-custom-boards). |
| 49 | + |
| 50 | +This application also requires a mobile Apple device running iOS that supports Bluetooth 4.2. |
| 51 | + |
| 52 | +## <a name="Software Prerequisites"></a>Software Prerequisites |
| 53 | + |
| 54 | +This project requires either the [**companion GUI Composer application**](https://dev.ti.com/gallery/) |
| 55 | + or a serial terminal application such as [**PuTTY**](http://www.putty.org/) |
| 56 | + or [**Tera Term**](https://ttssh2.osdn.jp/index.html.en) for its demonstrations. |
| 57 | + |
| 58 | +For information on what versions of Code Composer Studio and IAR Embedded |
| 59 | +Workbench to use, see the Release Notes located in the docs/blestack folder. For |
| 60 | +information on how to import this project into your IDE workspace and |
| 61 | +build/run, please refer to [**The CC2640R2F Platform section in the |
| 62 | +BLE-Stack User's Guide for Bluetooth 4.2**](../../../../../docs/blestack/ble_user_guide/html/cc2640/platform.html). |
| 63 | + |
| 64 | +## <a name="Preprocessor Defines"></a>Preprocessor Defines |
| 65 | + |
| 66 | +This application has optional functionality toggled in the form of preprocessor |
| 67 | +defines. For CCS, you can learn how to add and modify preprocessor |
| 68 | +defines [**Here**](../../../../../docs/blestack/ble_user_guide/html/cc2640/developing_in_ccs.html#accessing-preprocessor-symbols). |
| 69 | + |
| 70 | +#### <a name="USE_GUI_COMPOSER"></a>USE\_GUI\_COMPOSER: |
| 71 | + |
| 72 | +This symbol determines which demonstration mode the application is in. |
| 73 | +If USE\_GUI\_COMPOSER is defined, the project will support the |
| 74 | +[GUI Composer 2.0 demonstration](#GUI Composer Demonstration). If instead it is not defined, the |
| 75 | +application will support the [UART demonstration](#UART Demonstration) instead. |
| 76 | + |
| 77 | +By default USE\_GUI\_COMPOSER is defined. |
| 78 | + |
| 79 | +#### <a name="USE_WATCHDOG_TIMER"></a>USE\_WATCHDOG\_TIMER: |
| 80 | + |
| 81 | +This symbol determines if a watchdog timer (WDT) is enabled in the application. The WDT is enabled when USE\_WATCHDOG\_TIMER is defined, and disabled when the |
| 82 | +symbol is undefined. The WDT is set to start counting down once the CC2640R2 is |
| 83 | +advertising. The WDT is configured to wait five seconds before being kicked, and the |
| 84 | + periodic task resetting the WDT will trigger every half-second. Both of these values |
| 85 | + can be changed by adjusting WATCHDOG\_TIMER\_TIMEOUT\_PERIOD and |
| 86 | + ANCSAPP\_PERIODIC\_EVT\_PERIOD found at the top of ancsApp.c respectfully. |
| 87 | + |
| 88 | +By default USE\_WATCHDOG\_TIMER is undefined. |
| 89 | + |
| 90 | + |
| 91 | +#### <a name="IGNORE_PREEXISTING_NOTIFICATIONS"></a>IGNORE\_PREEXISTING\_NOTIFICATIONS: |
| 92 | + |
| 93 | +This symbol determines if the application should include notifications |
| 94 | +that exist on the mobile Apple device before the session with the CC2640R2 was |
| 95 | +initiated. Such notifications are ignored if IGNORE\_PREEXISTING\_NOTIFICATIONS is |
| 96 | +defined, conversely preexisting notifications will be processed by the application if the |
| 97 | +symbol is undefined. |
| 98 | + |
| 99 | +By default IGNORE\_PREEXISTING\_NOTIFICATIONS is undefined. |
| 100 | + |
| 101 | +## <a name="Usage"></a>Usage |
| 102 | + |
| 103 | +This application has two primary modes of usage, a GUI Composer 2.0 demonstration, |
| 104 | +or a UART terminal demonstration. |
| 105 | + |
| 106 | +For both demonstrations, this document will use an iPhone 6 Plus to serve as the mobile Apple |
| 107 | +device hosting the ANCS. Note that any mobile Apple device that supports Bluetooth 4.2 should work accordingly. |
| 108 | + |
| 109 | +### <a name="GUI Composer Demonstration"></a>GUI Composer Demonstration |
| 110 | + |
| 111 | +The GUI Composer 2.0 partner application can be accessed [**Here**](https://dev.ti.com/gallery/). |
| 112 | +Simply search through the list of applications featured in the gallery for one titled **ANCS Demo**. |
| 113 | + |
| 114 | +<img src="resource/ANCS_demo_figure8.png" width="1000" height="350" /> |
| 115 | + |
| 116 | +Once located, click on the project to run the application. You should now be presented with this |
| 117 | +page: |
| 118 | + |
| 119 | +<img src="resource/ANCS_demo_figure9.png" width="1000" height="400" /> |
| 120 | + |
| 121 | +You may click okay **CLOSE** on the README.md window, and wait until the prompt in the bottom left |
| 122 | +of the application reads **waiting for data...** as seen in the above picture. |
| 123 | + |
| 124 | +On the mobile Apple device advertising is enabled by default upon startup, so there is no need to |
| 125 | +physically press a button to start advertising. Unlock the mobile Apple device |
| 126 | +and open the Settings App. Open the Bluetooth settings tab and notice that "ANCS Demo" |
| 127 | +can now be connected to: |
| 128 | + |
| 129 | +<img src="resource/ancs_demo_figure2.png" width="300" height="533" /> |
| 130 | + |
| 131 | +Next, a prompt asking to pair to "ANCS Demo" should appear mobile Apple device: |
| 132 | + |
| 133 | +<img src="resource/ancs_demo_figure4.png" width="300" height="533" /> |
| 134 | + |
| 135 | +Tap "Pair" and the mobile Apple device should complete the bonding process with the ANCS Demo. |
| 136 | +The "ANCS Demo" should now appear with an "i" encompassed by a circle signifying |
| 137 | +stored bond data: |
| 138 | + |
| 139 | +<img src="resource/ancs_demo_figure5.png" width="300" height="533" /> |
| 140 | + |
| 141 | +The GUI application should now be displaying various notification data as it is retrieved: |
| 142 | + |
| 143 | +<img src="resource/ANCS_demo_figure10.png" width="1000" height="400" /> |
| 144 | + |
| 145 | +Once notification data is no longer being retrieved for the existing notifications, you may view |
| 146 | +retrieved notifications by selecting them in the droplist box titled **Select Notification:** |
| 147 | + |
| 148 | +<img src="resource/ANCS_demo_figure11.png" width="1000" height="400" /> |
| 149 | + |
| 150 | +If the mobile Apple device receives an incoming call, you may accept or decline the call using the |
| 151 | +CC2640R2's right (Accept) and left (Decline) buttons. This is an image of the GUI application |
| 152 | +after accepting a an incoming call: |
| 153 | + |
| 154 | +<img src="resource/ANCS_demo_figure12.png" width="1000" height="400" /> |
| 155 | + |
| 156 | +**Note:** If the mobile Apple device generates any new notifications, the ANCS Demo |
| 157 | +will automatically retrieve the notification's data and display it respectively. |
| 158 | + |
| 159 | + |
| 160 | +## <a name="UART Demonstration"></a>UART Demonstration |
| 161 | + |
| 162 | + |
| 163 | +This document will use PuTTY to serve as the display for the output of the |
| 164 | +CC2640R2 LaunchPad for the UART demonstration. Note that any other serial |
| 165 | +terminal application can be used. The following default parameters are used |
| 166 | + for the UART peripheral for display: |
| 167 | + |
| 168 | + UART Param |Default Values |
| 169 | + -------------- |---------------- |
| 170 | + Baud Rate |115200 |
| 171 | + Data length |8 bits |
| 172 | + Parity |None |
| 173 | + Stop bits |1 bit |
| 174 | + Flow Control |None |
| 175 | + |
| 176 | +Once the ANCS Demo application starts, the output to the terminal |
| 177 | +will report its address and the fact that it is advertising, as shown below: |
| 178 | + |
| 179 | +<img src="resource/ancs_demo_figure1.png" width="637" height="400" /> |
| 180 | + |
| 181 | +Advertising is enabled by default upon startup, so there is no need to |
| 182 | +physically press a button to start advertising. Unlock the mobile Apple device |
| 183 | +and open the Settings App. Open the Bluetooth settings tab and notice that "ANCS Demo" |
| 184 | +can now be connected to: |
| 185 | + |
| 186 | +<img src="resource/ancs_demo_figure2.png" width="300" height="533" /> |
| 187 | + |
| 188 | +Tap "ANCS Demo" to connect to it. The terminal will now display "Connected" and |
| 189 | +the address of the connected mobile Apple device as seen below: |
| 190 | + |
| 191 | +<img src="resource/ancs_demo_figure3.png" width="637" height="400" /> |
| 192 | + |
| 193 | +Back on the mobile Apple device a prompt asking to pair to "ANCS Demo" should appear: |
| 194 | + |
| 195 | +<img src="resource/ancs_demo_figure4.png" width="300" height="533" /> |
| 196 | + |
| 197 | +Tap "Pair" and the mobile Apple device should complete the bonding process with the ANCS Demo. |
| 198 | +The "ANCS Demo" should now appear with an "i" encompassed by a circle signifying |
| 199 | +stored bond data: |
| 200 | + |
| 201 | +<img src="resource/ancs_demo_figure5.png" width="300" height="533" /> |
| 202 | + |
| 203 | +Back on the terminal a stream of notification data should begin to be displayed. |
| 204 | +These notifications can be found in the mobile Apple device's Notification Center. |
| 205 | +With each notification seven articles of data will de displayed: |
| 206 | + |
| 207 | +1. The number of notifications left to be processed |
| 208 | +2. The category of the notification |
| 209 | +3. The iOS application producing the notification's ID |
| 210 | +4. The display name of the iOS application |
| 211 | +5. The title of the iOS application |
| 212 | +6. The message of the notification |
| 213 | +7. The date and time the notification was created |
| 214 | + |
| 215 | +<img src="resource/ancs_demo_figure6.png" width="637" height="400" /> |
| 216 | + |
| 217 | +Additionally, if the mobile Apple device receives an incoming call, the call |
| 218 | +can be declined by pressing the button on the right side of the device. |
| 219 | +Alternatively, the call can be accepted by pressing the button on the left |
| 220 | +side of the device. |
| 221 | + |
| 222 | +This is an example UART output of a call being declined: |
| 223 | + |
| 224 | +<img src="resource/ancs_demo_figure7.png" width="637" height="400" /> |
| 225 | + |
| 226 | +**Note:** If the mobile Apple device generates any new notifications, the ANCS Demo |
| 227 | +will automatically retrieve the notification's data and display it respectively. |
0 commit comments