| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Experimental: Location and Navigation Application
This example requires one of the following SoftDevices: S130, S132

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

The Location and Navigation Service (LNS) Application is an example that implements the Location and Navigation Profile.

The application includes the three services in Location and Navigation Profile:

- Location and Navigation Service
- Battery Service
- Device Information Service

When the application starts, the Board Support Package is initialized. Timers are started to control the generation of various parts of the Location and Navigation Profile. Each time-out handler updates a simulation of sensor values. This includes updating

- The battery level.
- All fields of the Location and Navigation Service. The values are updated for demonstration purposes only and do not represent realistic measurements.

Note
  This application is not power optimized!
  The application will stop advertising after 3 minutes and go to system-off mode. Push Button 1 to restart advertising.

# Setup

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

Button assignments: BSP BLE Button Assignments

# Testing

Test the Location and Navigation Application with the nRF Toolbox app, which is available on both iOS (App Store) and Android (Google Play).

You can also test the application with the Master Control Panel by performing the following steps:

1. Connect the board to the computer using a USB cable. The board is assigned a COM port, which is visible in the Device Manager.
2. 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: RTS/CTS
3. Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated and that the device is advertising with the device name "Nordic_LNS".
4. Observe that the text "APP:INFO:Fast advertising" is printed on the COM listener running on the computer.
5. Connect to the device from Master Control Panel, then perform service discovery. Observe that the BSP_INDICATE_CONNECTED state is indicated.
6. Observe:
   - Primary service 0x1819 is the Location and Navigation Service.
     - Characteristic 0x2A6A is the feature characteristic UUID.
     - Characteristic 0x2A69 is the position quality characteristic UUID.
     - Characteristic 0x2A67 is the location and speed characteristic UUID.
     - Characteristic 0x2A68 is the navigation characteristic UUID.
     - Characteristic 0x2A6B is the control point characteristic UUID.
   - Primary service 0x180F is the Battery Service.
   - Primary service 0x180A is the Device Information Service.
7. Click the "Enable services" button in the Master Control Panel.
8. Observe that the text "Location/Speed: Notification enabled", "Control Point: Indication enabled", and "Navigation: Notification enabled" is printed on the COM listener running on the computer.
9. In the Master Control Panel, observe that notifications are received from the location and speed characteristic. The control point is configured for indication. The navigation characteristic is configured for notification, but does not yet send notifications.
10. Select the LNS control point characteristic in the Master Control Panel.
11. Write 0301 and click "Write". This command corresponds to "navigation control" - "start". Verify that "NAV_EVT: Navigation state changed to 1" is printed on the COM listener.
12. In the Master Control Panel, observe that the navigation characteristic sends notifications.
13. Write 0300 and click "Write". This command represents "navigation control" - "stop". Verify that "NAV_EVT: Navigation state changed to 0" is printed on the COM listener.
14. In the Master Control Panel, observe that the navigation characteristic stops sending notifications.
15. Press the "Disconnect" button in the Master Control Panel. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
16. If no peer connects to the application within 180 seconds (APP_ADV_TIMEOUT_IN_SECONDS), the application will put the chip into system-off mode.