Bluetooth: Audio: Move audio shell to audio directory

Move all audio related shell implementations to the
audio directory, to use the same structure as Mesh.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2023-03-16 17:18:08 +01:00 committed by Carles Cufí
parent cac932d849
commit c8e1b1e264
24 changed files with 130 additions and 105 deletions

View file

@ -1,5 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
add_subdirectory_ifdef(CONFIG_BT_SHELL shell)
zephyr_library()
zephyr_library_sources(
audio.c

View file

@ -0,0 +1,79 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_link_libraries(subsys__bluetooth)
zephyr_library_sources_ifdef(
CONFIG_BT_VCP_VOL_REND
vcp_vol_rend.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_VCP_VOL_CTLR
vcp_vol_ctlr.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_MICP_MIC_DEV
micp_mic_dev.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_MICP_MIC_CTLR
micp_mic_ctlr.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_CSIP_SET_MEMBER
csip_set_member.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_CSIP_SET_COORDINATOR
csip_set_coordinator.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_TBS
tbs.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_TBS_CLIENT
tbs_client.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_MPL
mpl.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_MCC
mcc.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_MCS
media_controller.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_HAS_PRESET_SUPPORT
has.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER
cap_acceptor.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_CAP_INITIATOR
cap_initiator.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_HAS_CLIENT
has_client.c
)
# We use BT_BAP_STREAM as a common ground for audio, as that is set whenever
# any audio stream functionality is enabled.
zephyr_library_sources_ifdef(
CONFIG_BT_BAP_STREAM
bap.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_BAP_SCAN_DELEGATOR
bap_scan_delegator.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_BAP_BROADCAST_ASSISTANT
bap_broadcast_assistant.c
)

View file

@ -0,0 +1,25 @@
/** @file
* @brief Bluetooth audio shell functions
*
* This is not to be included by the application.
*/
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __AUDIO_H
#define __AUDIO_H
#include <zephyr/bluetooth/bluetooth.h>
extern struct bt_csip_set_member_svc_inst *svc_inst;
ssize_t audio_ad_data_add(struct bt_data *data, const size_t data_size, const bool discoverable,
const bool connectable);
ssize_t audio_pa_data_add(struct bt_data *data_array, const size_t data_array_size);
ssize_t csis_ad_data_add(struct bt_data *data, const size_t data_size, const bool discoverable);
#endif /* __AUDIO_H */

View file

@ -25,7 +25,7 @@
#include <zephyr/bluetooth/audio/bap_lc3_preset.h>
#include <zephyr/bluetooth/audio/pacs.h>
#include "bt.h"
#include "shell/bt.h"
#define LOCATION BT_AUDIO_LOCATION_FRONT_LEFT
#define CONTEXT BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL | BT_AUDIO_CONTEXT_TYPE_MEDIA

View file

@ -18,8 +18,8 @@
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/bap.h>
#include "bt.h"
#include "../host/hci_core.h"
#include "shell/bt.h"
#include "../../host/hci_core.h"
static void bap_broadcast_assistant_discover_cb(struct bt_conn *conn, int err,
uint8_t recv_state_count)

View file

@ -16,7 +16,7 @@
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/audio/bap.h>
#include "bt.h"
#include "shell/bt.h"
static void pa_synced(struct bt_bap_scan_delegator_recv_state *recv_state,
const struct bt_le_per_adv_sync_synced_info *info)

View file

@ -13,7 +13,7 @@
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/audio/cap.h>
#include "bt.h"
#include "shell/bt.h"
extern const struct shell *ctx_shell;
static struct bt_csip_set_member_svc_inst *cap_csip_svc_inst;

View file

@ -15,7 +15,7 @@
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/audio/cap.h>
#include "bt.h"
#include "shell/bt.h"
#if defined(CONFIG_BT_BAP_UNICAST_CLIENT)

View file

@ -18,7 +18,7 @@
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/bluetooth.h>
#include "bt.h"
#include "shell/bt.h"
#include <zephyr/bluetooth/audio/csip.h>

View file

@ -17,7 +17,7 @@
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/audio/csip.h>
#include "bt.h"
#include "shell/bt.h"
extern const struct shell *ctx_shell;
struct bt_csip_set_member_svc_inst *svc_inst;

View file

@ -15,7 +15,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "bt.h"
#include "shell/bt.h"
static int preset_select(uint8_t index, bool sync)
{

View file

@ -15,7 +15,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "bt.h"
#include "shell/bt.h"
static struct bt_has *inst;

View file

@ -15,11 +15,11 @@
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/conn.h>
#include "bt.h"
#include "shell/bt.h"
#include <zephyr/bluetooth/services/ots.h>
#include "../services/ots/ots_client_internal.h"
#include "../audio/media_proxy_internal.h"
#include "../../services/ots/ots_client_internal.h"
#include "../media_proxy_internal.h"
#include <zephyr/logging/log.h>

View file

@ -14,11 +14,11 @@
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/conn.h>
#include "bt.h"
#include "shell/bt.h"
#include <zephyr/bluetooth/services/ots.h>
#include <zephyr/bluetooth/audio/media_proxy.h>
#include "../audio/media_proxy_internal.h" /* For MPL_NO_TRACK_ID - TODO: Fix */
#include "../media_proxy_internal.h" /* For MPL_NO_TRACK_ID - TODO: Fix */
#include <zephyr/logging/log.h>

View file

@ -14,7 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "bt.h"
#include "shell/bt.h"
static struct bt_micp_mic_ctlr *mic_ctlr;
#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)

View file

@ -14,7 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "bt.h"
#include "shell/bt.h"
static void micp_mic_dev_mute_cb(uint8_t mute)
{

View file

@ -14,10 +14,10 @@
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/conn.h>
#include "bt.h"
#include "shell/bt.h"
#include <zephyr/bluetooth/audio/media_proxy.h>
#include "../audio/mpl_internal.h"
#include "../mpl_internal.h"
#include <zephyr/logging/log.h>

View file

@ -14,7 +14,7 @@
#include <zephyr/bluetooth/audio/tbs.h>
#include "bt.h"
#include "shell/bt.h"
static struct bt_conn *tbs_authorized_conn;
static bool cbs_registered;

View file

@ -22,7 +22,7 @@
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/audio/tbs.h>
#include "bt.h"
#include "shell/bt.h"
static int cmd_tbs_client_discover(const struct shell *sh, size_t argc,
char *argv[])

View file

@ -13,7 +13,7 @@
#include <zephyr/shell/shell.h>
#include <stdlib.h>
#include "bt.h"
#include "shell/bt.h"
static struct bt_vcp_vol_ctlr *vol_ctlr;
static struct bt_vcp_included vcp_included;

View file

@ -15,7 +15,7 @@
#include <stdio.h>
#include <string.h>
#include "bt.h"
#include "shell/bt.h"
static struct bt_vcp_included vcp_included;

View file

@ -25,82 +25,6 @@ zephyr_library_sources_ifdef(
CONFIG_BT_ISO
iso.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_VCP_VOL_REND
vcp_vol_rend.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_VCP_VOL_CTLR
vcp_vol_ctlr.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_MICP_MIC_DEV
micp_mic_dev.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_MICP_MIC_CTLR
micp_mic_ctlr.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_CSIP_SET_MEMBER
csip_set_member.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_CSIP_SET_COORDINATOR
csip_set_coordinator.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_TBS
tbs.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_TBS_CLIENT
tbs_client.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_MPL
mpl.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_MCC
mcc.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_MCS
media_controller.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_HAS_PRESET_SUPPORT
has.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER
cap_acceptor.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_CAP_INITIATOR
cap_initiator.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_HAS_CLIENT
has_client.c
)
# We use BT_BAP_STREAM as a common ground for audio, as that is set whenever
# any audio stream functionality is enabled.
zephyr_library_sources_ifdef(
CONFIG_BT_BAP_STREAM
bap.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_BAP_SCAN_DELEGATOR
bap_scan_delegator.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_BAP_BROADCAST_ASSISTANT
bap_broadcast_assistant.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_IAS
ias.c

View file

@ -41,6 +41,7 @@
#include "bt.h"
#include "ll.h"
#include "hci.h"
#include "../audio/shell/audio.h"
static bool no_settings_load;

View file

@ -18,7 +18,6 @@
extern const struct shell *ctx_shell;
extern struct bt_conn *default_conn;
extern struct bt_csip_set_member_svc_inst *svc_inst;
#if defined(CONFIG_BT_ISO)
extern struct bt_iso_chan iso_chan;
@ -33,10 +32,5 @@ extern struct bt_le_per_adv_sync *per_adv_syncs[CONFIG_BT_PER_ADV_SYNC_MAX];
#endif /* CONFIG_BT_EXT_ADV */
void conn_addr_str(struct bt_conn *conn, char *addr, size_t len);
ssize_t audio_ad_data_add(struct bt_data *data, const size_t data_size, const bool discoverable,
const bool connectable);
ssize_t audio_pa_data_add(struct bt_data *data_array,
const size_t data_array_size);
ssize_t csis_ad_data_add(struct bt_data *data, const size_t data_size, const bool discoverable);
#endif /* __BT_H */