1 /* main_lowres.c - Application main entry point */
2 
3 /*
4  * Copyright (c) 2023 Nordic Semiconductor
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  */
8 
9 #include "common.h"
10 
test_peripheral_main(void)11 static void test_peripheral_main(void)
12 {
13 	peripheral_setup_and_connect();
14 
15 	while (bt_eatt_count(default_conn) < CONFIG_BT_EATT_MAX) {
16 		k_sleep(K_MSEC(10));
17 	}
18 
19 	disconnect();
20 
21 	PASS("EATT Peripheral tests Passed\n");
22 }
23 
test_central_main(void)24 static void test_central_main(void)
25 {
26 	central_setup_and_connect();
27 
28 	/* Central (us) will try to open 5 channels.
29 	 * Peripheral will only accept and open 2.
30 	 *
31 	 * The purpose of the test is to verify that the accepted EATT channels
32 	 * still get opened when the response to the ecred conn req is "Some
33 	 * connections refused - not enough resources available".
34 	 */
35 
36 	wait_for_disconnect();
37 
38 	PASS("EATT Central tests Passed\n");
39 }
40 
41 static const struct bst_test_instance test_def[] = {
42 	{
43 		.test_id = "peripheral_lowres",
44 		.test_descr = "Peripheral lowres",
45 		.test_pre_init_f = test_init,
46 		.test_tick_f = test_tick,
47 		.test_main_f = test_peripheral_main,
48 	},
49 	{
50 		.test_id = "central_lowres",
51 		.test_descr = "Central lowres",
52 		.test_pre_init_f = test_init,
53 		.test_tick_f = test_tick,
54 		.test_main_f = test_central_main,
55 	},
56 	BSTEST_END_MARKER,
57 };
58 
test_main_lowres_install(struct bst_test_list * tests)59 struct bst_test_list *test_main_lowres_install(struct bst_test_list *tests)
60 {
61 	return bst_add_tests(tests, test_def);
62 }
63