Bluetooth: Peripheral GATT Discovery Manager

The Peripheral GATT Discovery Manager sample demonstrates how to use the GATT Discovery Manager.

Overview

When connected to another device, the sample discovers the services of the connected device and outputs the service information.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF5340 DK

PCA10095

nrf5340dk_nrf5340

nrf5340dk_nrf5340_cpuapp

nrf5340dk_nrf5340_cpuapp_ns

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

nRF52 DK

PCA10040

nrf52dk_nrf52832

nrf52dk_nrf52832

nRF52833 DK

PCA10100

nrf52833dk_nrf52833

nrf52833dk_nrf52833

nRF52833 DK (emulating nRF52820)

PCA10100

nrf52833dk_nrf52820

nrf52833dk_nrf52820

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.

Building and running

This sample can be found under samples/bluetooth/peripheral_gatt_dm in the nRF Connect SDK folder structure.

See Building and programming an application for information about how to build and program the application.

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.

  1. 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.

  2. Connect to the kit with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.

  3. 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.

  4. 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

  • Bluetooth:

    • include/bluetooth/bluetooth.h

    • include/bluetooth/hci.h

    • include/bluetooth/conn.h

    • include/bluetooth/uuid.h

    • include/bluetooth/gatt.h