Skip to content

Commit

Permalink
Bluetooth: TBS: Make GTBS mandatory
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Thalley authored and carlescufi committed Sep 17, 2024
1 parent 4ec6727 commit eb22e1f
Show file tree
Hide file tree
Showing 12 changed files with 444 additions and 575 deletions.
4 changes: 3 additions & 1 deletion doc/connectivity/bluetooth/api/audio/shell/ccp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion samples/bluetooth/tmap_central/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 7 additions & 21 deletions subsys/bluetooth/audio/Kconfig.tbs
Original file line number Diff line number Diff line change
@@ -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
#
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/audio/shell/bap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
};
Expand Down
14 changes: 7 additions & 7 deletions subsys/bluetooth/audio/shell/tbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit eb22e1f

Please sign in to comment.