1 /** 2 * @file 3 * @brief Header for Bluetooth TMAP. 4 * 5 * Copyright 2023 NXP 6 * Copyright (c) 2024-2025 Nordic Semiconductor ASA 7 * 8 * SPDX-License-Identifier: Apache-2.0 9 */ 10 11 #ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_TMAP_ 12 #define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_TMAP_ 13 14 /** 15 * @brief Telephone and Media Audio Profile (TMAP) 16 * 17 * @defgroup bt_tmap Telephone and Media Audio Profile (TMAP) 18 * 19 * @since 3.4 20 * @version 0.8.0 21 * 22 * @ingroup bluetooth 23 * @{ 24 * 25 * The Telephone and Media Audio Profile (TMAP) uses a collection of Bluetooth features and profiles 26 * to enable interoperability between devices for telephony and media audio. 27 */ 28 29 #include <zephyr/autoconf.h> 30 #include <zephyr/bluetooth/conn.h> 31 #include <zephyr/sys/util.h> 32 #include <zephyr/sys/util_macro.h> 33 34 /** @brief TMAP Role characteristic */ 35 enum bt_tmap_role { 36 /** 37 * @brief TMAP Call Gateway role 38 * 39 * This role is defined to telephone and VoIP applications using the Call Control Profile 40 * to control calls on a remote TMAP Call Terminal. 41 * Audio streams in this role are typically bi-directional. 42 */ 43 BT_TMAP_ROLE_CG = BIT(0), 44 /** 45 * @brief TMAP Call Terminal role 46 * 47 * This role is defined to telephone and VoIP applications using the Call Control Profile 48 * to expose calls to remote TMAP Call Gateways. 49 * Audio streams in this role are typically bi-directional. 50 */ 51 BT_TMAP_ROLE_CT = BIT(1), 52 /** 53 * @brief TMAP Unicast Media Sender role 54 * 55 * This role is defined send media audio to TMAP Unicast Media Receivers. 56 * Audio streams in this role are typically uni-directional. 57 */ 58 BT_TMAP_ROLE_UMS = BIT(2), 59 /** 60 * @brief TMAP Unicast Media Receiver role 61 * 62 * This role is defined receive media audio to TMAP Unicast Media Senders. 63 * Audio streams in this role are typically uni-directional. 64 */ 65 BT_TMAP_ROLE_UMR = BIT(3), 66 /** 67 * @brief TMAP Broadcast Media Sender role 68 * 69 * This role is defined send media audio to TMAP Broadcast Media Receivers. 70 * Audio streams in this role are always uni-directional. 71 */ 72 BT_TMAP_ROLE_BMS = BIT(4), 73 /** 74 * @brief TMAP Broadcast Media Receiver role 75 * 76 * This role is defined send media audio to TMAP Broadcast Media Senders. 77 * Audio streams in this role are always uni-directional. 78 */ 79 BT_TMAP_ROLE_BMR = BIT(5), 80 }; 81 82 /** @brief TMAP callback structure. */ 83 struct bt_tmap_cb { 84 /** 85 * @brief TMAP discovery complete callback 86 * 87 * This callback notifies the application about the value of the 88 * TMAP Role characteristic on the peer. 89 * 90 * @param role Peer TMAP role(s). 91 * @param conn Pointer to the connection 92 * @param err 0 if success, ATT error received from server otherwise. 93 */ 94 void (*discovery_complete)(enum bt_tmap_role role, struct bt_conn *conn, int err); 95 }; 96 97 /** 98 * @brief Adds TMAS instance to database and sets the received TMAP role(s). 99 * 100 * @param role TMAP role(s) of the device (one or multiple). 101 * 102 * @return 0 on success or negative error value on failure. 103 */ 104 int bt_tmap_register(enum bt_tmap_role role); 105 106 /** 107 * @brief Perform service discovery as TMAP Client 108 * 109 * @param conn Pointer to the connection. 110 * @param tmap_cb Pointer to struct of TMAP callbacks. 111 * 112 * @return 0 on success or negative error value on failure. 113 */ 114 int bt_tmap_discover(struct bt_conn *conn, const struct bt_tmap_cb *tmap_cb); 115 116 /** 117 * @brief Set one or multiple TMAP roles dynamically. 118 * Previously registered value will be overwritten. 119 * 120 * @param role TMAP role(s). 121 * 122 */ 123 void bt_tmap_set_role(enum bt_tmap_role role); 124 125 /** 126 * @} 127 */ 128 129 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_TMAP_ */ 130