tests: bsim: Bluetooth: Add bcast validation of bt_bap_ep_get_info
The broadcast sink and broadcast source will now use and verify the info returned by bt_bap_ep_get_info. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
6976ad82ea
commit
55bd06b03e
2 changed files with 68 additions and 0 deletions
|
@ -498,6 +498,40 @@ static void validate_stream_codec_cfg(const struct bt_bap_stream *stream)
|
||||||
|
|
||||||
static void started_cb(struct bt_bap_stream *stream)
|
static void started_cb(struct bt_bap_stream *stream)
|
||||||
{
|
{
|
||||||
|
struct bt_bap_ep_info info;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = bt_bap_ep_get_info(stream->ep, &info);
|
||||||
|
if (err != 0) {
|
||||||
|
FAIL("Failed to get EP info: %d\n", err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.state != BT_BAP_EP_STATE_STREAMING) {
|
||||||
|
FAIL("Unexpected EP state: %d\n", info.state);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.dir != BT_AUDIO_DIR_SINK) {
|
||||||
|
FAIL("Unexpected info.dir: %d\n", info.dir);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.can_send) {
|
||||||
|
FAIL("info.can_send is true\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!info.can_recv) {
|
||||||
|
FAIL("info.can_recv is false\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.paired_ep != NULL) {
|
||||||
|
FAIL("Unexpected info.paired_ep: %p\n", info.paired_ep);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
printk("Stream %p started\n", stream);
|
printk("Stream %p started\n", stream);
|
||||||
k_sem_give(&sem_started);
|
k_sem_give(&sem_started);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,40 @@ static K_SEM_DEFINE(sem_stopped, 0U, ARRAY_SIZE(broadcast_source_streams));
|
||||||
|
|
||||||
static void started_cb(struct bt_bap_stream *stream)
|
static void started_cb(struct bt_bap_stream *stream)
|
||||||
{
|
{
|
||||||
|
struct bt_bap_ep_info info;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = bt_bap_ep_get_info(stream->ep, &info);
|
||||||
|
if (err != 0) {
|
||||||
|
FAIL("Failed to get EP info: %d\n", err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.state != BT_BAP_EP_STATE_STREAMING) {
|
||||||
|
FAIL("Unexpected EP state: %d\n", info.state);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.dir != BT_AUDIO_DIR_SOURCE) {
|
||||||
|
FAIL("Unexpected info.dir: %d\n", info.dir);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!info.can_send) {
|
||||||
|
FAIL("info.can_send is false\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.can_recv) {
|
||||||
|
FAIL("info.can_recv is true\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.paired_ep != NULL) {
|
||||||
|
FAIL("Unexpected info.paired_ep: %p\n", info.paired_ep);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
printk("Stream %p started\n", stream);
|
printk("Stream %p started\n", stream);
|
||||||
k_sem_give(&sem_started);
|
k_sem_give(&sem_started);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue