1 /**
2  * @file
3  * @brief Header for Bluetooth Audio Content Control Identifier.
4  *
5  * Copyright (c) 2020 Bose Corporation
6  * Copyright (c) 2021-2024 Nordic Semiconductor ASA
7  *
8  * SPDX-License-Identifier: Apache-2.0
9  */
10 
11 #ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CCID_H_
12 #define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CCID_H_
13 
14 /**
15  * @brief Bluetooth Content Control Identifier (CCID)
16  * @defgroup bt_ccid Bluetooth Content Control Identifier
17  *
18  * @since 3.7
19  * @version 0.8.0
20  *
21  * @ingroup bluetooth
22  * @{
23  *
24  * The Content Control Identifier (CCID) API manages CCIDs for @ref BT_UUID_CCID characteristics.
25  */
26 
27 #include <stdint.h>
28 
29 #include <zephyr/bluetooth/gatt.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /** Minimum CCID value */
36 #define BT_CCID_MIN 0
37 /** Maximum CCID value */
38 #define BT_CCID_MAX 255
39 
40 /**
41  * @brief Allocates a CCID value.
42  *
43  * This should always be called right before registering a GATT service that contains a
44  * @ref BT_UUID_CCID characteristic. Allocating a CCID without registering the characteristic
45  * may (in very rare cases) result in duplicated CCIDs on the device.
46  *
47  * Requires that @kconfig{CONFIG_BT_CONN} is enabled.
48  *
49  * @retval ccid 8-bit unsigned CCID value on success
50  * @retval -ENOMEM No more CCIDs can be allocated
51  */
52 int bt_ccid_alloc_value(void);
53 
54 /**
55  * @brief Get the GATT attribute of a CCID value
56  *
57  * Searches the current GATT database for a CCID characteristic that has the supplied CCID value.
58  *
59  * Requires that @kconfig{CONFIG_BT_CONN} is enabled.
60  *
61  * @param ccid The CCID to search for
62  *
63  * @retval NULL None was found
64  * @retval attr Pointer to a GATT attribute
65  */
66 const struct bt_gatt_attr *bt_ccid_find_attr(uint8_t ccid);
67 
68 /** @} */
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CCID_H_ */
75