nRF51 SDK: Alert Notification Application

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Alert Notification Application

# Alert Notification Application

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

The source code and project file can be found in the `<InstallFolder>\Nordic\nrf51822\Board\nrf6310\s110\ble_app_alert_notification` folder.

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

- Alert Notification Service Client

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

# Setup

Instructions on how to set up the nRFgo Motherboard: nRFgo Motherboard Setup (nRF6310).

LED assignments:

- LED 0: Advertising
- LED 1: Connected
- LED 2: New Alert Notification received
- LED 3: Unread Alert Notification received
- LED 7: Asserted (i.e. an assert check in the application has failed)

Buttons assignments:

- Button 0: Wake-up from system-off and restart advertising.
- Button 1: Wake-up from system-off, erase all bonds and restart advertising.
- Button 2: Clear the received New Alert (i.e. when LED 2 is on), otherwise toggle the New Alert Notifications on/off (i.e. writing of the CCCD).
- Button 3: Clear the received New Alert (i.e. when LED 3 is on), otherwise toggle the Unread Alert Notifications on/off (i.e. writing of the CCCD).

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, it will be indicated by the New Alert Notification LED. When an Unread Alert Notification is received, it will be indicated by the Unread Alert Notification LED. The Alert state can be cleared by pressing the corresponding button.

# Testing

The Alert Notification Application can be tested using the Master Control Panel as follows:

1. Compile and program the application. Observe that the Advertising LED is lit.
2. In the Master Control Panel create the Alert Notification Service(ANS) 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_alert_notification folder and load the file named AlertNotifServer.bin.
   - Press 'Stop server' and then 'Start server'.
   - Set the values of characteristics with UUID 0x2A47 and 0x2A48 to 0xFF.
   - It is important to keep the 'Server Setup' window opened.
3. Select to the device from Master Control Panel (the device will be advertising as 'Nordic_Alert_Notif'), then connect and perform service discovery. Observe that the Connected LED is lit, and the Advertising LED is off.
4. Upon connection, verify in the 'Server Setup', that the Client Characteristic Configuration descriptor (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 LED2 is lit.
7. Press button 2 one time. Check that LED2 turns off.
8. Press button 2 again. Verify in 'Server Setup', that the CCCD for 0x2A46 is set to 0000. Check that the LED2 is still off.
9. Set the value of characteristic 0x2A46 to '01-03' in the 'Server Setup', and press 'update'. Verify that LED2 is still off.
10. Press button 2 again. Verify in 'Server Setup', that the CCCD for 0x2A46 is set to 0001. Check that the LED2 is off.
11. Set the value of characteristic 0x2A46 to '01-03' in the 'Server Setup', and press 'update'. Verify that LED2 is lit.
12. Set the value of characteristic 0x2A45 to '01-02-41-42-43' in the 'Server Setup', and press 'update'. Verify that LED3 is lit.
13. Press button 3 one time. Check that LED3 turns off.
14. Press button 3 again. Verify in 'Server Setup', that the CCCD for 0x2A45 is set to 0000. Check that the LED3 is still off.
15. Disconnect from the Master Control Panel and observe that the only the advertising LED is lit.
16. Wait until the application goes to system-off (all LEDs off).
17. Press button 0 and connect to the Master Control Panel. Observe that Connected LED is lit.
18. Disconnect from the Master Control Panel.