zephyr/tests/bluetooth/audio/mocks/include/bap_stream.h
Emil Gydesen b857ef7f83 Bluetooth: BAP: Add ISO state callbacks
Add callbacks to the stream objects that reflects the
state of the isochronous channel. The connected callback
is called when the isochronous channel is connected, and
similarly the disconnected callback is called when it is
disconnected.

There is a special case for unicast, where if the ACL
disconnects first, then we won't get a ISO disconnect
callback. It should be assumed that the isochronous channel
is no longer valid when the BAP stream enters the idle state,
i.e. when the "released" callback is called.

The purpose of the new callbacks is to provide additional
information to the application. Especially the unicast client
can use this to determine when the stream_start function
can be called again, as there can only ever be 1 outstanding
CIS connection request at a time, but there can be multiple
GATT requests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-01-22 12:59:11 +01:00

34 lines
1.4 KiB
C

/*
* Copyright (c) 2023 Codecoup
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef MOCKS_BAP_STREAM_H_
#define MOCKS_BAP_STREAM_H_
#include <zephyr/fff.h>
#include <zephyr/bluetooth/audio/bap.h>
extern struct bt_bap_stream_ops mock_bap_stream_ops;
void mock_bap_stream_init(void);
void mock_bap_stream_cleanup(void);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_configured_cb, struct bt_bap_stream *,
const struct bt_audio_codec_qos_pref *);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_qos_set_cb, struct bt_bap_stream *);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_enabled_cb, struct bt_bap_stream *);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_metadata_updated_cb, struct bt_bap_stream *);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_disabled_cb, struct bt_bap_stream *);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_released_cb, struct bt_bap_stream *);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_started_cb, struct bt_bap_stream *);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_stopped_cb, struct bt_bap_stream *, uint8_t);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_recv_cb, struct bt_bap_stream *,
const struct bt_iso_recv_info *, struct net_buf *);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_sent_cb, struct bt_bap_stream *);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_connected_cb, struct bt_bap_stream *);
DECLARE_FAKE_VOID_FUNC(mock_bap_stream_disconnected_cb, struct bt_bap_stream *, uint8_t);
#endif /* MOCKS_BAP_STREAM_H_ */