1 /*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <zephyr/bluetooth/audio/cap.h>
8
9 #include "cap_commander.h"
10
11 /* List of fakes used by this unit tester */
12 #define FFF_FAKES_LIST(FAKE) \
13 FAKE(mock_cap_commander_discovery_complete_cb) \
14 FAKE(mock_cap_commander_volume_changed_cb) \
15 FAKE(mock_cap_commander_volume_mute_changed_cb) \
16 FAKE(mock_cap_commander_volume_offset_changed_cb) \
17 FAKE(mock_cap_commander_microphone_mute_changed_cb) \
18 FAKE(mock_cap_commander_microphone_gain_changed_cb) \
19 FAKE(mock_cap_commander_broadcast_reception_start_cb) \
20 FAKE(mock_cap_commander_broadcast_reception_stop_cb) \
21 FAKE(mock_cap_commander_distribute_broadcast_code_cb)
22
23 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_discovery_complete_cb, struct bt_conn *, int,
24 const struct bt_csip_set_coordinator_set_member *,
25 const struct bt_csip_set_coordinator_csis_inst *);
26
27 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_volume_changed_cb, struct bt_conn *, int);
28 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_volume_mute_changed_cb, struct bt_conn *, int);
29 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_volume_offset_changed_cb, struct bt_conn *, int);
30 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_microphone_mute_changed_cb, struct bt_conn *, int);
31 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_microphone_gain_changed_cb, struct bt_conn *, int);
32 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_broadcast_reception_start_cb, struct bt_conn *, int);
33 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_broadcast_reception_stop_cb, struct bt_conn *, int);
34 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_distribute_broadcast_code_cb, struct bt_conn *, int);
35
36 const struct bt_cap_commander_cb mock_cap_commander_cb = {
37 .discovery_complete = mock_cap_commander_discovery_complete_cb,
38 #if defined(CONFIG_BT_VCP_VOL_CTLR)
39 .volume_changed = mock_cap_commander_volume_changed_cb,
40 .volume_mute_changed = mock_cap_commander_volume_mute_changed_cb,
41 #if defined(CONFIG_BT_VCP_VOL_CTLR_VOCS)
42 .volume_offset_changed = mock_cap_commander_volume_offset_changed_cb,
43 #endif /* CONFIG_BT_VCP_VOL_CTLR */
44 #endif /* CONFIG_BT_VCP_VOL_CTLR */
45 #if defined(CONFIG_BT_MICP_MIC_CTLR)
46 .microphone_mute_changed = mock_cap_commander_microphone_mute_changed_cb,
47 #if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
48 .microphone_gain_changed = mock_cap_commander_microphone_gain_changed_cb,
49 #endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
50 #endif /* CONFIG_BT_MICP_MIC_CTLR */
51 #if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT)
52 .broadcast_reception_start = mock_cap_commander_broadcast_reception_start_cb,
53 .broadcast_reception_stop = mock_cap_commander_broadcast_reception_stop_cb,
54 .distribute_broadcast_code = mock_cap_commander_distribute_broadcast_code_cb,
55 #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */
56 };
57
mock_cap_commander_init(void)58 void mock_cap_commander_init(void)
59 {
60 FFF_FAKES_LIST(RESET_FAKE);
61 }
62
mock_cap_commander_cleanup(void)63 void mock_cap_commander_cleanup(void)
64 {
65 }
66