Bluetooth: Peripheral GATT Discovery Manager
The Peripheral GATT Discovery Manager sample demonstrates how to use the GATT Discovery Manager.
Requirements
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
Build target |
---|---|---|---|
PCA10095 |
|
||
PCA10040 |
|
||
PCA10056 |
|
When built for an _ns
build target, the sample is configured to compile and run as a non-secure application.
Therefore, it automatically includes Trusted Firmware-M that prepares the required peripherals and secure services to be available for the application.
The sample also requires a device to connect to the peripheral, for example, a phone or a tablet with nRF Connect for Mobile or nRF Toolbox.
Overview
When connected to another device, the sample discovers the services of the connected device and outputs the service information.
User interface
- Button 1:
During the pairing procedure, press this button to accept the pairing.
- Button 2:
During the pairing procedure, press this button to reject the pairing.
Building and running
This sample can be found under samples/bluetooth/peripheral_gatt_dm
in the nRF Connect SDK folder structure.
When built as a non-secure firmware image for the _ns
build target, the sample automatically includes the Trusted Firmware-M (TF-M).
To build the sample with Visual Studio Code, follow the steps listed on the Building nRF Connect SDK application quick guide page in the nRF Connect for VS Code extension documentation. See Building and programming an application for other building and programming scenarios and Testing and debugging an application for general information about testing and debugging in the nRF Connect SDK.
Testing
After programming the sample to your dongle or development kit, test it by performing the following steps. This testing procedure assumes that you are using nRF Connect for Mobile.
Connect the kit to the computer using a USB cable. The kit is assigned a COM port (Windows) or ttyACM device (Linux), which is visible in the Device Manager.
Connect to the kit with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.
Connect to the device from nRF Connect (the device is advertising as “Nordic Discovery Sample”). When connected, the sample starts discovering the services of the connected device.
Observe that the services of the connected device are printed in the terminal emulator.
Dependencies
This sample uses the following nRF Connect SDK libraries:
In addition, it uses the following Zephyr libraries:
include/zephyr/types.h
lib/libc/minimal/include/errno.h
include/sys/printk.h
include/sys/byteorder.h
-
include/bluetooth/bluetooth.h
include/bluetooth/hci.h
include/bluetooth/conn.h
include/bluetooth/uuid.h
include/bluetooth/gatt.h
The sample also uses the following secure firmware component: