nRF5 SDK v15.2.0
Alert Notification Application
This example requires one of the following SoftDevices: S112, S132, S140

Important: Before you run this example, make sure to program the SoftDevice.

The Alert Notification Application is an example that implements the client role of the Alert Notification Profile using the hardware delivered in the nRF5 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 Button 1 to wake it up and to make it restart advertising.

Setup

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\ble_peripheral\ble_app_alert_notification

Button assignments - in addition to those defined in BSP BLE Button Assignments:

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.

The following table shows the format of a New Alert Notification and example values:

Category ID Number of New Alerts Text String Information
0x03 - Incoming call 0x01 - 1 new incoming call 0x4D 0x61 0x72 0x79 - "Mary"

The following table shows the format of an Unread Alert Notification and example values:

Category ID Number of New Alerts
0x01 - Email 0x04 - 4 unread emails

Testing

Test the Alert Notification Application with nRF Connect by performing the following steps:

  1. Start a terminal emulator like PuTTY and connect to the used COM port with the following UART settings:
    • Baud rate: 115.200
    • 8 data bits
    • 1 stop bit
    • No parity
    • HW flow control: None
  2. Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
  3. In nRF Connect, create the Alert Notification Service (ANS) server by performing the following steps:
    1. In Server Setup, click the settings button and select "Load setup".
    2. In the resulting window, navigate to the <InstallFolder>\examples\ble_peripheral\ble_app_alert_notification folder. Load the file AlertNotifServer.ncs.
    3. Click "Apply to device" and navigate back to Connection Map.
    4. Set the values of characteristics with UUID 0x2A47 and 0x2A48 to 0xFF. This tells the application that the server supports all categories of both New Alert Notification and Unread Alert Notification. These values cannot be changed after a connection is established.
  4. Bond to the device from nRF Connect (the device is advertising as 'Nordic_Alert_Notif'). To bond, click the settings button for the server in nRF Connect, select "Security parameters", check "Perform Bonding", and click "Apply". Then connect to the device. Observe that the BSP_INDICATE_CONNECTED state is indicated.
  5. Upon connection, verify that the Client Characteristic Configuration descriptors (CCCD) for the Unread Alert characteristic (0x2A45) and the New Alert characteristic (0x2A46) are set to '01 00' (Alert Notification Enabled).
  6. Upon connection, verify that the Alert Notification Control Point (0x2A44) is written with the values 0x01 0xFF (Enable Unread Status Notification for all categories).
  7. Set the value of the New Alert characteristic (0x2A46) to '03 01 4D 61 72 79' and click the 'write' button. This sets the New Alert Notification. The value '03 01 4D 61 72 79' is interpreted as the server having 1 new incoming call from "Mary". Verify that the correct data is printed on the UART and that the BSP_INDICATE_ALERT_0 state is indicated.
  8. Press Button 1 once. This clears the New Alert Notification. Verify that the message "New Alert State: Off." is printed on the UART and that the BSP_INDICATE_ALERT_0 state is cleared.
  9. Press Button 1 again. This disables the New Alert Notification. Verify in 'Server Setup' that the CCCD for 0x2A46 is set to '00 00' and that the message "New Alert State: Disabled." is printed on the UART.
  10. Set the value of the New Alert characteristic (0x2A46) to '03 02' and click the 'write' button. This message should not be handled because New Alert Notification is Disabled.
  11. Press Button 1 again. This enables the New Alert Notification. Verify in 'Server Setup' that the CCCD for 0x2A46 is set to '01 00'. Verify that the message "New Alert State: Enabled." is printed on the UART and that the BSP_INDICATE_ALERT_0 state is cleared.
  12. Set the value of the New Alert characteristic (0x2A46) to '03 02' and click the 'write' button. This sets the New Alert Notification. The value '03 02' is interpreted as the server having 2 new incoming calls. Verify that the correct data is printed on the UART and that the BSP_INDICATE_ALERT_0 state is indicated.
  13. Set the value of the Unread Alert characteristic (0x2A45) to '01 04' and click the 'write' button. This sets the Unread Alert Notification. The value '01 04' is interpreted as the server having 4 unread email notifications. Verify that the correct data is printed on the UART and that the BSP_INDICATE_ALERT_1 state is indicated.
  14. Press Button 2 once. This clears the Unread Alert Notification. Verify that the message "New Alert State: Off." is printed on the UART and that the BSP_INDICATE_ALERT_1 state is cleared.
  15. Press Button 2 again. This disables the Unread Alert Notification. Verify in 'Server Setup' that the CCCD for 0x2A45 is set to '00 00' and that the message "New Alert State: Disabled." is printed on the UART.
  16. Disconnect the device in nRF Connect and observe that the BSP_INDICATE_ADVERTISING state is indicated.
  17. Wait until the application goes to system-off (BSP_INDICATE_IDLE).
  18. Press Button 1 and reconnect to nRF Connect. Observe that the BSP_INDICATE_CONNECTED state is indicated.
  19. Disconnect from nRF Connect.

Documentation feedback | Developer Zone | Subscribe | Updated