|
| 1 | +.. _ble_hrs_central_sample: |
| 2 | + |
| 3 | +Bluetooth: Heart Rate Service Peripheral Central |
| 4 | +################################################ |
| 5 | + |
| 6 | +.. contents:: |
| 7 | + :local: |
| 8 | + :depth: 2 |
| 9 | + |
| 10 | +The Heart Rate Service Peripheral Central sample demonstrates how you can implement the Heart Rate profile as a server and client using |BMlong|. |
| 11 | + |
| 12 | +Requirements |
| 13 | +************ |
| 14 | + |
| 15 | +The sample supports the following development kits: |
| 16 | + |
| 17 | +.. tabs:: |
| 18 | + |
| 19 | + .. group-tab:: Simple board variants |
| 20 | + |
| 21 | + The following board variants do **not** have DFU capabilities: |
| 22 | + |
| 23 | + .. list-table:: |
| 24 | + :header-rows: 1 |
| 25 | + |
| 26 | + * - Hardware platform |
| 27 | + - PCA |
| 28 | + - SoftDevice |
| 29 | + - Board target |
| 30 | + * - `nRF54L15 DK`_ |
| 31 | + - PCA10156 |
| 32 | + - S145 |
| 33 | + - bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice |
| 34 | + * - `nRF54L15 DK`_ (emulating nRF54L10) |
| 35 | + - PCA10156 |
| 36 | + - S145 |
| 37 | + - bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice |
| 38 | + * - `nRF54L15 DK`_ (emulating nRF54L05) |
| 39 | + - PCA10156 |
| 40 | + - S145 |
| 41 | + - bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice |
| 42 | + |
| 43 | + .. group-tab:: MCUboot board variants |
| 44 | + |
| 45 | + The following board variants have DFU capabilities: |
| 46 | + |
| 47 | + .. list-table:: |
| 48 | + :header-rows: 1 |
| 49 | + |
| 50 | + * - Hardware platform |
| 51 | + - PCA |
| 52 | + - SoftDevice |
| 53 | + - Board target |
| 54 | + * - `nRF54L15 DK`_ |
| 55 | + - PCA10156 |
| 56 | + - S145 |
| 57 | + - bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice/mcuboot |
| 58 | + * - `nRF54L15 DK`_ (emulating nRF54L10) |
| 59 | + - PCA10156 |
| 60 | + - S145 |
| 61 | + - bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice/mcuboot |
| 62 | + * - `nRF54L15 DK`_ (emulating nRF54L05) |
| 63 | + - PCA10156 |
| 64 | + - S145 |
| 65 | + - bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice/mcuboot |
| 66 | + |
| 67 | +Overview |
| 68 | +******** |
| 69 | + |
| 70 | +This sample advertises and scans for devices that advertise with the :ref:`lib_ble_service_hrs` UUID (0x180D) and initiates a connection when a device is found. |
| 71 | +When a peripheral device is connected, the sample starts the service discovery procedure. |
| 72 | +If this succeeds, the sample subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications. |
| 73 | +If a client connects to this device the client subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications forwarded from the peripheral device. |
| 74 | + |
| 75 | +.. _ble_hrs_peripheral_central_sample_testing: |
| 76 | + |
| 77 | +User interface |
| 78 | +************** |
| 79 | + |
| 80 | +Button 0: |
| 81 | + Press to disable allow list. |
| 82 | + |
| 83 | +Button 1: |
| 84 | + Press to disconnect from the connected peripheral device. |
| 85 | + |
| 86 | + Keep the button pressed while resetting the board to delete bonding information for all peers stored on the device. |
| 87 | + |
| 88 | +Button 2: |
| 89 | + Press to disconnect from the connected client device. |
| 90 | + |
| 91 | + Keep the button pressed while resetting the board to delete bonding information for all peers stored on the device. |
| 92 | + |
| 93 | +LED 0: |
| 94 | + Lit when the device is initialized. |
| 95 | + |
| 96 | +LED 1: |
| 97 | + Lit when a peripheral device is connected. |
| 98 | + |
| 99 | +LED 2: |
| 100 | + Lit when a client device is connected. |
| 101 | + |
| 102 | +Building and running |
| 103 | +******************** |
| 104 | + |
| 105 | +This sample can be found under :file:`samples/bluetooth/ble_hrs_peripheral_central/` in the |BMshort| folder structure. |
| 106 | + |
| 107 | +For details on how to create, configure, and program a sample, see :ref:`getting_started_with_the_samples`. |
| 108 | + |
| 109 | +Testing |
| 110 | +======= |
| 111 | + |
| 112 | +This sample requires three devices to test, one running this sample, another one running the :ref:`ble_hrs_sample` sample, and another running the :ref:`ble_hrs_central_sample`. |
| 113 | + |
| 114 | +Complete the following steps to test the sample: |
| 115 | + |
| 116 | +1. Compile and program the application. |
| 117 | +#. In the Serial Terminal, observe that the ``Advertising as nRF_BM_HRS_Hub`` message is printed. |
| 118 | + You can configure the advertising name using the :kconfig:option:`CONFIG_SAMPLE_BLE_DEVICE_NAME` Kconfig option. |
| 119 | + For information on how to do this, see `Configuring Kconfig`_. |
| 120 | +#. Observe that the ``BLE HRS Peripheral Central sample initialized`` message is printed. |
| 121 | +#. Program the second development kit with the :ref:`ble_hrs_sample` sample. |
| 122 | +#. Program the third development kit with the :ref:`ble_hrs_central_sample` sample, set the :kconfig:option:`CONFIG_SAMPLE_TARGET_PERIPHERAL_NAME` Kconfig option to ``nRF_BM_HRS_Peripheral_Central``, and set the :kconfig:option:`CONFIG_SAMPLE_USE_TARGET_PERIPHERAL_NAME` Kconfig option to ``y``. |
| 123 | +#. Observe that the ``Scan filter match`` message is printed, followed by ``Connecting to target`` and ``Connected``, this will happen twice, once for each peer. |
| 124 | +#. Observe that the ``Heart rate service discovered.`` message is printed. |
| 125 | +#. Observe that the device starts receiving heart rate measurement notifications. |
| 126 | +#. Observe that the ``Sent heart rate to Central`` message is printed. |
0 commit comments