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 <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2022-03-29 18:20:10 +02:00 committed by Carles Cufí
commit 6191a76f55
14 changed files with 78 additions and 77 deletions

View file

@ -307,8 +307,8 @@ struct bt_audio_base {
/** @brief Audio Capability type */ /** @brief Audio Capability type */
enum bt_audio_dir { enum bt_audio_dir {
BT_AUDIO_SINK = 0x01, BT_AUDIO_DIR_SINK = 0x01,
BT_AUDIO_SOURCE = 0x02, BT_AUDIO_DIR_SOURCE = 0x02,
}; };
/** @def BT_CODEC_QOS /** @def BT_CODEC_QOS

View file

@ -472,7 +472,7 @@ static void add_remote_codec(struct bt_codec *codec_capabilities, int index,
print_codec_capabilities(codec_capabilities); 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; return;
} }
@ -497,7 +497,7 @@ static void discover_sink_cb(struct bt_conn *conn,
} }
if (ep != NULL) { if (ep != NULL) {
if (params->dir == BT_AUDIO_SINK) { if (params->dir == BT_AUDIO_DIR_SINK) {
add_remote_sink(ep, params->num_eps); add_remote_sink(ep, params->num_eps);
} else { } else {
printk("Invalid param dir: %u\n", params->dir); printk("Invalid param dir: %u\n", params->dir);
@ -602,7 +602,7 @@ static int discover_sink(void)
int err; int err;
params.func = discover_sink_cb; params.func = discover_sink_cb;
params.dir = BT_AUDIO_SINK; params.dir = BT_AUDIO_DIR_SINK;
err = bt_audio_discover(default_conn, &params); err = bt_audio_discover(default_conn, &params);
if (err != 0) { if (err != 0) {

View file

@ -378,7 +378,7 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
static struct bt_audio_capability caps[] = { static struct bt_audio_capability caps[] = {
{ {
.dir = BT_AUDIO_SINK, .dir = BT_AUDIO_DIR_SINK,
.pref = BT_AUDIO_CAPABILITY_PREF( .pref = BT_AUDIO_CAPABILITY_PREF(
BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED, BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED,
BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000,

View file

@ -35,7 +35,7 @@
#define ASE_ID(_ase) ase->ep.status.id #define ASE_ID(_ase) ase->ep.status.id
#define ASE_DIR(_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) \ #define ASE_UUID(_id) \
(_id > CONFIG_BT_ASCS_ASE_SNK_COUNT ? BT_UUID_ASCS_ASE_SRC : BT_UUID_ASCS_ASE_SNK) (_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) #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 /* The ASE state machine goes into different states from this operation
* based on whether it is a source or a sink ASE. * 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); ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_DISABLING);
} else { } else {
ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_QOS_CONFIGURED); 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 /* The ASE state machine goes into different states from this operation
* based on whether it is a source or a sink ASE. * 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); ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_DISABLING);
} else { } else {
ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_QOS_CONFIGURED); 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); 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 /* SINK ASEs can autonomously go into the streaming state if
* the CIS is connected * 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 * characteristic to the client, and the server shall set the
* Response_Code value for that ASE to 0x05 (Invalid ASE direction). * 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"); BT_ERR("Start failed: invalid operation for Sink");
ascs_cp_rsp_add(ASE_ID(ase), BT_ASCS_START_OP, ascs_cp_rsp_add(ASE_ID(ase), BT_ASCS_START_OP,
BT_ASCS_RSP_INVALID_DIR, BT_ASCS_REASON_NONE); 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 * characteristic to the client, and the server shall set the
* Response_Code value for that ASE to 0x05 (Invalid ASE direction). * 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"); BT_ERR("Stop failed: invalid operation for Sink");
ascs_cp_rsp_add(ASE_ID(ase), BT_ASCS_STOP_OP, ascs_cp_rsp_add(ASE_ID(ase), BT_ASCS_STOP_OP,
BT_ASCS_RSP_INVALID_DIR, BT_ASCS_REASON_NONE); BT_ASCS_RSP_INVALID_DIR, BT_ASCS_REASON_NONE);

View file

@ -781,7 +781,7 @@ static void broadcast_sink_ep_init(struct bt_audio_ep *ep)
ep->iso.qos = &ep->iso_qos; ep->iso.qos = &ep->iso_qos;
ep->iso.qos->rx = &ep->iso_rx; ep->iso.qos->rx = &ep->iso_rx;
ep->iso.qos->tx = &ep->iso_tx; 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) static struct bt_audio_ep *broadcast_sink_new_ep(uint8_t index)

View file

@ -186,7 +186,7 @@ static void broadcast_source_ep_init(struct bt_audio_ep *ep)
ep->iso.qos = &ep->iso_qos; ep->iso.qos = &ep->iso_qos;
ep->iso.qos->rx = &ep->iso_rx; ep->iso.qos->rx = &ep->iso_rx;
ep->iso.qos->tx = &ep->iso_tx; 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) static struct bt_audio_ep *broadcast_source_new_ep(uint8_t index)

View file

@ -43,9 +43,9 @@ static int unicast_server_config_cb(struct bt_conn *conn,
struct bt_audio_capability *cap; struct bt_audio_capability *cap;
sys_slist_t *lst; sys_slist_t *lst;
if (dir == BT_AUDIO_SINK) { if (dir == BT_AUDIO_DIR_SINK) {
lst = &snks; lst = &snks;
} else if (dir == BT_AUDIO_SOURCE) { } else if (dir == BT_AUDIO_DIR_SOURCE) {
lst = &srcs; lst = &srcs;
} else { } else {
BT_ERR("Invalid endpoint dir: %u", dir); 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; struct bt_audio_capability *cap;
sys_slist_t *lst; sys_slist_t *lst;
if (dir == BT_AUDIO_SINK) { if (dir == BT_AUDIO_DIR_SINK) {
lst = &snks; lst = &snks;
} else if (dir == BT_AUDIO_SOURCE) { } else if (dir == BT_AUDIO_DIR_SOURCE) {
lst = &srcs; lst = &srcs;
} else { } else {
BT_ERR("Invalid endpoint dir: %u", dir); 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; sys_slist_t *lst;
uint8_t i; uint8_t i;
if (dir == BT_AUDIO_SINK) { if (dir == BT_AUDIO_DIR_SINK) {
lst = &snks; lst = &snks;
} else if (dir == BT_AUDIO_SOURCE) { } else if (dir == BT_AUDIO_DIR_SOURCE) {
lst = &srcs; lst = &srcs;
} else { } else {
BT_ERR("Invalid endpoint dir: %u", dir); BT_ERR("Invalid endpoint dir: %u", dir);
@ -273,11 +273,11 @@ static int publish_location_cb(struct bt_conn *conn,
{ {
if (0) { if (0) {
#if defined(CONFIG_BT_PAC_SNK_LOC) #if defined(CONFIG_BT_PAC_SNK_LOC)
} else if (dir == BT_AUDIO_SINK) { } else if (dir == BT_AUDIO_DIR_SINK) {
*location = sink_location; *location = sink_location;
#endif /* CONFIG_BT_PAC_SNK_LOC */ #endif /* CONFIG_BT_PAC_SNK_LOC */
#if defined(CONFIG_BT_PAC_SRC_LOC) #if defined(CONFIG_BT_PAC_SRC_LOC)
} else if (dir == BT_AUDIO_SOURCE) { } else if (dir == BT_AUDIO_DIR_SOURCE) {
*location = source_location; *location = source_location;
#endif /* CONFIG_BT_PAC_SRC_LOC */ #endif /* CONFIG_BT_PAC_SRC_LOC */
} else { } 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) sys_slist_t *bt_audio_capability_get(enum bt_audio_dir dir)
{ {
switch (dir) { switch (dir) {
case BT_AUDIO_SINK: case BT_AUDIO_DIR_SINK:
return &snks; return &snks;
case BT_AUDIO_SOURCE: case BT_AUDIO_DIR_SOURCE:
return &srcs; return &srcs;
} }
@ -430,11 +430,11 @@ int bt_audio_capability_set_location(enum bt_audio_dir dir,
if (0) { if (0) {
#if defined(CONFIG_BT_PAC_SNK_LOC) #if defined(CONFIG_BT_PAC_SNK_LOC)
} else if (dir == BT_AUDIO_SINK) { } else if (dir == BT_AUDIO_DIR_SINK) {
sink_location = location; sink_location = location;
#endif /* CONFIG_BT_PAC_SNK_LOC */ #endif /* CONFIG_BT_PAC_SNK_LOC */
#if defined(CONFIG_BT_PAC_SRC_LOC) #if defined(CONFIG_BT_PAC_SRC_LOC)
} else if (dir == BT_AUDIO_SOURCE) { } else if (dir == BT_AUDIO_DIR_SOURCE) {
source_location = location; source_location = location;
#endif /* CONFIG_BT_PAC_SRC_LOC */ #endif /* CONFIG_BT_PAC_SRC_LOC */
} else { } else {

View file

@ -736,14 +736,14 @@ static int has_init(const struct device *dev)
* Front Left and the Front Right bits to a value of 0b1 * Front Left and the Front Right bits to a value of 0b1
* in the Sink Audio Locations characteristic value. * 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_LEFT |
BT_AUDIO_LOCATION_FRONT_RIGHT)); BT_AUDIO_LOCATION_FRONT_RIGHT));
} else if (IS_ENABLED(CONFIG_BT_HAS_HEARING_AID_LEFT)) { } 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); BT_AUDIO_LOCATION_FRONT_LEFT);
} else { } else {
bt_audio_capability_set_location(BT_AUDIO_SINK, bt_audio_capability_set_location(BT_AUDIO_DIR_SINK,
BT_AUDIO_LOCATION_FRONT_RIGHT); BT_AUDIO_LOCATION_FRONT_RIGHT);
} }
} }

View file

@ -113,9 +113,9 @@ static ssize_t pac_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
enum bt_audio_dir dir; enum bt_audio_dir dir;
if (!bt_uuid_cmp(attr->uuid, BT_UUID_PACS_SNK)) { if (!bt_uuid_cmp(attr->uuid, BT_UUID_PACS_SNK)) {
dir = BT_AUDIO_SINK; dir = BT_AUDIO_DIR_SINK;
} else { } else {
dir = BT_AUDIO_SOURCE; dir = BT_AUDIO_DIR_SOURCE;
} }
get_pac_records(conn, dir, &read_buf); 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, BT_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len,
offset); offset);
err = get_pac_loc(NULL, BT_AUDIO_SINK, &location); err = get_pac_loc(NULL, BT_AUDIO_DIR_SINK, &location);
if (err != 0) { if (err != 0) {
BT_DBG("get_pac_loc returned %d", err); BT_DBG("get_pac_loc returned %d", err);
return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); 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); 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) { if (err != 0) {
BT_DBG("write_location returned %d", err); BT_DBG("write_location returned %d", err);
return BT_GATT_ERR(BT_ATT_ERR_AUTHORIZATION); 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, BT_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len,
offset); offset);
err = get_pac_loc(NULL, BT_AUDIO_SOURCE, &location); err = get_pac_loc(NULL, BT_AUDIO_DIR_SOURCE, &location);
if (err != 0) { if (err != 0) {
BT_DBG("get_pac_loc returned %d", err); BT_DBG("get_pac_loc returned %d", err);
return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); 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); 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); location);
if (err != 0) { if (err != 0) {
BT_DBG("write_location returned %d", err); 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) { switch (dir) {
#if defined(CONFIG_BT_PAC_SNK) #if defined(CONFIG_BT_PAC_SNK)
case BT_AUDIO_SINK: case BT_AUDIO_DIR_SINK:
return &snks_work; return &snks_work;
#endif /* CONFIG_BT_PAC_SNK */ #endif /* CONFIG_BT_PAC_SNK */
#if defined(CONFIG_BT_PAC_SRC) #if defined(CONFIG_BT_PAC_SRC)
case BT_AUDIO_SOURCE: case BT_AUDIO_DIR_SOURCE:
return &srcs_work; return &srcs_work;
#endif /* CONFIG_BT_PAC_SNK */ #endif /* CONFIG_BT_PAC_SNK */
default: default:
@ -475,11 +476,11 @@ static struct k_work_delayable *bt_pacs_get_loc_work(enum bt_audio_dir dir)
{ {
switch (dir) { switch (dir) {
#if defined(CONFIG_BT_PAC_SNK) #if defined(CONFIG_BT_PAC_SNK)
case BT_AUDIO_SINK: case BT_AUDIO_DIR_SINK:
return &snks_loc_work; return &snks_loc_work;
#endif /* CONFIG_BT_PAC_SNK */ #endif /* CONFIG_BT_PAC_SNK */
#if defined(CONFIG_BT_PAC_SRC) #if defined(CONFIG_BT_PAC_SRC)
case BT_AUDIO_SOURCE: case BT_AUDIO_DIR_SOURCE:
return &srcs_loc_work; return &srcs_loc_work;
#endif /* CONFIG_BT_PAC_SNK */ #endif /* CONFIG_BT_PAC_SNK */
default: default:
@ -497,14 +498,14 @@ static void pac_notify_loc(struct k_work *work)
#if defined(CONFIG_BT_PAC_SNK) #if defined(CONFIG_BT_PAC_SNK)
if (work == &snks_loc_work.work) { if (work == &snks_loc_work.work) {
dir = BT_AUDIO_SINK; dir = BT_AUDIO_DIR_SINK;
uuid = BT_UUID_PACS_SNK_LOC; uuid = BT_UUID_PACS_SNK_LOC;
} }
#endif /* CONFIG_BT_PAC_SNK */ #endif /* CONFIG_BT_PAC_SNK */
#if defined(CONFIG_BT_PAC_SRC) #if defined(CONFIG_BT_PAC_SRC)
if (work == &srcs_loc_work.work) { if (work == &srcs_loc_work.work) {
dir = BT_AUDIO_SOURCE; dir = BT_AUDIO_DIR_SOURCE;
uuid = BT_UUID_PACS_SRC_LOC; uuid = BT_UUID_PACS_SRC_LOC;
} }
#endif /* CONFIG_BT_PAC_SRC */ #endif /* CONFIG_BT_PAC_SRC */
@ -535,14 +536,14 @@ static void pac_notify(struct k_work *work)
#if defined(CONFIG_BT_PAC_SNK) #if defined(CONFIG_BT_PAC_SNK)
if (work == &snks_work.work) { if (work == &snks_work.work) {
dir = BT_AUDIO_SINK; dir = BT_AUDIO_DIR_SINK;
uuid = BT_UUID_PACS_SNK; uuid = BT_UUID_PACS_SNK;
} }
#endif /* CONFIG_BT_PAC_SNK */ #endif /* CONFIG_BT_PAC_SNK */
#if defined(CONFIG_BT_PAC_SRC) #if defined(CONFIG_BT_PAC_SRC)
if (work == &srcs_work.work) { if (work == &srcs_work.work) {
dir = BT_AUDIO_SOURCE; dir = BT_AUDIO_DIR_SOURCE;
uuid = BT_UUID_PACS_SRC; uuid = BT_UUID_PACS_SRC;
} }
#endif /* CONFIG_BT_PAC_SRC */ #endif /* CONFIG_BT_PAC_SRC */

View file

@ -546,13 +546,13 @@ int bt_audio_stream_qos(struct bt_conn *conn,
} }
iso_qos = stream->iso->qos; 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 /* If the endpoint is a sink, then we need to
* configure our TX parameters * configure our TX parameters
*/ */
io = iso_qos->tx; io = iso_qos->tx;
iso_qos->rx = NULL; 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 /* If the endpoint is a source, then we need to
* configure our RX parameters * configure our RX parameters
*/ */

View file

@ -30,7 +30,7 @@
#if defined(CONFIG_BT_AUDIO_UNICAST_CLIENT) #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) #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); index = bt_conn_index(conn);
switch (dir) { switch (dir) {
case BT_AUDIO_SINK: case BT_AUDIO_DIR_SINK:
cache = snks[index]; cache = snks[index];
size = ARRAY_SIZE(snks[index]); size = ARRAY_SIZE(snks[index]);
break; break;
case BT_AUDIO_SOURCE: case BT_AUDIO_DIR_SOURCE:
cache = srcs[index]; cache = srcs[index];
size = ARRAY_SIZE(srcs[index]); size = ARRAY_SIZE(srcs[index]);
break; 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 /* When initiated by the client, valid only if Direction field
* parameter value = 0x02 (Server is Audio Source) * 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); err = unicast_client_ep_start(ep, buf);
if (err) { if (err) {
return 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 /* When initiated by the client, valid only if Direction field
* parameter value = 0x02 (Server is Audio Source) * 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); err = unicast_client_ep_stop(ep, buf);
if (err) { if (err) {
return 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.func = unicast_client_ase_read_func;
params->read.handle_count = 0u; 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; 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; params->read.by_uuid.uuid = ase_src_uuid;
} else { } else {
return -EINVAL; return -EINVAL;
@ -1695,10 +1695,10 @@ static uint8_t unicast_client_pacs_context_read_func(struct bt_conn *conn,
} }
switch (pac->dir) { switch (pac->dir) {
case BT_AUDIO_SINK: case BT_AUDIO_DIR_SINK:
pac->context = sys_le16_to_cpu(context->snk); pac->context = sys_le16_to_cpu(context->snk);
break; break;
case BT_AUDIO_SOURCE: case BT_AUDIO_DIR_SOURCE:
pac->context = sys_le16_to_cpu(context->src); pac->context = sys_le16_to_cpu(context->src);
break; break;
default: default:
@ -1909,9 +1909,9 @@ int bt_audio_discover(struct bt_conn *conn,
return -EINVAL; return -EINVAL;
} }
if (params->dir == BT_AUDIO_SINK) { if (params->dir == BT_AUDIO_DIR_SINK) {
params->read.by_uuid.uuid = snk_uuid; 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; params->read.by_uuid.uuid = src_uuid;
} else { } else {
return -EINVAL; return -EINVAL;

View file

@ -437,7 +437,7 @@ static struct bt_audio_capability_ops lc3_ops = {
static struct bt_audio_capability caps[MAX_PAC] = { static struct bt_audio_capability caps[MAX_PAC] = {
{ {
.dir = BT_AUDIO_SOURCE, .dir = BT_AUDIO_DIR_SOURCE,
.pref = BT_AUDIO_CAPABILITY_PREF( .pref = BT_AUDIO_CAPABILITY_PREF(
BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED, BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED,
BT_GAP_LE_PHY_2M, 0u, 60u, 20000u, 40000u, BT_GAP_LE_PHY_2M, 0u, 60u, 20000u, 40000u,
@ -446,7 +446,7 @@ static struct bt_audio_capability caps[MAX_PAC] = {
.ops = &lc3_ops, .ops = &lc3_ops,
}, },
{ {
.dir = BT_AUDIO_SINK, .dir = BT_AUDIO_DIR_SINK,
.pref = BT_AUDIO_CAPABILITY_PREF( .pref = BT_AUDIO_CAPABILITY_PREF(
BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED, BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED,
BT_GAP_LE_PHY_2M, 0u, 60u, 20000u, 40000u, 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++) { for (size_t i = 0; i < ARRAY_SIZE(snks); i++) {
if (snks[i] != NULL && stream->ep == 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++) { for (size_t i = 0; i < ARRAY_SIZE(srcs); i++) {
if (srcs[i] != NULL && stream->ep == 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); print_codec(codec);
if (dir != BT_AUDIO_SINK && dir != BT_AUDIO_SOURCE) { if (dir != BT_AUDIO_DIR_SINK && dir != BT_AUDIO_DIR_SOURCE) {
return; return;
} }
@ -515,9 +515,9 @@ static void discover_cb(struct bt_conn *conn, struct bt_codec *codec,
} }
if (ep) { if (ep) {
if (params->dir == BT_AUDIO_SINK) { if (params->dir == BT_AUDIO_DIR_SINK) {
add_sink(ep, params->num_eps); 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); 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 (ep) {
if (params->dir == BT_AUDIO_SINK) { if (params->dir == BT_AUDIO_DIR_SINK) {
add_sink(ep, params->num_eps); 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); 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 */ /* Sinks discovery complete, now discover sources */
if (params->dir == BT_AUDIO_SINK) { if (params->dir == BT_AUDIO_DIR_SINK) {
int err; int err;
params->func = discover_cb; params->func = discover_cb;
params->dir = BT_AUDIO_SOURCE; params->dir = BT_AUDIO_DIR_SOURCE;
err = bt_audio_discover(default_conn, params); err = bt_audio_discover(default_conn, params);
if (err) { if (err) {
@ -578,14 +578,14 @@ static int cmd_discover(const struct shell *sh, size_t argc, char *argv[])
} }
params.func = discover_all; params.func = discover_all;
params.dir = BT_AUDIO_SINK; params.dir = BT_AUDIO_DIR_SINK;
if (argc > 1) { if (argc > 1) {
if (!strcmp(argv[1], "sink")) { if (!strcmp(argv[1], "sink")) {
params.func = discover_cb; params.func = discover_cb;
} else if (!strcmp(argv[1], "source")) { } else if (!strcmp(argv[1], "source")) {
params.func = discover_cb; params.func = discover_cb;
params.dir = BT_AUDIO_SOURCE; params.dir = BT_AUDIO_DIR_SOURCE;
} else { } else {
shell_error(sh, "Unsupported dir: %s", argv[1]); shell_error(sh, "Unsupported dir: %s", argv[1]);
return -ENOEXEC; return -ENOEXEC;
@ -636,10 +636,10 @@ static int cmd_config(const struct shell *sh, size_t argc, char *argv[])
} }
if (!strcmp(argv[1], "sink")) { if (!strcmp(argv[1], "sink")) {
dir = BT_AUDIO_SINK; dir = BT_AUDIO_DIR_SINK;
ep = snks[index]; ep = snks[index];
} else if (!strcmp(argv[1], "source")) { } else if (!strcmp(argv[1], "source")) {
dir = BT_AUDIO_SOURCE; dir = BT_AUDIO_DIR_SOURCE;
ep = srcs[index]; ep = srcs[index];
} else { } else {
shell_error(sh, "Unsupported dir: %s", argv[1]); shell_error(sh, "Unsupported dir: %s", argv[1]);

View file

@ -107,7 +107,7 @@ static void add_remote_codec(struct bt_codec *codec, int index,
print_codec(codec); print_codec(codec);
if (dir != BT_AUDIO_SINK && dir != BT_AUDIO_SOURCE) { if (dir != BT_AUDIO_DIR_SINK && dir != BT_AUDIO_DIR_SOURCE) {
return; return;
} }
@ -136,7 +136,7 @@ static void discover_sink_cb(struct bt_conn *conn,
} }
if (ep != NULL) { if (ep != NULL) {
if (params->dir == BT_AUDIO_SINK) { if (params->dir == BT_AUDIO_DIR_SINK) {
add_remote_sink(ep, params->num_eps); add_remote_sink(ep, params->num_eps);
endpoint_found = true; endpoint_found = true;
} else { } else {
@ -232,7 +232,7 @@ static void discover_sink(void)
int err; int err;
params.func = discover_sink_cb; params.func = discover_sink_cb;
params.dir = BT_AUDIO_SINK; params.dir = BT_AUDIO_DIR_SINK;
err = bt_audio_discover(default_conn, &params); err = bt_audio_discover(default_conn, &params);
if (err != 0) { if (err != 0) {

View file

@ -169,7 +169,7 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
static void init(void) static void init(void)
{ {
static struct bt_audio_capability caps = { static struct bt_audio_capability caps = {
.dir = BT_AUDIO_SINK, .dir = BT_AUDIO_DIR_SINK,
.pref = BT_AUDIO_CAPABILITY_PREF( .pref = BT_AUDIO_CAPABILITY_PREF(
BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED, BT_AUDIO_CAPABILITY_UNFRAMED_SUPPORTED,
BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000), BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000),
@ -210,7 +210,7 @@ static void set_location(void)
int err; int err;
if (IS_ENABLED(CONFIG_BT_PAC_SNK_LOC)) { 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); BT_AUDIO_LOCATION_FRONT_CENTER);
if (err != 0) { if (err != 0) {
FAIL("Failed to set sink location (err %d)\n", err); 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)) { 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_LEFT |
BT_AUDIO_LOCATION_FRONT_RIGHT)); BT_AUDIO_LOCATION_FRONT_RIGHT));
if (err != 0) { if (err != 0) {