Bluetooth: OTS - join Kconfig for OTS server and client

Merge Kconfig file for OTS server and client.
Rename the client config from _OTC to _OTS_CLIENT

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
This commit is contained in:
Asbjørn Sæbø 2022-01-27 14:42:14 +01:00 committed by Carles Cufí
commit 352dd3763e
12 changed files with 69 additions and 79 deletions

View file

@ -53,7 +53,7 @@ typedef void (*bt_mcc_discover_mcs_cb)(struct bt_conn *conn, int err);
*/
typedef void (*bt_mcc_read_player_name_cb)(struct bt_conn *conn, int err, const char *name);
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
/**
* @brief Callback function for bt_mcc_read_icon_obj_id()
*
@ -64,7 +64,7 @@ typedef void (*bt_mcc_read_player_name_cb)(struct bt_conn *conn, int err, const
* @param icon_id The ID of the Icon Object. This is a UINT48 in a uint64_t
*/
typedef void (*bt_mcc_read_icon_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id);
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
/**
* @brief Callback function for bt_mcc_read_icon_url()
@ -168,7 +168,7 @@ typedef void (*bt_mcc_set_playback_speed_cb)(struct bt_conn *conn, int err, int8
*/
typedef void (*bt_mcc_read_seeking_speed_cb)(struct bt_conn *conn, int err, int8_t speed);
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
/**
* @brief Callback function for bt_mcc_read_segments_obj_id()
*
@ -257,7 +257,7 @@ typedef void (*bt_mcc_read_current_group_obj_id_cb)(struct bt_conn *conn, int er
*/
typedef void (*bt_mcc_set_current_group_obj_id_cb)(struct bt_conn *conn, int err, uint64_t obj_id);
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
/**
* @brief Callback function for bt_mcc_read_playing_order()
@ -342,7 +342,7 @@ typedef void (*bt_mcc_cmd_ntf_cb)(struct bt_conn *conn, int err, struct mpl_cmd_
typedef void (*bt_mcc_read_opcodes_supported_cb)(struct bt_conn *conn, int err,
uint32_t opcodes);
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
/**
* @brief Callback function for bt_mcc_send_search()
*
@ -386,7 +386,7 @@ typedef void (*bt_mcc_search_ntf_cb)(struct bt_conn *conn, int err,
*/
typedef void (*bt_mcc_read_search_results_obj_id_cb)(struct bt_conn *conn,
int err, uint64_t id);
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
/**
* @brief Callback function for bt_mcc_read_content_control_id()
@ -399,7 +399,7 @@ typedef void (*bt_mcc_read_search_results_obj_id_cb)(struct bt_conn *conn,
*/
typedef void (*bt_mcc_read_content_control_id_cb)(struct bt_conn *conn,
int err, uint8_t ccid);
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
/**** Callback functions for the included Object Transfer service *************/
/**
@ -506,7 +506,7 @@ typedef void (*bt_mcc_otc_read_parent_group_object_cb)(struct bt_conn *conn, int
typedef void (*bt_mcc_otc_read_current_group_object_cb)(struct bt_conn *conn, int err,
struct net_buf_simple *buf);
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
/**
@ -515,9 +515,9 @@ typedef void (*bt_mcc_otc_read_current_group_object_cb)(struct bt_conn *conn, in
struct bt_mcc_cb {
bt_mcc_discover_mcs_cb discover_mcs;
bt_mcc_read_player_name_cb read_player_name;
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
bt_mcc_read_icon_obj_id_cb read_icon_obj_id;
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
bt_mcc_read_icon_url_cb read_icon_url;
bt_mcc_track_changed_ntf_cb track_changed_ntf;
bt_mcc_read_track_title_cb read_track_title;
@ -527,7 +527,7 @@ struct bt_mcc_cb {
bt_mcc_read_playback_speed_cb read_playback_speed;
bt_mcc_set_playback_speed_cb set_playback_speed;
bt_mcc_read_seeking_speed_cb read_seeking_speed;
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
bt_mcc_read_segments_obj_id_cb read_segments_obj_id;
bt_mcc_read_current_track_obj_id_cb read_current_track_obj_id;
bt_mcc_set_current_track_obj_id_cb set_current_track_obj_id;
@ -536,7 +536,7 @@ struct bt_mcc_cb {
bt_mcc_read_current_group_obj_id_cb read_current_group_obj_id;
bt_mcc_set_current_group_obj_id_cb set_current_group_obj_id;
bt_mcc_read_parent_group_obj_id_cb read_parent_group_obj_id;
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
bt_mcc_read_playing_order_cb read_playing_order;
bt_mcc_set_playing_order_cb set_playing_order;
bt_mcc_read_playing_orders_supported_cb read_playing_orders_supported;
@ -544,13 +544,13 @@ struct bt_mcc_cb {
bt_mcc_send_cmd_cb send_cmd;
bt_mcc_cmd_ntf_cb cmd_ntf;
bt_mcc_read_opcodes_supported_cb read_opcodes_supported;
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
bt_mcc_send_search_cb send_search;
bt_mcc_search_ntf_cb search_ntf;
bt_mcc_read_search_results_obj_id_cb read_search_results_obj_id;
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
bt_mcc_read_content_control_id_cb read_content_control_id;
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
bt_mcc_otc_obj_selected_cb otc_obj_selected;
bt_mcc_otc_obj_metadata_cb otc_obj_metadata;
bt_mcc_otc_read_icon_object_cb otc_icon_object;
@ -559,7 +559,7 @@ struct bt_mcc_cb {
bt_mcc_otc_read_next_track_object_cb otc_next_track_object;
bt_mcc_otc_read_current_group_object_cb otc_current_group_object;
bt_mcc_otc_read_parent_group_object_cb otc_parent_group_object;
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
};
/**** Functions ***************************************************************/
@ -599,7 +599,7 @@ int bt_mcc_discover_mcs(struct bt_conn *conn, bool subscribe);
*/
int bt_mcc_read_player_name(struct bt_conn *conn);
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
/**
* @brief Read Icon Object ID
*
@ -608,7 +608,7 @@ int bt_mcc_read_player_name(struct bt_conn *conn);
* @return 0 if success, errno on failure.
*/
int bt_mcc_read_icon_obj_id(struct bt_conn *conn);
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
/**
* @brief Read Icon Object URL
@ -684,7 +684,7 @@ int bt_mcc_set_playback_speed(struct bt_conn *conn, int8_t speed);
*/
int bt_mcc_read_seeking_speed(struct bt_conn *conn);
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
/**
* @brief Read Track Segments Object ID
*
@ -766,7 +766,7 @@ int bt_mcc_set_current_group_obj_id(struct bt_conn *conn, uint64_t id);
* @return 0 if success, errno on failure.
*/
int bt_mcc_read_parent_group_obj_id(struct bt_conn *conn);
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
/**
* @brief Read Playing Order
@ -826,7 +826,7 @@ int bt_mcc_send_cmd(struct bt_conn *conn, struct mpl_cmd cmd);
*/
int bt_mcc_read_opcodes_supported(struct bt_conn *conn);
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
/**
* @brief Send a Search command
*
@ -847,7 +847,7 @@ int bt_mcc_send_search(struct bt_conn *conn, struct mpl_search search);
* @return 0 if success, errno on failure.
*/
int bt_mcc_read_search_results_obj_id(struct bt_conn *conn);
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
/**
* @brief Read Content Control ID
@ -858,7 +858,7 @@ int bt_mcc_read_search_results_obj_id(struct bt_conn *conn);
*/
int bt_mcc_read_content_control_id(struct bt_conn *conn);
#ifdef CONFIG_BT_OTC
#ifdef CONFIG_BT_OTS_CLIENT
/**
* @brief Read the current object metadata
*
@ -925,7 +925,7 @@ int bt_mcc_otc_read_parent_group_object(struct bt_conn *conn);
#if defined(CONFIG_BT_MCC_SHELL)
struct bt_otc_instance_t *bt_mcc_otc_inst(void);
#endif /* defined(CONFIG_BT_MCC_SHELL) */
#endif /* CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS_CLIENT */
#ifdef __cplusplus
}

View file

@ -53,7 +53,7 @@ if BT_MCC
config BT_MCC_OTS
bool "Media Control Client support for Object Transfer Service"
depends on BT_OTC
depends on BT_OTS_CLIENT
help
Use this option to configure support in the Media Control Client for
an included Object Transfer Service in the Media Control Service.

View file

@ -39,24 +39,24 @@ struct mpl_tseg {
/* Tracks */
struct mpl_track {
#if defined(CONFIG_BT_OTS) || defined(CONFIG_BT_OTC)
#if defined(CONFIG_BT_OTS) || defined(CONFIG_BT_OTS_CLIENT)
uint64_t id;
#endif /* CONFIG_BT_OTS || CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS || CONFIG_BT_OTS_CLIENT */
char title[CONFIG_BT_MCS_TRACK_TITLE_MAX];
int32_t duration;
struct mpl_tseg *segment;
#if defined(CONFIG_BT_OTS) || defined(CONFIG_BT_OTC)
#if defined(CONFIG_BT_OTS) || defined(CONFIG_BT_OTS_CLIENT)
uint64_t segments_id;
#endif /* CONFIG_BT_OTS || CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS || CONFIG_BT_OTS_CLIENT */
struct mpl_track *prev;
struct mpl_track *next;
};
/* Groups */
struct mpl_group {
#if defined(CONFIG_BT_OTS) || defined(CONFIG_BT_OTC)
#if defined(CONFIG_BT_OTS) || defined(CONFIG_BT_OTS_CLIENT)
uint64_t id;
#endif /* CONFIG_BT_OTS || CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS || CONFIG_BT_OTS_CLIENT */
char title[CONFIG_BT_MCS_GROUP_TITLE_MAX];
struct mpl_track *track;
struct mpl_group *parent;
@ -67,9 +67,9 @@ struct mpl_group {
/** @brief Media Player */
struct mpl_mediaplayer {
char name[CONFIG_BT_MCS_MEDIA_PLAYER_NAME_MAX];
#if defined(CONFIG_BT_OTS) || defined(CONFIG_BT_OTC)
#if defined(CONFIG_BT_OTS) || defined(CONFIG_BT_OTS_CLIENT)
uint64_t icon_id;
#endif /* CONFIG_BT_OTS || CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS || CONFIG_BT_OTS_CLIENT */
char icon_url[CONFIG_BT_MCS_ICON_URL_MAX];
struct mpl_group *group;
int32_t track_pos;
@ -79,9 +79,9 @@ struct mpl_mediaplayer {
uint8_t playing_order;
uint16_t playing_orders_supported;
uint32_t opcodes_supported;
#if defined(CONFIG_BT_OTS) || defined(CONFIG_BT_OTC)
#if defined(CONFIG_BT_OTS) || defined(CONFIG_BT_OTS_CLIENT)
uint64_t search_results_id;
#endif /* CONFIG_BT_OTS || CONFIG_BT_OTC */
#endif /* CONFIG_BT_OTS || CONFIG_BT_OTS_CLIENT */
uint8_t content_ctrl_id;
struct media_proxy_pl_calls calls;

View file

@ -9,6 +9,6 @@ zephyr_sources_ifdef(CONFIG_BT_HRS hrs.c)
zephyr_sources_ifdef(CONFIG_BT_TPS tps.c)
if(CONFIG_BT_OTS OR CONFIG_BT_OTC)
if(CONFIG_BT_OTS OR CONFIG_BT_OTS_CLIENT)
add_subdirectory(ots)
endif()

View file

@ -15,6 +15,5 @@ rsource "Kconfig.hrs"
rsource "Kconfig.tps"
rsource "ots/Kconfig"
rsource "ots/Kconfig.otc"
endmenu

View file

@ -11,6 +11,6 @@ zephyr_sources_ifdef(
zephyr_library_sources_ifdef(CONFIG_BT_OTS_DIR_LIST_OBJ ots_dir_list.c)
zephyr_library_sources_ifdef(
CONFIG_BT_OTC
CONFIG_BT_OTS_CLIENT
otc.c
ots_l2cap.c)

View file

@ -1,6 +1,6 @@
# Bluetooth Object Transfer service
# Copyright (c) 2020 Nordic Semiconductor ASA
# Copyright (c) 2020-2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
config BT_OTS
@ -69,7 +69,29 @@ config BT_OTS_OBJ_NAME_WRITE_SUPPORT
endif # BT_OTS
if BT_OTS || BT_OTC
#### Object Transfer Service Client ################################
config BT_OTS_CLIENT
bool "Object Transfer Service Client [Experimental]"
select BT_L2CAP_DYNAMIC_CHANNEL
select BT_GATT_CLIENT
select BT_GATT_AUTO_DISCOVER_CCC
select EXPERIMENTAL
help
This option enables support for the Object Transfer Service Client.
if BT_OTS_CLIENT
# TODO: Unify logging for OTS server and client - the client uses
# "BT" debugging, the server does not.
config BT_DEBUG_OTS_CLIENT
bool "Object Transfer Service Client debug"
help
Use this option to enable Object Transfer Client debug logs
endif # BT_OTS_CLIENT
if BT_OTS || BT_OTS_CLIENT
config BT_OTS_MAX_OBJ_CNT
hex "Maximum number of objects that each service instance can store"
@ -96,4 +118,4 @@ module = BT_OTS
module-str = BT_OTS
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"
endif # BT_OTS || BT_OTC
endif # BT_OTS || BT_OTS_CLIENT

View file

@ -1,31 +0,0 @@
# Bluetooth Audio - Object transfer configuration options
#
# Copyright (c) 2020 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0
#
#### Object Transfer Service Client ################################
config BT_OTC
bool "Object Transfer Service Client Support (OTC) [Experimental]"
select BT_L2CAP_DYNAMIC_CHANNEL
select BT_GATT_CLIENT
select BT_GATT_AUTO_DISCOVER_CCC
select EXPERIMENTAL
default n
help
This option enables support for the Object Transfer Service Client.
if BT_OTC
config BT_DEBUG_OTC
bool "Object Transfer Client debug"
# TODO: Remove dependency on BT_AUDIO_DEBUG when moved out of the audio directory
depends on BT_OTC
help
Use this option to enable Object Transfer Client debug logs for the
Bluetooth Audio functionality.
endif # BTC

View file

@ -28,7 +28,7 @@
#include "ots_oacp_internal.h"
#include "ots_olcp_internal.h"
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_OTC)
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_OTS_CLIENT)
#define LOG_MODULE_NAME bt_otc
#include "common/log.h"
@ -1296,7 +1296,7 @@ static int decode_record(struct net_buf_simple *buf,
rec->metadata.id = net_buf_simple_pull_le48(buf);
if (IS_ENABLED(CONFIG_BT_DEBUG_OTC)) {
if (IS_ENABLED(CONFIG_BT_DEBUG_OTS_CLIENT)) {
char t[BT_OTS_OBJ_ID_STR_LEN];
(void)bt_ots_obj_id_to_str(rec->metadata.id, t, sizeof(t));

View file

@ -24,7 +24,7 @@
*/
#if IS_ENABLED(CONFIG_BT_OTS)
LOG_MODULE_DECLARE(bt_ots, CONFIG_BT_OTS_LOG_LEVEL);
#elif IS_ENABLED(CONFIG_BT_OTC)
#elif IS_ENABLED(CONFIG_BT_OTS_CLIENT)
LOG_MODULE_REGISTER(bt_ots, CONFIG_BT_OTS_LOG_LEVEL);
#endif

View file

@ -69,7 +69,7 @@ CONFIG_BT_MCS_MAX_OBJ_SIZE=600
CONFIG_BT_OTS=y
CONFIG_BT_OTS_SECONDARY_SVC=y
CONFIG_BT_OTS_MAX_OBJ_CNT=0x30
CONFIG_BT_OTC=y
CONFIG_BT_OTS_CLIENT=y
# DEBUGGING
CONFIG_BT_DEBUG_LOG=y
@ -84,7 +84,7 @@ CONFIG_BT_DEBUG_MICS_CLIENT=y
CONFIG_BT_DEBUG_MCS=y
CONFIG_BT_DEBUG_MCC=y
CONFIG_BT_OTS_LOG_LEVEL_DBG=y
CONFIG_BT_DEBUG_OTC=y
CONFIG_BT_DEBUG_OTS_CLIENT=y
CONFIG_BT_DEBUG_MEDIA_PROXY=y
CONFIG_BT_DEBUG_CSIS=y
CONFIG_BT_DEBUG_CSIS_CLIENT=y

View file

@ -87,14 +87,14 @@ CONFIG_BT_MCS_GROUP_MAX_SIZE=552
CONFIG_BT_OTS=y
CONFIG_BT_OTS_SECONDARY_SVC=y
CONFIG_BT_OTS_MAX_OBJ_CNT=50
CONFIG_BT_OTC=y
CONFIG_BT_OTS_CLIENT=y
# DEBUGGING
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_DEBUG_MCS=y
CONFIG_BT_DEBUG_MCC=y
CONFIG_BT_OTS_LOG_LEVEL_DBG=y
CONFIG_BT_DEBUG_OTC=y
CONFIG_BT_DEBUG_OTS_CLIENT=y
CONFIG_BT_DEBUG_MEDIA_PROXY=y
CONFIG_BT_DEBUG_ASCS=y