• Home
  • Annotate
  • current directory
Name Date Size #Lines LOC

..22-Aug-2025-

boards/22-Aug-2025-

src/22-Aug-2025-

CMakeLists.txt A D22-Aug-2025273 128

README.rst A D22-Aug-20252 KiB6246

prj.conf A D22-Aug-202534 32

sample.yaml A D22-Aug-2025709 2625

README.rst

1.. zephyr:code-sample:: ble_central
2   :name: Central
3   :relevant-api: bluetooth
4
5   Implement basic Bluetooth LE Central role functionality
6   (scanning and connecting).
7
8Overview
9********
10
11This application demonstrates basic Bluetooth LE Central role functionality
12by scanning for other Bluetooth LE devices and establishing a connection
13to the first one with a strong enough signal.
14
15Core features
16*************
17
18Scanning for devices
19====================
20
21The application initiates a passive scan to detect nearby Bluetooth LE devices.
22It specifically looks for devices that have a signal strength greater
23than -50dBm. This threshold helps the app filter out weaker signals,
24ensuring it only interacts with devices that are within a reasonable RSSI
25range for communication.
26
27Connection handling
28===================
29
301. The Central scans for Peripheral devices and if it finds a Peripheral
31   which has a signal strength higher than -50dBm, an attempt to establish
32   LE connection is made.
332. If the connection is successful, the Central initiates disconnect to
34   the Peripheral and then restarts the scan.
353. If there are no connections, the Central keeps scanning continuously.
36
37The sample is used to demonstrate the Central mode capabilities of Bluetooth LE and
38hence a disconnect is issued right immediately after establishing a connection with
39a Peripheral, allowing the Central to resume scanning for other devices.
40
41Requirements
42************
43
44* BlueZ running on the host, or
45* A board with Bluetooth LE support
46
47Building and running
48********************
49
50Build and flash the sample as follows, replacing board_name with your
51target board:
52
53.. zephyr-app-commands::
54   :zephyr-app: samples/bluetooth/central
55   :board: board_name
56   :goals: build flash
57   :compact:
58
59To test Central's scanning functionality, either flash the :zephyr:code-sample:`ble_peripheral`
60sample on a second compatible board or use an off-the-shelf Bluetooth LE enabled
61device that can act as a Peripheral (eg. smartphone, smartwatch, etc.).
62