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