nRF51 SDK - S110 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Alert Notification Application

The Alert Notification Application is an example that implements the client role of the Alert Notification Profile using the hardware delivered in the nRF51 Development Kit.

The application includes one mandatory client needed for the Alert Notification Profile:

Note
This application is not power optimized!
The application will stop advertising after 3 minutes and 30 seconds and go to system-off mode. Push the button 1 to wake it up and to make it restart advertising.

Setup

The name of the example is ble_app_alert_notification_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\ble_app_alert_notification

Button assignments when in system-off:

  • Button 1: Wake up from system-off and restart advertising.
  • Button 2: Wake up from system-off, erase all bonds, and restart advertising.

Button assignments when connected:

  • Button 1: Check the current state of new alert and enable, disable, or clear the alert depending on the state.
  • Button 2: Check the current state of unread alert and enable, disable, or clear the alert depending on the state.
  • Button 3: Request peer to notify all current alert statuses.

The Alert Notification Application does fast advertising for 30 seconds at power up and also after a disconnection. It will then switch to slow advertising mode for 180 seconds. After 180 seconds of slow advertising, the board will go to system-off.

When a new alert notification is received, this is indicated by the state BSP_INDICATE_ALERT_0. When an unread alert notification is received, this is indicated by the state BSP_INDICATE_ALERT_1. The alert state can be cleared by pressing the corresponding button.

Testing

Test the Alert Notification Application with the Master Control Panel by performing the following steps:

  1. Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
  2. In the Master Control Panel, create the Alert Notification Service (ANS) server by performing the following steps:
    1. Click File -> Server Setup. In the window that opens up, click File -> Load setup.
    2. In the resulting window, navigate to the <InstallFolder>\Nordic\nrf51\examples\ble_peripheral\ble_app_alert_notification folder. If you are using Keil packs, this folder is located at <KeilFolder>\ARM\Pack\NordicSemiconductor\nRF_Examples\<version>\ble_peripheral\ble_app_alert_notification. Load the file AlertNotifServer.bin.
    3. Click 'Stop server' and then 'Start server'.
    4. Set the values of characteristics with UUID 0x2A47 and 0x2A48 to 0xFF.
    5. You must keep the 'Server Setup' window opened.
  3. Select the device from Master Control Panel (the device will be advertising as 'Nordic_Alert_Notif'), then connect and perform service discovery. Observe that the BSP_INDICATE_CONNECTED state is indicated.
  4. Upon connection, verify in the 'Server Setup' that the Client Characteristic Configuration descriptors (CCCD) for 0x2A45 and 0x2A46 are set to 0001.
  5. Upon connection, verify in the 'Server Setup' that the Alert Notification Control Point, 0x2A44, is written with the values 0x01 0x03.
  6. Set the value of characteristic 0x2A46 to '01-02' in the 'Server Setup' and press 'update'. Verify that the BSP_INDICATE_ALERT_0 state is indicated.
  7. Press button 1 one time. Verify that the BSP_INDICATE_ALERT_0 state is cleared.
  8. Press button 1 again. Verify in 'Server Setup' that the CCCD for 0x2A46 is set to 0000.
  9. Set the value of characteristic 0x2A46 to '01-03' in the 'Server Setup' and press 'update'. Verify that the BSP_INDICATE_ALERT_0 state is cleared.
  10. Press button 1 again. Verify in 'Server Setup' that the CCCD for 0x2A46 is set to 0001. Verify that the BSP_INDICATE_ALERT_0 state is cleared.
  11. Set the value of characteristic 0x2A46 to '01-03' in the 'Server Setup' and press 'update'. Verify that the BSP_INDICATE_ALERT_0 state is indicated.
  12. Set the value of characteristic 0x2A45 to '01-02-41-42-43' in the 'Server Setup' and press 'update'. Verify that the BSP_INDICATE_ALERT_1 state is indicated.
  13. Press button 2 one time. Verify that the BSP_INDICATE_ALERT_1 state is cleared.
  14. Press button 2 again. Verify in 'Server Setup' that the CCCD for 0x2A45 is set to 0000.
  15. Disconnect from the Master Control Panel and observe that the BSP_INDICATE_ADVERTISING state is indicated.
  16. Wait until the application goes to system-off (BSP_INDICATE_IDLE).
  17. Press button 1 and connect to the Master Control Panel. Observe that the BSP_INDICATE_CONNECTED state is indicated.
  18. Disconnect from the Master Control Panel.