Skip to content

Commit 1d2babf

Browse files
andrzej-kaczmarekcarlescufi
authored andcommitted
tests: Bluetooth: bsim: Handle consecutive connection in tests
If we want to test conn on legacy and ext adv, we need scanx to handle connection more than once. Change local flag to global and let it indicate whether we want scanx to initaite connection when device is scanned. Signed-off-by: Andrzej Kaczmarek <[email protected]>
1 parent 48735a3 commit 1d2babf

File tree

1 file changed

+5
-3
lines changed
  • tests/bluetooth/bsim_bt/bsim_test_advx/src

1 file changed

+5
-3
lines changed

tests/bluetooth/bsim_bt/bsim_test_advx/src/main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ static uint8_t per_adv_data2[] = {
9494
};
9595

9696
static bool volatile is_connected, is_disconnected;
97+
static bool volatile connection_to_test;
9798

9899
static void connected(struct bt_conn *conn, uint8_t conn_err)
99100
{
@@ -735,13 +736,12 @@ static void scan_cb(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_type,
735736
{
736737
printk("%s: type = 0x%x.\n", __func__, adv_type);
737738

738-
static bool connection_tested;
739739
struct bt_conn *conn;
740740

741-
if (!connection_tested) {
741+
if (connection_to_test) {
742742
int err;
743743

744-
connection_tested = true;
744+
connection_to_test = false;
745745

746746
err = bt_le_scan_stop();
747747
if (err) {
@@ -942,6 +942,8 @@ static void test_scanx_main(void)
942942
bt_le_per_adv_sync_cb_register(&sync_cb);
943943
printk("Success.\n");
944944

945+
connection_to_test = true;
946+
945947
printk("Start scanning...");
946948
err = bt_le_scan_start(&scan_param, scan_cb);
947949
if (err) {

0 commit comments

Comments
 (0)