Bluetooth: TBS: Make GTBS mandatory

Any places that checked for GTBS is now always enabled
as GTBS is mandatory to support, and the Kconfig option
was removed.

Also removed a duplicate Kconfig option for TBS,
BT_TBS_SERVICE_COUNT, as it was unused.

The other Kconfig option BT_TBS_BEARER_COUNT is used
instead exclusively to set it if needed.

Since GTBS can now exist alone, it must also
support having its own calls and other values.
This means that the GTBS and TBS instances now share
the same underlying struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-07-10 15:10:39 +02:00 committed by Carles Cufí
commit eb22e1fc98
12 changed files with 429 additions and 560 deletions

View file

@ -31,7 +31,7 @@ Since a server may have multiple TBS instances, most of the tbs_client commands
will take an index (starting from 0) as input. Joining calls require at least 2
call IDs, and all call indexes shall be on the same TBS instance.
A server may also have a GTBS instance, which is an abstraction layer for all
A server will also have a GTBS instance, which is an abstraction layer for all
the telephone bearers on the server. If the server has both GTBS and TBS,
the client may subscribe and use either when sending requests if
:code:`BT_TBS_CLIENT_GTBS` is enabled.
@ -169,6 +169,8 @@ TBS can be controlled locally, or by a remote device (when in a call). For
example a remote device may initiate a call to the device with the TBS server,
or the TBS server may initiate a call to remote device, without a TBS_CLIENT client.
The TBS implementation is capable of fully controlling any call.
Omitting an index for commands where a :code:`<instance_index>` can be supplied, defaults to the
GTBS bearer.
.. code-block:: console

View file

@ -32,7 +32,6 @@ CONFIG_MCTL=y
# CCP support
CONFIG_BT_TBS=y
CONFIG_BT_GTBS=y
CONFIG_BT_TBS_SUPPORTED_FEATURES=3
# Support an ISO channel per ASE

View file

@ -1,6 +1,7 @@
# Bluetooth Audio - Call control configuration options
#
# Copyright (c) 2020 Bose Corporation
# Copyright (c) 2024 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#
@ -15,18 +16,12 @@ config BT_TBS
select BT_GATT_DYNAMIC_DB
depends on UTF8
help
This option enables support for Telephone Bearer Service.
This option enables support for Telephone Bearer Service. By default this only
initializes the GTBS service. If specific TBS services are wanted, they need to be
enabled by setting BT_TBS_BEARER_COUNT to a non-zero value.
if BT_TBS
# TODO: BT_GTBS is mandatory if you support the call control server role.
# Need to enforce this.
config BT_GTBS
bool "Generic Telephone Bearer Service Support"
default y
help
This option enables support for Generic Telephone Bearer Service.
config BT_TBS_PROVIDER_NAME
string "Telephone Bearer Service Provider Name"
default "Unknown"
@ -101,26 +96,17 @@ config BT_TBS_MAX_CALLS
config BT_TBS_BEARER_COUNT
int "How many bearer instances the device instantiates"
default 1
range 1 $(UINT8_MAX)
default 0
range 0 $(UINT8_MAX)
help
Sets the number of TBS instances that are instantiated
config BT_TBS_SERVICE_COUNT
int "Number of instantiated bearer service instances"
default BT_TBS_BEARER_COUNT
range 0 BT_TBS_BEARER_COUNT if BT_GTBS
range BT_TBS_BEARER_COUNT BT_TBS_BEARER_COUNT
help
Sets the number of TBS service instances that are instantiated
config BT_TBS_MAX_SCHEME_LIST_LENGTH
int "The maximum length of the URI scheme list"
default 30
range 0 512
help
Sets the maximum length of the URI scheme list. If BT_GTBS is enabled,
then the maximum length should be maximum 512 / BT_TBS_BEARER_COUNT.
Sets the maximum length of the URI scheme list.
config BT_TBS_AUTHORIZATION
bool "TBS authorization requirement"

View file

@ -4136,8 +4136,8 @@ static ssize_t connectable_ad_data_add(struct bt_data *data_array,
IF_ENABLED(CONFIG_BT_ASCS, (BT_UUID_16_ENCODE(BT_UUID_ASCS_VAL),))
IF_ENABLED(CONFIG_BT_BAP_SCAN_DELEGATOR, (BT_UUID_16_ENCODE(BT_UUID_BASS_VAL),))
IF_ENABLED(CONFIG_BT_PACS, (BT_UUID_16_ENCODE(BT_UUID_PACS_VAL),))
IF_ENABLED(CONFIG_BT_GTBS, (BT_UUID_16_ENCODE(BT_UUID_GTBS_VAL),))
IF_ENABLED(CONFIG_BT_TBS, (BT_UUID_16_ENCODE(BT_UUID_TBS_VAL),))
IF_ENABLED(CONFIG_BT_TBS, (BT_UUID_16_ENCODE(BT_UUID_GTBS_VAL),))
IF_ENABLED(CONFIG_BT_TBS_BEARER_COUNT, (BT_UUID_16_ENCODE(BT_UUID_TBS_VAL),))
IF_ENABLED(CONFIG_BT_VCP_VOL_REND, (BT_UUID_16_ENCODE(BT_UUID_VCS_VAL),))
IF_ENABLED(CONFIG_BT_HAS, (BT_UUID_16_ENCODE(BT_UUID_HAS_VAL),)) /* Shall be last */
};

View file

@ -209,7 +209,7 @@ static int cmd_tbs_originate(const struct shell *sh, size_t argc, char *argv[])
return -ENOEXEC;
}
} else {
service_index = 0U;
service_index = BT_TBS_GTBS_INDEX;
}
result = bt_tbs_originate((uint8_t)service_index, argv[argc - 1],
@ -402,7 +402,7 @@ static int cmd_tbs_incoming(const struct shell *sh, size_t argc, char *argv[])
}
}
} else {
service_index = 0U;
service_index = BT_TBS_GTBS_INDEX;
}
result = bt_tbs_remote_incoming((uint8_t)service_index,
@ -445,7 +445,7 @@ static int cmd_tbs_set_bearer_provider_name(const struct shell *sh, size_t argc,
}
}
} else {
service_index = 0U;
service_index = BT_TBS_GTBS_INDEX;
}
result = bt_tbs_set_bearer_provider_name((uint8_t)service_index,
@ -485,7 +485,7 @@ static int cmd_tbs_set_bearer_technology(const struct shell *sh, size_t argc,
}
}
} else {
service_index = 0U;
service_index = BT_TBS_GTBS_INDEX;
}
technology = shell_strtoul(argv[argc - 1], 0, &result);
@ -538,7 +538,7 @@ static int cmd_tbs_set_bearer_signal_strength(const struct shell *sh,
}
}
} else {
service_index = 0U;
service_index = BT_TBS_GTBS_INDEX;
}
signal_strength = shell_strtoul(argv[argc - 1], 0, &result);
@ -592,7 +592,7 @@ static int cmd_tbs_set_status_flags(const struct shell *sh, size_t argc,
}
}
} else {
service_index = 0U;
service_index = BT_TBS_GTBS_INDEX;
}
status_flags = shell_strtoul(argv[argc - 1], 0, &result);
@ -644,7 +644,7 @@ static int cmd_tbs_set_uri_scheme_list(const struct shell *sh, size_t argc,
}
}
} else {
service_index = 0U;
service_index = BT_TBS_GTBS_INDEX;
}
result = bt_tbs_set_uri_scheme_list((uint8_t)service_index,

File diff suppressed because it is too large Load diff

View file

@ -122,6 +122,7 @@ CONFIG_BT_MPL_TRACK_MAX_SIZE=50
# Telephone bearer service
CONFIG_BT_TBS=y
CONFIG_BT_TBS_BEARER_COUNT=1
CONFIG_BT_TBS_SUPPORTED_FEATURES=3
CONFIG_BT_TBS_CLIENT_TBS=y
CONFIG_BT_TBS_CLIENT_GTBS=y

View file

@ -325,6 +325,12 @@ tests:
extra_configs:
- CONFIG_BT_TBS=n
tags: bluetooth
bluetooth.shell.audio.only_gtbs:
extra_args: CONF_FILE="audio.conf"
build_only: true
extra_configs:
- CONFIG_BT_TBS_BEARER_COUNT=0
tags: bluetooth
bluetooth.shell.audio.no_tbs_client:
extra_args: CONF_FILE="audio.conf"
build_only: true

View file

@ -25,8 +25,6 @@ CONFIG_BT_L2CAP_TX_BUF_COUNT=10
# CAP
CONFIG_BT_CAP_INITIATOR=y
# To have multiple CCIDs
CONFIG_BT_TBS=y
# MICP
CONFIG_BT_MICP_MIC_DEV=y
@ -142,8 +140,8 @@ CONFIG_BT_MPL=y
CONFIG_UTF8=y
#TBS
CONFIG_BT_GTBS=y
CONFIG_BT_TBS=y
CONFIG_BT_TBS_BEARER_COUNT=1
CONFIG_BT_TBS_MAX_CALLS=10
CONFIG_BT_TBS_SUPPORTED_FEATURES=3

View file

@ -60,7 +60,7 @@ if(CONFIG_BT_CAP_INITIATOR)
target_sources(app PRIVATE btp_cap.c)
endif()
if(CONFIG_BT_TBS OR CONFIG_BT_GTBS)
if(CONFIG_BT_TBS)
target_sources(app PRIVATE btp_ccp.c)
endif()

View file

@ -101,7 +101,7 @@ static uint8_t supported_services(const void *cmd, uint16_t cmd_len,
#if defined(CONFIG_BT_HAS)
tester_set_bit(rp->data, BTP_SERVICE_ID_HAP);
#endif /* CONFIG_BT_HAS */
#if defined(CONFIG_BT_TBS) || defined(CONFIG_BT_GTBS)
#if defined(CONFIG_BT_TBS)
tester_set_bit(rp->data, BTP_SERVICE_ID_TBS);
#endif /*CONFIG_BT_TBS */
#if defined(CONFIG_BT_TMAP)
@ -235,7 +235,7 @@ static uint8_t register_service(const void *cmd, uint16_t cmd_len,
status = tester_init_hap();
break;
#endif /* CONFIG_BT_HAS */
#if defined(CONFIG_BT_TBS) || defined(CONFIG_BT_GTBS)
#if defined(CONFIG_BT_TBS)
case BTP_SERVICE_ID_TBS:
status = tester_init_tbs();
break;

View file

@ -80,6 +80,7 @@ CONFIG_BT_CSIP_SET_COORDINATOR_TEST_SAMPLE_DATA=y
# Telephone bearer service
CONFIG_BT_TBS=y
CONFIG_BT_TBS_BEARER_COUNT=1
CONFIG_BT_TBS_CLIENT_TBS=y
CONFIG_BT_TBS_CLIENT_GTBS=y
CONFIG_BT_TBS_CLIENT_MAX_CALLS=4