Skip to content

Commit 48ac31c

Browse files
Thalleykartben
authored andcommitted
Bluetooth: TMAP: Remove double definitions of TMAP roles support
Both the TMAP kconfig file and public header file defined which roles were supported. The Kconfig file options were recently added and were more up to date (and correct), and allows for other Kconfig files to use these values, thus allowing for more flexibility when implementing applications. Signed-off-by: Emil Gydesen <[email protected]>
1 parent f994de8 commit 48ac31c

File tree

3 files changed

+21
-45
lines changed
  • include/zephyr/bluetooth/audio
  • subsys/bluetooth/audio/shell
  • tests/bluetooth/tester/src/audio

3 files changed

+21
-45
lines changed

include/zephyr/bluetooth/audio/tmap.h

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @brief Header for Bluetooth TMAP.
44
*
55
* Copyright 2023 NXP
6-
* Copyright (c) 2024 Nordic Semiconductor ASA
6+
* Copyright (c) 2024-2025 Nordic Semiconductor ASA
77
*
88
* SPDX-License-Identifier: Apache-2.0
99
*/
@@ -31,37 +31,6 @@
3131
#include <zephyr/sys/util.h>
3232
#include <zephyr/sys/util_macro.h>
3333

34-
/** Call Gateway (CG) supported */
35-
#define BT_TMAP_CG_SUPPORTED \
36-
(IS_ENABLED(CONFIG_BT_CAP_INITIATOR) && IS_ENABLED(CONFIG_BT_BAP_UNICAST_CLIENT) && \
37-
IS_ENABLED(CONFIG_BT_TBS) && IS_ENABLED(CONFIG_BT_VCP_VOL_CTLR))
38-
39-
/** Call Terminal (CT) supported */
40-
#define BT_TMAP_CT_SUPPORTED \
41-
(IS_ENABLED(CONFIG_BT_CAP_ACCEPTOR) && IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER) && \
42-
IS_ENABLED(CONFIG_BT_TBS_CLIENT) && \
43-
(IS_ENABLED(CONFIG_BT_ASCS_ASE_SNK) && \
44-
IS_ENABLED(CONFIG_BT_VCP_VOL_REND) == IS_ENABLED(CONFIG_BT_ASCS_ASE_SNK)))
45-
46-
/** Unicast Media Sender (UMS) supported */
47-
#define BT_TMAP_UMS_SUPPORTED \
48-
(IS_ENABLED(CONFIG_BT_CAP_INITIATOR) && \
49-
IS_ENABLED(CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK) && IS_ENABLED(CONFIG_BT_VCP_VOL_CTLR) && \
50-
IS_ENABLED(CONFIG_BT_MCS))
51-
52-
/** Unicast Media Receiver (UMR) supported */
53-
#define BT_TMAP_UMR_SUPPORTED \
54-
(IS_ENABLED(CONFIG_BT_CAP_ACCEPTOR) && IS_ENABLED(CONFIG_BT_ASCS_ASE_SNK) && \
55-
IS_ENABLED(CONFIG_BT_VCP_VOL_REND))
56-
57-
/** Broadcast Media Sender (BMS) supported */
58-
#define BT_TMAP_BMS_SUPPORTED \
59-
(IS_ENABLED(CONFIG_BT_CAP_INITIATOR) && IS_ENABLED(CONFIG_BT_BAP_BROADCAST_SOURCE))
60-
61-
/** Broadcast Media Receiver (BMR) supported */
62-
#define BT_TMAP_BMR_SUPPORTED \
63-
(IS_ENABLED(CONFIG_BT_CAP_ACCEPTOR) && IS_ENABLED(CONFIG_BT_BAP_BROADCAST_SINK))
64-
6534
/** @brief TMAP Role characteristic */
6635
enum bt_tmap_role {
6736
/**

subsys/bluetooth/audio/shell/tmap.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
/*
7-
* Copyright (c) 2023 Nordic Semiconductor ASA
7+
* Copyright (c) 2023-2025 Nordic Semiconductor ASA
88
*
99
* SPDX-License-Identifier: Apache-2.0
1010
*/
@@ -13,22 +13,25 @@
1313
#include <stddef.h>
1414
#include <stdint.h>
1515

16+
#include <zephyr/autoconf.h>
1617
#include <zephyr/bluetooth/audio/tmap.h>
1718
#include <zephyr/bluetooth/conn.h>
1819
#include <zephyr/kernel.h>
1920
#include <zephyr/shell/shell.h>
2021
#include <zephyr/sys/util.h>
22+
#include <zephyr/sys/util_macro.h>
2123

2224
#include "host/shell/bt.h"
2325

2426
static int cmd_tmap_init(const struct shell *sh, size_t argc, char **argv)
2527
{
26-
const enum bt_tmap_role role = (BT_TMAP_CG_SUPPORTED ? BT_TMAP_ROLE_CG : 0U) |
27-
(BT_TMAP_CT_SUPPORTED ? BT_TMAP_ROLE_CT : 0U) |
28-
(BT_TMAP_UMS_SUPPORTED ? BT_TMAP_ROLE_UMS : 0U) |
29-
(BT_TMAP_UMR_SUPPORTED ? BT_TMAP_ROLE_UMR : 0U) |
30-
(BT_TMAP_BMS_SUPPORTED ? BT_TMAP_ROLE_BMS : 0U) |
31-
(BT_TMAP_BMR_SUPPORTED ? BT_TMAP_ROLE_BMR : 0U);
28+
const enum bt_tmap_role role =
29+
(IS_ENABLED(CONFIG_BT_TMAP_CG_SUPPORTED) ? BT_TMAP_ROLE_CG : 0U) |
30+
(IS_ENABLED(CONFIG_BT_TMAP_CT_SUPPORTED) ? BT_TMAP_ROLE_CT : 0U) |
31+
(IS_ENABLED(CONFIG_BT_TMAP_UMS_SUPPORTED) ? BT_TMAP_ROLE_UMS : 0U) |
32+
(IS_ENABLED(CONFIG_BT_TMAP_UMR_SUPPORTED) ? BT_TMAP_ROLE_UMR : 0U) |
33+
(IS_ENABLED(CONFIG_BT_TMAP_BMS_SUPPORTED) ? BT_TMAP_ROLE_BMS : 0U) |
34+
(IS_ENABLED(CONFIG_BT_TMAP_BMR_SUPPORTED) ? BT_TMAP_ROLE_BMR : 0U);
3235
int err;
3336

3437
shell_info(sh, "Registering TMAS with role: 0x%04X", role);

tests/bluetooth/tester/src/audio/btp_tmap.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
/*
44
* Copyright (c) 2024 Codecoup
5+
* Copyright (c) 2025 Nordic Semiconductor ASA
56
*
67
* SPDX-License-Identifier: Apache-2.0
78
*/
9+
#include <zephyr/autoconf.h>
810
#include <zephyr/bluetooth/audio/tmap.h>
911
#include "btp/btp.h"
1012

1113
#include <zephyr/logging/log.h>
14+
#include <zephyr/sys/util_macro.h>
1215
LOG_MODULE_REGISTER(bttester_tmap, CONFIG_BTTESTER_LOG_LEVEL);
1316

1417
static uint8_t read_supported_commands(const void *cmd, uint16_t cmd_len, void *rsp,
@@ -81,12 +84,13 @@ static const struct btp_handler tmap_handlers[] = {
8184

8285
uint8_t tester_init_tmap(void)
8386
{
84-
const enum bt_tmap_role role = (BT_TMAP_CG_SUPPORTED ? BT_TMAP_ROLE_CG : 0U) |
85-
(BT_TMAP_CT_SUPPORTED ? BT_TMAP_ROLE_CT : 0U) |
86-
(BT_TMAP_UMS_SUPPORTED ? BT_TMAP_ROLE_UMS : 0U) |
87-
(BT_TMAP_UMR_SUPPORTED ? BT_TMAP_ROLE_UMR : 0U) |
88-
(BT_TMAP_BMS_SUPPORTED ? BT_TMAP_ROLE_BMS : 0U) |
89-
(BT_TMAP_BMR_SUPPORTED ? BT_TMAP_ROLE_BMR : 0U);
87+
const enum bt_tmap_role role =
88+
(IS_ENABLED(CONFIG_BT_TMAP_CG_SUPPORTED) ? BT_TMAP_ROLE_CG : 0U) |
89+
(IS_ENABLED(CONFIG_BT_TMAP_CT_SUPPORTED) ? BT_TMAP_ROLE_CT : 0U) |
90+
(IS_ENABLED(CONFIG_BT_TMAP_UMS_SUPPORTED) ? BT_TMAP_ROLE_UMS : 0U) |
91+
(IS_ENABLED(CONFIG_BT_TMAP_UMR_SUPPORTED) ? BT_TMAP_ROLE_UMR : 0U) |
92+
(IS_ENABLED(CONFIG_BT_TMAP_BMS_SUPPORTED) ? BT_TMAP_ROLE_BMS : 0U) |
93+
(IS_ENABLED(CONFIG_BT_TMAP_BMR_SUPPORTED) ? BT_TMAP_ROLE_BMR : 0U);
9094
int err;
9195

9296
err = bt_tmap_register(role);

0 commit comments

Comments
 (0)