1 /* Copyright (c) 2023 Nordic Semiconductor ASA 2 * SPDX-License-Identifier: Apache-2.0 3 */ 4 5 #ifndef ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ATT_READ_H_ 6 #define ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ATT_READ_H_ 7 8 #include <stdint.h> 9 #include <zephyr/bluetooth/gatt.h> 10 11 /** Perform a single ATT_READ_BY_TYPE_REQ. */ 12 int bt_testlib_att_read_by_type_sync(struct net_buf_simple *result_data, uint16_t *result_size, 13 uint16_t *result_handle, uint16_t *result_att_mtu, 14 struct bt_conn *conn, enum bt_att_chan_opt bearer, 15 const struct bt_uuid *type, uint16_t start_handle, 16 uint16_t end_handle); 17 18 /** If offset == 0, perform a single ATT_READ_REQ. 19 * If offset > 0, perform a signle ATT_READ_BLOB_REQ. 20 */ 21 int bt_testlib_att_read_by_handle_sync(struct net_buf_simple *result_data, uint16_t *result_size, 22 uint16_t *result_att_mtu, struct bt_conn *conn, 23 enum bt_att_chan_opt bearer, uint16_t handle, 24 uint16_t offset); 25 26 int bt_testlib_gatt_long_read(struct net_buf_simple *result_data, uint16_t *result_size, 27 uint16_t *result_att_mtu, struct bt_conn *conn, 28 enum bt_att_chan_opt bearer, uint16_t handle, uint16_t offset); 29 30 int bt_testlib_gatt_discover_primary(uint16_t *result_handle, uint16_t *result_end_handle, 31 struct bt_conn *conn, const struct bt_uuid *uuid, 32 uint16_t start_handle, uint16_t end_handle); 33 34 /* Note: svc_end_handle must be the service end handle. (The discovery 35 * algorithm requires it to recognize the last characteristic in a 36 * service and deduce its end handle.) 37 */ 38 int bt_testlib_gatt_discover_characteristic(uint16_t *const result_value_handle, 39 uint16_t *const result_end_handle, 40 uint16_t *const result_def_handle, struct bt_conn *conn, 41 const struct bt_uuid *uuid, uint16_t start_handle, 42 uint16_t svc_end_handle); 43 44 #endif /* ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ATT_READ_H_ */ 45