1 /*
2  * Copyright (c) 2023 Codecoup
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/bluetooth/audio/bap.h>
8 
9 #include "bap_stream.h"
10 
11 /* List of fakes used by this unit tester */
12 #define FFF_FAKES_LIST(FAKE)                                                                       \
13 	FAKE(mock_bap_stream_configured_cb)                                                        \
14 	FAKE(mock_bap_stream_qos_set_cb)                                                           \
15 	FAKE(mock_bap_stream_enabled_cb)                                                           \
16 	FAKE(mock_bap_stream_metadata_updated_cb)                                                  \
17 	FAKE(mock_bap_stream_disabled_cb)                                                          \
18 	FAKE(mock_bap_stream_released_cb)                                                          \
19 	FAKE(mock_bap_stream_started_cb)                                                           \
20 	FAKE(mock_bap_stream_stopped_cb)                                                           \
21 	FAKE(mock_bap_stream_recv_cb)                                                              \
22 	FAKE(mock_bap_stream_sent_cb)                                                              \
23 
24 struct bt_bap_stream_ops mock_bap_stream_ops;
25 
26 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_configured_cb, struct bt_bap_stream *,
27 		      const struct bt_audio_codec_qos_pref *);
28 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_qos_set_cb, struct bt_bap_stream *);
29 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_enabled_cb, struct bt_bap_stream *);
30 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_metadata_updated_cb, struct bt_bap_stream *);
31 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_disabled_cb, struct bt_bap_stream *);
32 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_released_cb, struct bt_bap_stream *);
33 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_started_cb, struct bt_bap_stream *);
34 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_stopped_cb, struct bt_bap_stream *, uint8_t);
35 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_recv_cb, struct bt_bap_stream *,
36 		      const struct bt_iso_recv_info *, struct net_buf *);
37 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_sent_cb, struct bt_bap_stream *);
38 
mock_bap_stream_init(void)39 void mock_bap_stream_init(void)
40 {
41 	FFF_FAKES_LIST(RESET_FAKE);
42 
43 #if defined(CONFIG_BT_BAP_UNICAST)
44 	mock_bap_stream_ops.configured = mock_bap_stream_configured_cb;
45 	mock_bap_stream_ops.qos_set = mock_bap_stream_qos_set_cb;
46 	mock_bap_stream_ops.enabled = mock_bap_stream_enabled_cb;
47 	mock_bap_stream_ops.metadata_updated = mock_bap_stream_metadata_updated_cb;
48 	mock_bap_stream_ops.disabled = mock_bap_stream_disabled_cb;
49 	mock_bap_stream_ops.released = mock_bap_stream_released_cb;
50 #endif /* CONFIG_BT_BAP_UNICAST */
51 	mock_bap_stream_ops.started = mock_bap_stream_started_cb;
52 	mock_bap_stream_ops.stopped = mock_bap_stream_stopped_cb;
53 #if defined(CONFIG_BT_AUDIO_RX)
54 	mock_bap_stream_ops.recv = mock_bap_stream_recv_cb;
55 #endif /* CONFIG_BT_AUDIO_RX */
56 #if defined(CONFIG_BT_AUDIO_TX)
57 	mock_bap_stream_ops.sent = mock_bap_stream_sent_cb;
58 #endif /* CONFIG_BT_AUDIO_TX */
59 }
60 
mock_bap_stream_cleanup(void)61 void mock_bap_stream_cleanup(void)
62 {
63 
64 }
65