1#!/usr/bin/env bash
2# Copyright (c) 2024 Nordic Semiconductor
3# SPDX-License-Identifier: Apache-2.0
4
5set -eu
6
7source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
8
9test_name="$(guess_test_long_name)"
10
11simulation_id=${test_name}
12
13SIM_LEN_US=$((40 * 1000 * 1000))
14
15test_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD_TS}_${test_name}_prj_conf"
16
17cd ${BSIM_OUT_PATH}/bin
18
19Execute ./bs_2G4_phy_v1 -dump_imm -s=${simulation_id} -D=3 -sim_length=${SIM_LEN_US} $@
20
21Execute "${test_exe}" -s=${simulation_id} -d=0 -rs=420 -RealEncryption=1 -testid=dut
22
23# Start centrals with an offset, so the CONN_IND packets don't clash on-air.
24# Since code executes in zero-time, this will always happen if we don't stagger
25# the connection creation somehow.
26Execute "${test_exe}" -s=${simulation_id} \
27    -d=1 -rs=169 -RealEncryption=1 -testid=central -delay_init -start_offset=1e3
28Execute "${test_exe}" -s=${simulation_id} \
29    -d=2 -rs=690 -RealEncryption=1 -testid=central -delay_init -start_offset=10e3
30
31wait_for_background_jobs
32