1 /**
2  * @file
3  * @brief Internal APIs for Bluetooth CSIP
4  *
5  * Copyright (c) 2021-2022 Nordic Semiconductor ASA
6  *
7  * SPDX-License-Identifier: Apache-2.0
8  */
9 
10 #include <stdint.h>
11 
12 #include <zephyr/bluetooth/audio/csip.h>
13 #include <zephyr/bluetooth/conn.h>
14 #include <zephyr/bluetooth/gatt.h>
15 
16 #define BT_CSIP_SIRK_TYPE_ENCRYPTED             0x00
17 #define BT_CSIP_SIRK_TYPE_PLAIN                 0x01
18 
19 #define BT_CSIP_RELEASE_VALUE                   0x01
20 #define BT_CSIP_LOCK_VALUE                      0x02
21 
22 struct bt_csip_sirk {
23 	uint8_t type;
24 	/* SIRK stored in little endian byte order. */
25 	uint8_t value[BT_CSIP_SIRK_SIZE];
26 } __packed;
27 
28 struct bt_csip_set_coordinator_svc_inst *bt_csip_set_coordinator_lookup_instance_by_index(
29 	const struct bt_conn *conn, uint8_t idx);
30 
31 struct bt_csip_set_coordinator_svc_inst {
32 	uint8_t set_lock;
33 
34 	uint16_t start_handle;
35 	uint16_t end_handle;
36 	uint16_t sirk_handle;
37 	uint16_t set_size_handle;
38 	uint16_t set_lock_handle;
39 	uint16_t rank_handle;
40 
41 	uint8_t idx;
42 	struct bt_gatt_subscribe_params sirk_sub_params;
43 	struct bt_gatt_discover_params sirk_sub_disc_params;
44 	struct bt_gatt_subscribe_params size_sub_params;
45 	struct bt_gatt_discover_params size_sub_disc_params;
46 	struct bt_gatt_subscribe_params lock_sub_params;
47 	struct bt_gatt_discover_params lock_sub_disc_params;
48 
49 	struct bt_conn *conn;
50 	struct bt_csip_set_coordinator_set_info *set_info;
51 };
52 
53 struct bt_csip_set_coordinator_csis_inst *
54 bt_csip_set_coordinator_csis_inst_by_handle(struct bt_conn *conn, uint16_t start_handle);
55