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/att.h> 10 #include <zephyr/bluetooth/bluetooth.h> 11 #include <zephyr/bluetooth/gatt.h> 12 #include <zephyr/bluetooth/uuid.h> 13 #include <zephyr/net_buf.h> 14 15 /** Perform a single ATT_READ_BY_TYPE_REQ. */ 16 int bt_testlib_att_read_by_type_sync(struct net_buf_simple *result_data, uint16_t *result_size, 17 uint16_t *result_handle, uint16_t *result_att_mtu, 18 struct bt_conn *conn, enum bt_att_chan_opt bearer, 19 const struct bt_uuid *type, uint16_t start_handle, 20 uint16_t end_handle); 21 22 /** If offset == 0, perform a single ATT_READ_REQ. 23 * If offset > 0, perform a signle ATT_READ_BLOB_REQ. 24 */ 25 int bt_testlib_att_read_by_handle_sync(struct net_buf_simple *result_data, uint16_t *result_size, 26 uint16_t *result_att_mtu, struct bt_conn *conn, 27 enum bt_att_chan_opt bearer, uint16_t handle, 28 uint16_t offset); 29 30 int bt_testlib_gatt_long_read(struct net_buf_simple *result_data, uint16_t *result_size, 31 uint16_t *result_att_mtu, struct bt_conn *conn, 32 enum bt_att_chan_opt bearer, uint16_t handle, uint16_t offset); 33 34 int bt_testlib_gatt_discover_primary(uint16_t *result_handle, uint16_t *result_end_handle, 35 struct bt_conn *conn, const struct bt_uuid *uuid, 36 uint16_t start_handle, uint16_t end_handle); 37 38 /* Note: svc_end_handle must be the service end handle. (The discovery 39 * algorithm requires it to recognize the last characteristic in a 40 * service and deduce its end handle.) 41 */ 42 int bt_testlib_gatt_discover_characteristic(uint16_t *const result_value_handle, 43 uint16_t *const result_end_handle, 44 uint16_t *const result_def_handle, struct bt_conn *conn, 45 const struct bt_uuid *uuid, uint16_t start_handle, 46 uint16_t svc_end_handle); 47 48 #endif /* ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ATT_READ_H_ */ 49