1 /** @file 2 * @brief Header for Bluetooth TMAP. 3 * 4 * Copyright 2023 NXP 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 #ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_TMAP_ 10 #define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_TMAP_ 11 12 #include <zephyr/bluetooth/conn.h> 13 #include <zephyr/sys/util.h> 14 15 /** @brief TMAP Role characteristic */ 16 enum bt_tmap_role { 17 BT_TMAP_ROLE_CG = BIT(0), 18 BT_TMAP_ROLE_CT = BIT(1), 19 BT_TMAP_ROLE_UMS = BIT(2), 20 BT_TMAP_ROLE_UMR = BIT(3), 21 BT_TMAP_ROLE_BMS = BIT(4), 22 BT_TMAP_ROLE_BMR = BIT(5), 23 }; 24 25 /** @brief TMAP callback structure. */ 26 struct bt_tmap_cb { 27 /** @brief TMAP discovery complete callback 28 * 29 * This callback notifies the application about the value of the 30 * TMAP Role characteristic on the peer. 31 * 32 * @param role Peer TMAP role(s). 33 * @param conn Pointer to the connection 34 * @param err 0 if success, ATT error received from server otherwise. 35 */ 36 void (*discovery_complete)(enum bt_tmap_role role, struct bt_conn *conn, int err); 37 }; 38 39 /** 40 * @brief Adds TMAS instance to database and sets the received TMAP role(s). 41 * 42 * @param role TMAP role(s) of the device (one or multiple). 43 * 44 * @return 0 on success or negative error value on failure. 45 */ 46 int bt_tmap_register(enum bt_tmap_role role); 47 48 /** 49 * @brief Perform service discovery as TMAP Client 50 * 51 * @param conn Pointer to the connection. 52 * @param tmap_cb Pointer to struct of TMAP callbacks. 53 * 54 * @return 0 on success or negative error value on failure. 55 */ 56 int bt_tmap_discover(struct bt_conn *conn, const struct bt_tmap_cb *tmap_cb); 57 58 /** 59 * @brief Set one or multiple TMAP roles dynamically. 60 * Previously registered value will be overwritten. 61 * 62 * @param role TMAP role(s). 63 * 64 */ 65 void bt_tmap_set_role(enum bt_tmap_role role); 66 67 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_TMAP_ */ 68