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 
21 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_discovery_complete_cb, struct bt_conn *, int,
22 		      const struct bt_csip_set_coordinator_set_member *,
23 		      const struct bt_csip_set_coordinator_csis_inst *);
24 
25 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_volume_changed_cb, struct bt_conn *, int);
26 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_volume_mute_changed_cb, struct bt_conn *, int);
27 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_volume_offset_changed_cb, struct bt_conn *, int);
28 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_microphone_mute_changed_cb, struct bt_conn *, int);
29 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_microphone_gain_changed_cb, struct bt_conn *, int);
30 DEFINE_FAKE_VOID_FUNC(mock_cap_commander_broadcast_reception_start_cb, struct bt_conn *, int);
31 
32 const struct bt_cap_commander_cb mock_cap_commander_cb = {
33 	.discovery_complete = mock_cap_commander_discovery_complete_cb,
34 #if defined(CONFIG_BT_VCP_VOL_CTLR)
35 	.volume_changed = mock_cap_commander_volume_changed_cb,
36 	.volume_mute_changed = mock_cap_commander_volume_mute_changed_cb,
37 #if defined(CONFIG_BT_VCP_VOL_CTLR_VOCS)
38 	.volume_offset_changed = mock_cap_commander_volume_offset_changed_cb,
39 #endif /* CONFIG_BT_VCP_VOL_CTLR */
40 #endif /* CONFIG_BT_VCP_VOL_CTLR */
41 #if defined(CONFIG_BT_MICP_MIC_CTLR)
42 	.microphone_mute_changed = mock_cap_commander_microphone_mute_changed_cb,
43 #if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
44 	.microphone_gain_changed = mock_cap_commander_microphone_gain_changed_cb,
45 #endif /* CONFIG_BT_MICP_MIC_CTLR_AICS */
46 #endif /* CONFIG_BT_MICP_MIC_CTLR */
47 #if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT)
48 	.broadcast_reception_start = mock_cap_commander_broadcast_reception_start_cb,
49 #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */
50 };
51 
mock_cap_commander_init(void)52 void mock_cap_commander_init(void)
53 {
54 	FFF_FAKES_LIST(RESET_FAKE);
55 }
56 
mock_cap_commander_cleanup(void)57 void mock_cap_commander_cleanup(void)
58 {
59 }
60