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 FAKE(mock_bap_stream_connected_cb) \
24 FAKE(mock_bap_stream_disconnected_cb)
25
26 struct bt_bap_stream_ops mock_bap_stream_ops;
27
28 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_configured_cb, struct bt_bap_stream *,
29 const struct bt_bap_qos_cfg_pref *);
30 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_qos_set_cb, struct bt_bap_stream *);
31 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_enabled_cb, struct bt_bap_stream *);
32 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_metadata_updated_cb, struct bt_bap_stream *);
33 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_disabled_cb, struct bt_bap_stream *);
34 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_released_cb, struct bt_bap_stream *);
35 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_started_cb, struct bt_bap_stream *);
36 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_stopped_cb, struct bt_bap_stream *, uint8_t);
37 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_recv_cb, struct bt_bap_stream *,
38 const struct bt_iso_recv_info *, struct net_buf *);
39 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_sent_cb, struct bt_bap_stream *);
40 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_connected_cb, struct bt_bap_stream *);
41 DEFINE_FAKE_VOID_FUNC(mock_bap_stream_disconnected_cb, struct bt_bap_stream *, uint8_t);
42
mock_bap_stream_init(void)43 void mock_bap_stream_init(void)
44 {
45 FFF_FAKES_LIST(RESET_FAKE);
46
47 #if defined(CONFIG_BT_BAP_UNICAST)
48 mock_bap_stream_ops.configured = mock_bap_stream_configured_cb;
49 mock_bap_stream_ops.qos_set = mock_bap_stream_qos_set_cb;
50 mock_bap_stream_ops.enabled = mock_bap_stream_enabled_cb;
51 mock_bap_stream_ops.metadata_updated = mock_bap_stream_metadata_updated_cb;
52 mock_bap_stream_ops.disabled = mock_bap_stream_disabled_cb;
53 mock_bap_stream_ops.released = mock_bap_stream_released_cb;
54 #endif /* CONFIG_BT_BAP_UNICAST */
55 mock_bap_stream_ops.started = mock_bap_stream_started_cb;
56 mock_bap_stream_ops.stopped = mock_bap_stream_stopped_cb;
57 #if defined(CONFIG_BT_AUDIO_RX)
58 mock_bap_stream_ops.recv = mock_bap_stream_recv_cb;
59 #endif /* CONFIG_BT_AUDIO_RX */
60 #if defined(CONFIG_BT_AUDIO_TX)
61 mock_bap_stream_ops.sent = mock_bap_stream_sent_cb;
62 #endif /* CONFIG_BT_AUDIO_TX */
63 mock_bap_stream_ops.connected = mock_bap_stream_connected_cb;
64 mock_bap_stream_ops.disconnected = mock_bap_stream_disconnected_cb;
65 }
66
mock_bap_stream_cleanup(void)67 void mock_bap_stream_cleanup(void)
68 {
69
70 }
71