1 /* Copyright (c) 2024 Nordic Semiconductor ASA 2 * SPDX-License-Identifier: Apache-2.0 3 */ 4 5 #include "zephyr/sys/__assert.h" 6 #include <stdint.h> 7 #include <zephyr/bluetooth/gatt.h> 8 #include <zephyr/kernel.h> 9 #include <zephyr/logging/log.h> 10 11 #include <testlib/conn.h> 12 13 bt_testlib_disconnect(struct bt_conn ** connp,uint8_t reason)14int bt_testlib_disconnect(struct bt_conn **connp, uint8_t reason) 15 { 16 int err; 17 18 __ASSERT_NO_MSG(connp); 19 __ASSERT_NO_MSG(*connp); 20 21 err = bt_conn_disconnect(*connp, BT_HCI_ERR_REMOTE_USER_TERM_CONN); 22 23 if (!err) { 24 bt_testlib_wait_disconnected(*connp); 25 bt_testlib_conn_unref(connp); 26 } 27 28 return err; 29 } 30