1 /*
2  * Copyright (c) 2023 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <stdint.h>
8 
9 #include <zephyr/logging/log.h>
10 #include <zephyr/bluetooth/addr.h>
11 #include <zephyr/bluetooth/conn.h>
12 #include <zephyr/bluetooth/bluetooth.h>
13 
14 #include "bs_bt_utils.h"
15 #include "babblekit/testcase.h"
16 #include "babblekit/flags.h"
17 
18 LOG_MODULE_REGISTER(test_central, LOG_LEVEL_DBG);
19 
20 BUILD_ASSERT(CONFIG_BT_BONDABLE, "CONFIG_BT_BONDABLE must be enabled by default.");
21 
central(void)22 void central(void)
23 {
24 	LOG_DBG("===== Central =====");
25 
26 	bs_bt_utils_setup();
27 
28 	scan_connect_to_first_result();
29 	wait_connected();
30 	set_security(BT_SECURITY_L2);
31 
32 	TAKE_FLAG(flag_pairing_complete);
33 	TAKE_FLAG(flag_bonded);
34 
35 	LOG_DBG("Wait for disconnection...");
36 	wait_disconnected();
37 
38 	clear_g_conn();
39 
40 	TEST_PASS("PASS");
41 }
42