This example requires one of the following SoftDevices: S132, S140
Important: Before you run this example, make sure to program the SoftDevice.
The bluetoothds_template application is an example that you can use as a starting point for developing your own application using services generated by Bluetooth Developer Studio.
- Note
- The application will stop advertising after 3 minutes and go to system-off mode. Push Button 1 to wake it up and restart advertising.
Implementation
To implement your own application, you must first generate a custom profile in Bluetooth Developer Studio. You can then use this custom profile in the example application.
Generating a custom profile
- Create a custom profile:
- Click File > New.
- Rename the Project to, for example, "Test project".
- Enter a string for NAMESPACE, for example "com.MyCompany".
- Rename the Profile to, for example, "Test Profile"
- Create a custom service:
- Click CUSTOM SERVICE.
- Rename the new service to, for example, "Test profile test service".
- Add a new characteristic:
- Click +.
- Rename the new characteristic to, for example, "RX".
- Set the Read/Write/Notify/Indicate properties. For example, set "Write Without Response" to "Mandatory".
- Add fields to the characteristic. For example, add a "value" field with format "_VARIABLE".
- Add further characteristics, if required. For example, add a "TX" characteristic with the Notify property set to "Mandatory" and a "_VARIABLE" field named "value".
- Generate the code:
- Click Tools > Generate Code.
- Select "Server" and "NORDIC SEMICONDUCTOR NRF5X V1.1.x".
Including the custom profile
In the Keil project, add the source file of the service by adding ble_test_profile_test_service.c
to the group nRF_BLE.
Setup
You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\ble_peripheral\experimental\bluetoothds_template
Buttons assignments:
- Button 1: Wake up and start advertising.
Testing
Test the Template Application with nRF Connect by performing the following steps:
- Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
- Connect to the device from nRF Connect (the device is advertising as 'Nordic_BDS'). Observe that the BSP_INDICATE_CONNECTED state is indicated.
- Disconnect the device in nRF Connect and observe that the BSP_INDICATE_ADVERTISING state is indicated. You can wait for 3 minutes and observe that the BSP_INDICATE_IDLE is indicated.
- In system-off mode, press Button 1 and observe that the application starts advertising again.