Important: Before you run this example, make sure to program a 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
-
If you want to use tracing, define the APP_LOG macro:
#define APPL_LOG app_trace_log
-
In the Keil project, add the source file of the service by adding
ble_test_profile_test_service.cto the group nRF_BLE.
Setup
The name of the example is
bluetoothds_template_
SoftDevice
_pca10028
, where
SoftDevice
is the SoftDevice that you are using. 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>\examples\ble_peripheral\experimental_bluetoothds_template
Buttons assignments:
- Button 1: Wake up and start advertising.
Testing
Test the Template Application with the Master Control Panel by performing the following steps:
- Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
- Connect to the device from Master Control Panel (the device will be advertising as 'Nordic_BDS'), then connect and perform service discovery. Observe that the BSP_INDICATE_CONNECTED state is indicated.
- Disconnect 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. The application starts advertising again.