1 /*
2 * Copyright (c) 2023 Codecoup
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <zephyr/types.h>
8 #include <zephyr/bluetooth/audio/pacs.h>
9
10 #include "pacs.h"
11
12 /* List of fakes used by this unit tester */
13 #define PACS_FFF_FAKES_LIST(FAKE) FAKE(bt_pacs_cap_foreach)
14
15 static const struct bt_audio_codec_cap lc3_codec = BT_AUDIO_CODEC_CAP_LC3(
16 BT_AUDIO_CODEC_LC3_FREQ_ANY, BT_AUDIO_CODEC_LC3_DURATION_10,
17 BT_AUDIO_CODEC_LC3_CHAN_COUNT_SUPPORT(1), 40u, 120u, 1u,
18 (BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL | BT_AUDIO_CONTEXT_TYPE_MEDIA));
19
20 DEFINE_FAKE_VOID_FUNC(bt_pacs_cap_foreach, enum bt_audio_dir, bt_pacs_cap_foreach_func_t, void *);
21
pacs_cap_foreach_custom_fake(enum bt_audio_dir dir,bt_pacs_cap_foreach_func_t func,void * user_data)22 static void pacs_cap_foreach_custom_fake(enum bt_audio_dir dir, bt_pacs_cap_foreach_func_t func,
23 void *user_data)
24 {
25 static const struct bt_pacs_cap cap[] = {
26 {
27 &lc3_codec,
28 },
29 };
30
31 for (size_t i = 0; i < ARRAY_SIZE(cap); i++) {
32 if (func(&cap[i], user_data) == false) {
33 break;
34 }
35 }
36 }
37
mock_bt_pacs_init(void)38 void mock_bt_pacs_init(void)
39 {
40 PACS_FFF_FAKES_LIST(RESET_FAKE);
41 bt_pacs_cap_foreach_fake.custom_fake = pacs_cap_foreach_custom_fake;
42 }
43
mock_bt_pacs_cleanup(void)44 void mock_bt_pacs_cleanup(void)
45 {
46
47 }
48