Skip to content

Commit

Permalink
[nrf fromlist] samples: Bluetooth: Only connect to devices with rssi …
Browse files Browse the repository at this point in the history
…below -50

When the Bluetooth central samples in an open air environment
it is very likely that there are multiple devices nearby with
a received signal strength stronger than -70 dBm.

To avoid connecting to the wrong device, make the check stricter.

For tests using those samples, the NtNcable attenuation is changed
from the default 60 dBm to 40 dBm to satisfy the new requirement.

Upstream PR: zephyrproject-rtos/zephyr#68870

Signed-off-by: Rubin Gerritsen <[email protected]>
  • Loading branch information
rugeGerritsen authored and rlubos committed Feb 19, 2024
1 parent f41b357 commit 2c8d14a
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion samples/bluetooth/central/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
printk("Device found: %s (RSSI %d)\n", addr_str, rssi);

/* connect only to devices in close proximity */
if (rssi < -70) {
if (rssi < -50) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
}

/* connect only to devices in close proximity */
if (rssi < -70) {
if (rssi < -50) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/central_iso/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
printk("Device found: %s (RSSI %d)\n", addr_str, rssi);

/* connect only to devices in close proximity */
if (rssi < -70) {
if (rssi < -50) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
printk("Device found: %s (RSSI %d)\n", addr_str, rssi);

/* connect only to devices in close proximity */
if (rssi < -70) {
if (rssi < -50) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
printk("Device found: %s (RSSI %d)\n", addr_str, rssi);

/* connect only to devices in close proximity */
if (rssi < -70) {
if (rssi < -50) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/unicast_audio_client/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
printk("Device found: %s (RSSI %d)\n", addr_str, rssi);

/* connect only to devices in close proximity */
if (rssi < -70) {
if (rssi < -50) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ Execute ./bs_${BOARD}_tests_bsim_bluetooth_audio_samples_unicast_audio_client_pr
-testid=unicast_client

Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
-D=2 -sim_length=20e6 $@
-D=2 -sim_length=20e6 $@ -argschannel -at=40

wait_for_background_jobs #Wait for all programs in background and return != 0 if any fails
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ Execute "$peripheral_exe" \
-v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral -RealEncryption=1

Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
-D=2 -sim_length=60e6 $@
-D=2 -sim_length=60e6 $@ -argschannel -at=40

wait_for_background_jobs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Execute ./bs_${BOARD}_tests_bsim_bluetooth_ll_multiple_id_prj_conf\
-v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral

Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
-D=2 -sim_length=4500e6 $@
-D=2 -sim_length=4500e6 $@ -argschannel -at=40

wait_for_background_jobs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ Execute ./bs_${BOARD}_tests_bsim_bluetooth_ll_throughput_prj_conf\
-v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral

Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
-D=2 -sim_length=60e6 $@
-D=2 -sim_length=60e6 $@ -argschannel -at=40

wait_for_background_jobs

0 comments on commit 2c8d14a

Please sign in to comment.