From 6191a76f557e8f9bced695fd186619db55b2f2e3 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 29 Mar 2022 18:20:10 +0200 Subject: [PATCH] Bluetooth: Audio: Add _DIR_ infix to BT_AUDIO_SINK/SOURCE The values represent an enum, and it makes sense for the enum values to follow the enum type name, so an _DIR_ infix was added to the values. Signed-off-by: Emil Gydesen --- include/zephyr/bluetooth/audio/audio.h | 4 +-- .../bluetooth/unicast_audio_client/src/main.c | 6 ++-- .../bluetooth/unicast_audio_server/src/main.c | 2 +- subsys/bluetooth/audio/ascs.c | 12 ++++---- subsys/bluetooth/audio/broadcast_sink.c | 2 +- subsys/bluetooth/audio/broadcast_source.c | 2 +- subsys/bluetooth/audio/capabilities.c | 24 +++++++-------- subsys/bluetooth/audio/has.c | 6 ++-- subsys/bluetooth/audio/pacs.c | 29 +++++++++--------- subsys/bluetooth/audio/stream.c | 4 +-- subsys/bluetooth/audio/unicast_client.c | 22 +++++++------- subsys/bluetooth/shell/audio.c | 30 +++++++++---------- .../bsim_test_audio/src/unicast_client_test.c | 6 ++-- .../bsim_test_audio/src/unicast_server_test.c | 6 ++-- 14 files changed, 78 insertions(+), 77 deletions(-) diff --git a/include/zephyr/bluetooth/audio/audio.h b/include/zephyr/bluetooth/audio/audio.h index ae876ccab53..3b0c0499f1f 100644 --- a/include/zephyr/bluetooth/audio/audio.h +++ b/include/zephyr/bluetooth/audio/audio.h @@ -307,8 +307,8 @@ struct bt_audio_base { /** @brief Audio Capability type */ enum bt_audio_dir { - BT_AUDIO_SINK = 0x01, - BT_AUDIO_SOURCE = 0x02, + BT_AUDIO_DIR_SINK = 0x01, + BT_AUDIO_DIR_SOURCE = 0x02, }; /** @def BT_CODEC_QOS diff --git a/samples/bluetooth/unicast_audio_client/src/main.c b/samples/bluetooth/unicast_audio_client/src/main.c index ca748110045..b7f51004028 100644 --- a/samples/bluetooth/unicast_audio_client/src/main.c +++ b/samples/bluetooth/unicast_audio_client/src/main.c @@ -472,7 +472,7 @@ static void add_remote_codec(struct bt_codec *codec_capabilities, int index, print_codec_capabilities(codec_capabilities); - if (dir != BT_AUDIO_SINK && dir != BT_AUDIO_SOURCE) { + if (dir != BT_AUDIO_DIR_SINK && dir != BT_AUDIO_DIR_SOURCE) { return; } @@ -497,7 +497,7 @@ static void discover_sink_cb(struct bt_conn *conn, } if (ep != NULL) { - if (params->dir == BT_AUDIO_SINK) { + if (params->dir == BT_AUDIO_DIR_SINK) { add_remote_sink(ep, params->num_eps); } else { printk("Invalid param dir: %u\n", params->dir); @@ -602,7 +602,7 @@ static int discover_sink(void) int err; params.func = discover_sink_cb; - params.dir = BT_AUDIO_SINK; + params.dir = BT_AUDIO_DIR_SINK; err = bt_audio_discover(default_conn, ¶ms); if (err != 0) { diff --git a/samples/bluetooth/unicast_audio_server/src/main.c b/samples/bluetooth/unicast_audio_server/src/main.c index 8a0d8ecd165..38f405ed9c6 100644 --- a/samples/bluetooth/unicast_audio_server/src/main.c +++ b/samples/bluetooth/unicast_audio_server/src/main.c @@ -378,7 +378,7 @@ BT_CONN_CB_DEFINE(conn_callbacks) = { static struct bt_audio_capability caps[] = { { - .dir = BT_AUDIO_SINK, + .dir = BT_AUDIO_DIR_SINK, .pref = BT_AUDIO_CAPABILITY_PREF( BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, diff --git a/subsys/bluetooth/audio/ascs.c b/subsys/bluetooth/audio/ascs.c index ce62d99d5f5..dddcbecdf23 100644 --- a/subsys/bluetooth/audio/ascs.c +++ b/subsys/bluetooth/audio/ascs.c @@ -35,7 +35,7 @@ #define ASE_ID(_ase) ase->ep.status.id #define ASE_DIR(_id) \ - (_id > CONFIG_BT_ASCS_ASE_SNK_COUNT ? BT_AUDIO_SOURCE : BT_AUDIO_SINK) + (_id > CONFIG_BT_ASCS_ASE_SNK_COUNT ? BT_AUDIO_DIR_SOURCE : BT_AUDIO_DIR_SINK) #define ASE_UUID(_id) \ (_id > CONFIG_BT_ASCS_ASE_SNK_COUNT ? BT_UUID_ASCS_ASE_SRC : BT_UUID_ASCS_ASE_SNK) #define ASE_COUNT (CONFIG_BT_ASCS_ASE_SNK_COUNT + CONFIG_BT_ASCS_ASE_SRC_COUNT) @@ -347,7 +347,7 @@ static void ascs_iso_disconnected(struct bt_iso_chan *chan, uint8_t reason) /* The ASE state machine goes into different states from this operation * based on whether it is a source or a sink ASE. */ - if (ep->dir == BT_AUDIO_SOURCE) { + if (ep->dir == BT_AUDIO_DIR_SOURCE) { ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_DISABLING); } else { ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_QOS_CONFIGURED); @@ -586,7 +586,7 @@ static void ase_disable(struct bt_ascs_ase *ase) /* The ASE state machine goes into different states from this operation * based on whether it is a source or a sink ASE. */ - if (ep->dir == BT_AUDIO_SOURCE) { + if (ep->dir == BT_AUDIO_DIR_SOURCE) { ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_DISABLING); } else { ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_QOS_CONFIGURED); @@ -1506,7 +1506,7 @@ static int ase_enable(struct bt_ascs_ase *ase, struct bt_ascs_metadata *meta, ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_ENABLING); - if (ep->dir == BT_AUDIO_SINK) { + if (ep->dir == BT_AUDIO_DIR_SINK) { /* SINK ASEs can autonomously go into the streaming state if * the CIS is connected */ @@ -1593,7 +1593,7 @@ static void ase_start(struct bt_ascs_ase *ase) * characteristic to the client, and the server shall set the * Response_Code value for that ASE to 0x05 (Invalid ASE direction). */ - if (ep->dir == BT_AUDIO_SINK) { + if (ep->dir == BT_AUDIO_DIR_SINK) { BT_ERR("Start failed: invalid operation for Sink"); ascs_cp_rsp_add(ASE_ID(ase), BT_ASCS_START_OP, BT_ASCS_RSP_INVALID_DIR, BT_ASCS_REASON_NONE); @@ -1717,7 +1717,7 @@ static void ase_stop(struct bt_ascs_ase *ase) * characteristic to the client, and the server shall set the * Response_Code value for that ASE to 0x05 (Invalid ASE direction). */ - if (ase->ep.dir == BT_AUDIO_SINK) { + if (ase->ep.dir == BT_AUDIO_DIR_SINK) { BT_ERR("Stop failed: invalid operation for Sink"); ascs_cp_rsp_add(ASE_ID(ase), BT_ASCS_STOP_OP, BT_ASCS_RSP_INVALID_DIR, BT_ASCS_REASON_NONE); diff --git a/subsys/bluetooth/audio/broadcast_sink.c b/subsys/bluetooth/audio/broadcast_sink.c index 0809d586755..a9cf1618050 100644 --- a/subsys/bluetooth/audio/broadcast_sink.c +++ b/subsys/bluetooth/audio/broadcast_sink.c @@ -781,7 +781,7 @@ static void broadcast_sink_ep_init(struct bt_audio_ep *ep) ep->iso.qos = &ep->iso_qos; ep->iso.qos->rx = &ep->iso_rx; ep->iso.qos->tx = &ep->iso_tx; - ep->dir = BT_AUDIO_SINK; + ep->dir = BT_AUDIO_DIR_SINK; } static struct bt_audio_ep *broadcast_sink_new_ep(uint8_t index) diff --git a/subsys/bluetooth/audio/broadcast_source.c b/subsys/bluetooth/audio/broadcast_source.c index 0979a3bb8df..d83479386c6 100644 --- a/subsys/bluetooth/audio/broadcast_source.c +++ b/subsys/bluetooth/audio/broadcast_source.c @@ -186,7 +186,7 @@ static void broadcast_source_ep_init(struct bt_audio_ep *ep) ep->iso.qos = &ep->iso_qos; ep->iso.qos->rx = &ep->iso_rx; ep->iso.qos->tx = &ep->iso_tx; - ep->dir = BT_AUDIO_SOURCE; + ep->dir = BT_AUDIO_DIR_SOURCE; } static struct bt_audio_ep *broadcast_source_new_ep(uint8_t index) diff --git a/subsys/bluetooth/audio/capabilities.c b/subsys/bluetooth/audio/capabilities.c index 74373393dbd..b6846877cb1 100644 --- a/subsys/bluetooth/audio/capabilities.c +++ b/subsys/bluetooth/audio/capabilities.c @@ -43,9 +43,9 @@ static int unicast_server_config_cb(struct bt_conn *conn, struct bt_audio_capability *cap; sys_slist_t *lst; - if (dir == BT_AUDIO_SINK) { + if (dir == BT_AUDIO_DIR_SINK) { lst = &snks; - } else if (dir == BT_AUDIO_SOURCE) { + } else if (dir == BT_AUDIO_DIR_SOURCE) { lst = &srcs; } else { BT_ERR("Invalid endpoint dir: %u", dir); @@ -97,9 +97,9 @@ static int unicast_server_reconfig_cb(struct bt_audio_stream *stream, struct bt_audio_capability *cap; sys_slist_t *lst; - if (dir == BT_AUDIO_SINK) { + if (dir == BT_AUDIO_DIR_SINK) { lst = &snks; - } else if (dir == BT_AUDIO_SOURCE) { + } else if (dir == BT_AUDIO_DIR_SOURCE) { lst = &srcs; } else { BT_ERR("Invalid endpoint dir: %u", dir); @@ -234,9 +234,9 @@ static int publish_capability_cb(struct bt_conn *conn, uint8_t dir, sys_slist_t *lst; uint8_t i; - if (dir == BT_AUDIO_SINK) { + if (dir == BT_AUDIO_DIR_SINK) { lst = &snks; - } else if (dir == BT_AUDIO_SOURCE) { + } else if (dir == BT_AUDIO_DIR_SOURCE) { lst = &srcs; } else { BT_ERR("Invalid endpoint dir: %u", dir); @@ -273,11 +273,11 @@ static int publish_location_cb(struct bt_conn *conn, { if (0) { #if defined(CONFIG_BT_PAC_SNK_LOC) - } else if (dir == BT_AUDIO_SINK) { + } else if (dir == BT_AUDIO_DIR_SINK) { *location = sink_location; #endif /* CONFIG_BT_PAC_SNK_LOC */ #if defined(CONFIG_BT_PAC_SRC_LOC) - } else if (dir == BT_AUDIO_SOURCE) { + } else if (dir == BT_AUDIO_DIR_SOURCE) { *location = source_location; #endif /* CONFIG_BT_PAC_SRC_LOC */ } else { @@ -321,9 +321,9 @@ static struct bt_audio_unicast_server_cb unicast_server_cb = { sys_slist_t *bt_audio_capability_get(enum bt_audio_dir dir) { switch (dir) { - case BT_AUDIO_SINK: + case BT_AUDIO_DIR_SINK: return &snks; - case BT_AUDIO_SOURCE: + case BT_AUDIO_DIR_SOURCE: return &srcs; } @@ -430,11 +430,11 @@ int bt_audio_capability_set_location(enum bt_audio_dir dir, if (0) { #if defined(CONFIG_BT_PAC_SNK_LOC) - } else if (dir == BT_AUDIO_SINK) { + } else if (dir == BT_AUDIO_DIR_SINK) { sink_location = location; #endif /* CONFIG_BT_PAC_SNK_LOC */ #if defined(CONFIG_BT_PAC_SRC_LOC) - } else if (dir == BT_AUDIO_SOURCE) { + } else if (dir == BT_AUDIO_DIR_SOURCE) { source_location = location; #endif /* CONFIG_BT_PAC_SRC_LOC */ } else { diff --git a/subsys/bluetooth/audio/has.c b/subsys/bluetooth/audio/has.c index beec268485c..fc803e6ca54 100644 --- a/subsys/bluetooth/audio/has.c +++ b/subsys/bluetooth/audio/has.c @@ -736,14 +736,14 @@ static int has_init(const struct device *dev) * Front Left and the Front Right bits to a value of 0b1 * in the Sink Audio Locations characteristic value. */ - bt_audio_capability_set_location(BT_AUDIO_SINK, + bt_audio_capability_set_location(BT_AUDIO_DIR_SINK, (BT_AUDIO_LOCATION_FRONT_LEFT | BT_AUDIO_LOCATION_FRONT_RIGHT)); } else if (IS_ENABLED(CONFIG_BT_HAS_HEARING_AID_LEFT)) { - bt_audio_capability_set_location(BT_AUDIO_SINK, + bt_audio_capability_set_location(BT_AUDIO_DIR_SINK, BT_AUDIO_LOCATION_FRONT_LEFT); } else { - bt_audio_capability_set_location(BT_AUDIO_SINK, + bt_audio_capability_set_location(BT_AUDIO_DIR_SINK, BT_AUDIO_LOCATION_FRONT_RIGHT); } } diff --git a/subsys/bluetooth/audio/pacs.c b/subsys/bluetooth/audio/pacs.c index 4f177d2636e..59617b07219 100644 --- a/subsys/bluetooth/audio/pacs.c +++ b/subsys/bluetooth/audio/pacs.c @@ -113,9 +113,9 @@ static ssize_t pac_read(struct bt_conn *conn, const struct bt_gatt_attr *attr, enum bt_audio_dir dir; if (!bt_uuid_cmp(attr->uuid, BT_UUID_PACS_SNK)) { - dir = BT_AUDIO_SINK; + dir = BT_AUDIO_DIR_SINK; } else { - dir = BT_AUDIO_SOURCE; + dir = BT_AUDIO_DIR_SOURCE; } get_pac_records(conn, dir, &read_buf); @@ -228,7 +228,7 @@ static ssize_t snk_loc_read(struct bt_conn *conn, BT_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len, offset); - err = get_pac_loc(NULL, BT_AUDIO_SINK, &location); + err = get_pac_loc(NULL, BT_AUDIO_DIR_SINK, &location); if (err != 0) { BT_DBG("get_pac_loc returned %d", err); return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); @@ -274,7 +274,8 @@ static ssize_t snk_loc_write(struct bt_conn *conn, return BT_GATT_ERR(BT_ATT_ERR_VALUE_NOT_ALLOWED); } - err = unicast_server_cb->write_location(conn, BT_AUDIO_SINK, location); + err = unicast_server_cb->write_location(conn, BT_AUDIO_DIR_SINK, + location); if (err != 0) { BT_DBG("write_location returned %d", err); return BT_GATT_ERR(BT_ATT_ERR_AUTHORIZATION); @@ -324,7 +325,7 @@ static ssize_t src_loc_read(struct bt_conn *conn, BT_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len, offset); - err = get_pac_loc(NULL, BT_AUDIO_SOURCE, &location); + err = get_pac_loc(NULL, BT_AUDIO_DIR_SOURCE, &location); if (err != 0) { BT_DBG("get_pac_loc returned %d", err); return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); @@ -370,7 +371,7 @@ static ssize_t src_loc_write(struct bt_conn *conn, return BT_GATT_ERR(BT_ATT_ERR_VALUE_NOT_ALLOWED); } - err = unicast_server_cb->write_location(conn, BT_AUDIO_SOURCE, + err = unicast_server_cb->write_location(conn, BT_AUDIO_DIR_SOURCE, location); if (err != 0) { BT_DBG("write_location returned %d", err); @@ -458,11 +459,11 @@ static struct k_work_delayable *bt_pacs_get_work(enum bt_audio_dir dir) { switch (dir) { #if defined(CONFIG_BT_PAC_SNK) - case BT_AUDIO_SINK: + case BT_AUDIO_DIR_SINK: return &snks_work; #endif /* CONFIG_BT_PAC_SNK */ #if defined(CONFIG_BT_PAC_SRC) - case BT_AUDIO_SOURCE: + case BT_AUDIO_DIR_SOURCE: return &srcs_work; #endif /* CONFIG_BT_PAC_SNK */ default: @@ -475,11 +476,11 @@ static struct k_work_delayable *bt_pacs_get_loc_work(enum bt_audio_dir dir) { switch (dir) { #if defined(CONFIG_BT_PAC_SNK) - case BT_AUDIO_SINK: + case BT_AUDIO_DIR_SINK: return &snks_loc_work; #endif /* CONFIG_BT_PAC_SNK */ #if defined(CONFIG_BT_PAC_SRC) - case BT_AUDIO_SOURCE: + case BT_AUDIO_DIR_SOURCE: return &srcs_loc_work; #endif /* CONFIG_BT_PAC_SNK */ default: @@ -497,14 +498,14 @@ static void pac_notify_loc(struct k_work *work) #if defined(CONFIG_BT_PAC_SNK) if (work == &snks_loc_work.work) { - dir = BT_AUDIO_SINK; + dir = BT_AUDIO_DIR_SINK; uuid = BT_UUID_PACS_SNK_LOC; } #endif /* CONFIG_BT_PAC_SNK */ #if defined(CONFIG_BT_PAC_SRC) if (work == &srcs_loc_work.work) { - dir = BT_AUDIO_SOURCE; + dir = BT_AUDIO_DIR_SOURCE; uuid = BT_UUID_PACS_SRC_LOC; } #endif /* CONFIG_BT_PAC_SRC */ @@ -535,14 +536,14 @@ static void pac_notify(struct k_work *work) #if defined(CONFIG_BT_PAC_SNK) if (work == &snks_work.work) { - dir = BT_AUDIO_SINK; + dir = BT_AUDIO_DIR_SINK; uuid = BT_UUID_PACS_SNK; } #endif /* CONFIG_BT_PAC_SNK */ #if defined(CONFIG_BT_PAC_SRC) if (work == &srcs_work.work) { - dir = BT_AUDIO_SOURCE; + dir = BT_AUDIO_DIR_SOURCE; uuid = BT_UUID_PACS_SRC; } #endif /* CONFIG_BT_PAC_SRC */ diff --git a/subsys/bluetooth/audio/stream.c b/subsys/bluetooth/audio/stream.c index 8c6eaae5770..ce4f20017c2 100644 --- a/subsys/bluetooth/audio/stream.c +++ b/subsys/bluetooth/audio/stream.c @@ -546,13 +546,13 @@ int bt_audio_stream_qos(struct bt_conn *conn, } iso_qos = stream->iso->qos; - if (stream->ep->dir == BT_AUDIO_SINK) { + if (stream->ep->dir == BT_AUDIO_DIR_SINK) { /* If the endpoint is a sink, then we need to * configure our TX parameters */ io = iso_qos->tx; iso_qos->rx = NULL; - } else if (stream->ep->dir == BT_AUDIO_SOURCE) { + } else if (stream->ep->dir == BT_AUDIO_DIR_SOURCE) { /* If the endpoint is a source, then we need to * configure our RX parameters */ diff --git a/subsys/bluetooth/audio/unicast_client.c b/subsys/bluetooth/audio/unicast_client.c index b6019b40293..01dc5c899d9 100644 --- a/subsys/bluetooth/audio/unicast_client.c +++ b/subsys/bluetooth/audio/unicast_client.c @@ -30,7 +30,7 @@ #if defined(CONFIG_BT_AUDIO_UNICAST_CLIENT) -#define PAC_DIR_UNUSED(dir) ((dir) != BT_AUDIO_SINK && (dir) != BT_AUDIO_SOURCE) +#define PAC_DIR_UNUSED(dir) ((dir) != BT_AUDIO_DIR_SINK && (dir) != BT_AUDIO_DIR_SOURCE) #define EP_ISO(_iso) CONTAINER_OF(_iso, struct bt_audio_ep, iso) @@ -193,11 +193,11 @@ static struct bt_audio_ep *unicast_client_ep_new(struct bt_conn *conn, index = bt_conn_index(conn); switch (dir) { - case BT_AUDIO_SINK: + case BT_AUDIO_DIR_SINK: cache = snks[index]; size = ARRAY_SIZE(snks[index]); break; - case BT_AUDIO_SOURCE: + case BT_AUDIO_DIR_SOURCE: cache = srcs[index]; size = ARRAY_SIZE(srcs[index]); break; @@ -1420,7 +1420,7 @@ int bt_unicast_client_start(struct bt_audio_stream *stream) /* When initiated by the client, valid only if Direction field * parameter value = 0x02 (Server is Audio Source) */ - if (ep->dir == BT_AUDIO_SOURCE) { + if (ep->dir == BT_AUDIO_DIR_SOURCE) { err = unicast_client_ep_start(ep, buf); if (err) { return err; @@ -1472,7 +1472,7 @@ int bt_unicast_client_stop(struct bt_audio_stream *stream) /* When initiated by the client, valid only if Direction field * parameter value = 0x02 (Server is Audio Source) */ - if (ep->dir == BT_AUDIO_SOURCE) { + if (ep->dir == BT_AUDIO_DIR_SOURCE) { err = unicast_client_ep_stop(ep, buf); if (err) { return err; @@ -1649,9 +1649,9 @@ static int unicast_client_ase_discover(struct bt_conn *conn, params->read.func = unicast_client_ase_read_func; params->read.handle_count = 0u; - if (params->dir == BT_AUDIO_SINK) { + if (params->dir == BT_AUDIO_DIR_SINK) { params->read.by_uuid.uuid = ase_snk_uuid; - } else if (params->dir == BT_AUDIO_SOURCE) { + } else if (params->dir == BT_AUDIO_DIR_SOURCE) { params->read.by_uuid.uuid = ase_src_uuid; } else { return -EINVAL; @@ -1695,10 +1695,10 @@ static uint8_t unicast_client_pacs_context_read_func(struct bt_conn *conn, } switch (pac->dir) { - case BT_AUDIO_SINK: + case BT_AUDIO_DIR_SINK: pac->context = sys_le16_to_cpu(context->snk); break; - case BT_AUDIO_SOURCE: + case BT_AUDIO_DIR_SOURCE: pac->context = sys_le16_to_cpu(context->src); break; default: @@ -1909,9 +1909,9 @@ int bt_audio_discover(struct bt_conn *conn, return -EINVAL; } - if (params->dir == BT_AUDIO_SINK) { + if (params->dir == BT_AUDIO_DIR_SINK) { params->read.by_uuid.uuid = snk_uuid; - } else if (params->dir == BT_AUDIO_SOURCE) { + } else if (params->dir == BT_AUDIO_DIR_SOURCE) { params->read.by_uuid.uuid = src_uuid; } else { return -EINVAL; diff --git a/subsys/bluetooth/shell/audio.c b/subsys/bluetooth/shell/audio.c index 98713a644cf..e2f6a17ecde 100644 --- a/subsys/bluetooth/shell/audio.c +++ b/subsys/bluetooth/shell/audio.c @@ -437,7 +437,7 @@ static struct bt_audio_capability_ops lc3_ops = { static struct bt_audio_capability caps[MAX_PAC] = { { - .dir = BT_AUDIO_SOURCE, + .dir = BT_AUDIO_DIR_SOURCE, .pref = BT_AUDIO_CAPABILITY_PREF( BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED, BT_GAP_LE_PHY_2M, 0u, 60u, 20000u, 40000u, @@ -446,7 +446,7 @@ static struct bt_audio_capability caps[MAX_PAC] = { .ops = &lc3_ops, }, { - .dir = BT_AUDIO_SINK, + .dir = BT_AUDIO_DIR_SINK, .pref = BT_AUDIO_CAPABILITY_PREF( BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED, BT_GAP_LE_PHY_2M, 0u, 60u, 20000u, 40000u, @@ -462,13 +462,13 @@ static uint8_t stream_dir(const struct bt_audio_stream *stream) { for (size_t i = 0; i < ARRAY_SIZE(snks); i++) { if (snks[i] != NULL && stream->ep == snks[i]) { - return BT_AUDIO_SINK; + return BT_AUDIO_DIR_SINK; } } for (size_t i = 0; i < ARRAY_SIZE(srcs); i++) { if (srcs[i] != NULL && stream->ep == srcs[i]) { - return BT_AUDIO_SOURCE; + return BT_AUDIO_DIR_SOURCE; } } @@ -482,7 +482,7 @@ static void add_codec(struct bt_codec *codec, uint8_t index, enum bt_audio_dir d print_codec(codec); - if (dir != BT_AUDIO_SINK && dir != BT_AUDIO_SOURCE) { + if (dir != BT_AUDIO_DIR_SINK && dir != BT_AUDIO_DIR_SOURCE) { return; } @@ -515,9 +515,9 @@ static void discover_cb(struct bt_conn *conn, struct bt_codec *codec, } if (ep) { - if (params->dir == BT_AUDIO_SINK) { + if (params->dir == BT_AUDIO_DIR_SINK) { add_sink(ep, params->num_eps); - } else if (params->dir == BT_AUDIO_SOURCE) { + } else if (params->dir == BT_AUDIO_DIR_SOURCE) { add_source(ep, params->num_eps); } @@ -539,9 +539,9 @@ static void discover_all(struct bt_conn *conn, struct bt_codec *codec, } if (ep) { - if (params->dir == BT_AUDIO_SINK) { + if (params->dir == BT_AUDIO_DIR_SINK) { add_sink(ep, params->num_eps); - } else if (params->dir == BT_AUDIO_SOURCE) { + } else if (params->dir == BT_AUDIO_DIR_SOURCE) { add_source(ep, params->num_eps); } @@ -549,11 +549,11 @@ static void discover_all(struct bt_conn *conn, struct bt_codec *codec, } /* Sinks discovery complete, now discover sources */ - if (params->dir == BT_AUDIO_SINK) { + if (params->dir == BT_AUDIO_DIR_SINK) { int err; params->func = discover_cb; - params->dir = BT_AUDIO_SOURCE; + params->dir = BT_AUDIO_DIR_SOURCE; err = bt_audio_discover(default_conn, params); if (err) { @@ -578,14 +578,14 @@ static int cmd_discover(const struct shell *sh, size_t argc, char *argv[]) } params.func = discover_all; - params.dir = BT_AUDIO_SINK; + params.dir = BT_AUDIO_DIR_SINK; if (argc > 1) { if (!strcmp(argv[1], "sink")) { params.func = discover_cb; } else if (!strcmp(argv[1], "source")) { params.func = discover_cb; - params.dir = BT_AUDIO_SOURCE; + params.dir = BT_AUDIO_DIR_SOURCE; } else { shell_error(sh, "Unsupported dir: %s", argv[1]); return -ENOEXEC; @@ -636,10 +636,10 @@ static int cmd_config(const struct shell *sh, size_t argc, char *argv[]) } if (!strcmp(argv[1], "sink")) { - dir = BT_AUDIO_SINK; + dir = BT_AUDIO_DIR_SINK; ep = snks[index]; } else if (!strcmp(argv[1], "source")) { - dir = BT_AUDIO_SOURCE; + dir = BT_AUDIO_DIR_SOURCE; ep = srcs[index]; } else { shell_error(sh, "Unsupported dir: %s", argv[1]); diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/unicast_client_test.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/unicast_client_test.c index 2c5fe24f5c7..53160204f3b 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/unicast_client_test.c +++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/unicast_client_test.c @@ -107,7 +107,7 @@ static void add_remote_codec(struct bt_codec *codec, int index, print_codec(codec); - if (dir != BT_AUDIO_SINK && dir != BT_AUDIO_SOURCE) { + if (dir != BT_AUDIO_DIR_SINK && dir != BT_AUDIO_DIR_SOURCE) { return; } @@ -136,7 +136,7 @@ static void discover_sink_cb(struct bt_conn *conn, } if (ep != NULL) { - if (params->dir == BT_AUDIO_SINK) { + if (params->dir == BT_AUDIO_DIR_SINK) { add_remote_sink(ep, params->num_eps); endpoint_found = true; } else { @@ -232,7 +232,7 @@ static void discover_sink(void) int err; params.func = discover_sink_cb; - params.dir = BT_AUDIO_SINK; + params.dir = BT_AUDIO_DIR_SINK; err = bt_audio_discover(default_conn, ¶ms); if (err != 0) { diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/unicast_server_test.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/unicast_server_test.c index 7a5cabedf90..8f9c76a3253 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/unicast_server_test.c +++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/unicast_server_test.c @@ -169,7 +169,7 @@ BT_CONN_CB_DEFINE(conn_callbacks) = { static void init(void) { static struct bt_audio_capability caps = { - .dir = BT_AUDIO_SINK, + .dir = BT_AUDIO_DIR_SINK, .pref = BT_AUDIO_CAPABILITY_PREF( BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000), @@ -210,7 +210,7 @@ static void set_location(void) int err; if (IS_ENABLED(CONFIG_BT_PAC_SNK_LOC)) { - err = bt_audio_capability_set_location(BT_AUDIO_SINK, + err = bt_audio_capability_set_location(BT_AUDIO_DIR_SINK, BT_AUDIO_LOCATION_FRONT_CENTER); if (err != 0) { FAIL("Failed to set sink location (err %d)\n", err); @@ -219,7 +219,7 @@ static void set_location(void) } if (IS_ENABLED(CONFIG_BT_PAC_SRC_LOC)) { - err = bt_audio_capability_set_location(BT_AUDIO_SINK, + err = bt_audio_capability_set_location(BT_AUDIO_DIR_SINK, (BT_AUDIO_LOCATION_FRONT_LEFT | BT_AUDIO_LOCATION_FRONT_RIGHT)); if (err != 0) {