1 /*
2  * Copyright 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * Generated mock file from original source file
19  *   Functions generated:10
20  *
21  *  mockcify.pl ver 0.2
22  */
23 
24 #include <cstdint>
25 #include <functional>
26 #include <map>
27 #include <string>
28 
29 extern std::map<std::string, int> mock_function_count_map;
30 
31 // Original included files, if any
32 // NOTE: Since this is a mock file with mock definitions some number of
33 //       include files may not be required.  The include-what-you-use
34 //       still applies, but crafting proper inclusion is out of scope
35 //       for this effort.  This compilation unit may compile as-is, or
36 //       may need attention to prune the inclusion set.
37 #include <base/bind.h>
38 #include <base/location.h>
39 #include <base/strings/stringprintf.h>
40 #include <cstdint>
41 #include <memory>
42 #include "device/include/interop.h"
43 #include "gd/module.h"
44 #include "hci/controller.h"
45 #include "main/shim/controller.h"
46 #include "main/shim/dumpsys.h"
47 #include "main/shim/link_policy.h"
48 #include "main/shim/stack.h"
49 #include "osi/include/log.h"
50 #include "stack/btm/btm_int_types.h"
51 #include "stack/include/btm_api.h"
52 #include "stack/include/btm_api_types.h"
53 #include "stack/include/btm_ble_api_types.h"
54 #include "stack/include/hci_error_code.h"
55 #include "stack/include/hcidefs.h"
56 
57 // Mocked compile conditionals, if any
58 #ifndef UNUSED_ATTR
59 #define UNUSED_ATTR
60 #endif
61 
62 namespace test {
63 namespace mock {
64 namespace main_shim_link_policy {
65 
66 // Shared state between mocked functions and tests
67 // Name: set_active_mode
68 // Params: tACL_CONN& p_acl
69 // Returns: tBTM_STATUS
70 struct set_active_mode {
71   std::function<tBTM_STATUS(tACL_CONN& p_acl)> body{
72       [](tACL_CONN& p_acl) { return 0; }};
operatorset_active_mode73   tBTM_STATUS operator()(tACL_CONN& p_acl) { return body(p_acl); };
74 };
75 extern struct set_active_mode set_active_mode;
76 // Name: set_hold_mode
77 // Params: tACL_CONN& p_acl, uint16_t max, uint16_t min
78 // Returns: tBTM_STATUS
79 struct set_hold_mode {
80   std::function<tBTM_STATUS(tACL_CONN& p_acl, uint16_t max, uint16_t min)> body{
81       [](tACL_CONN& p_acl, uint16_t max, uint16_t min) { return 0; }};
operatorset_hold_mode82   tBTM_STATUS operator()(tACL_CONN& p_acl, uint16_t max, uint16_t min) {
83     return body(p_acl, max, min);
84   };
85 };
86 extern struct set_hold_mode set_hold_mode;
87 // Name: set_sniff_mode
88 // Params: tACL_CONN& p_acl, uint16_t max_interval, uint16_t min_interval,
89 // uint16_t attempt, uint16_t timeout Returns: tBTM_STATUS
90 struct set_sniff_mode {
91   std::function<tBTM_STATUS(tACL_CONN& p_acl, uint16_t max_interval,
92                             uint16_t min_interval, uint16_t attempt,
93                             uint16_t timeout)>
94       body{[](tACL_CONN& p_acl, uint16_t max_interval, uint16_t min_interval,
95               uint16_t attempt, uint16_t timeout) { return 0; }};
operatorset_sniff_mode96   tBTM_STATUS operator()(tACL_CONN& p_acl, uint16_t max_interval,
97                          uint16_t min_interval, uint16_t attempt,
98                          uint16_t timeout) {
99     return body(p_acl, max_interval, min_interval, attempt, timeout);
100   };
101 };
102 extern struct set_sniff_mode set_sniff_mode;
103 // Name: controller_supports_link_policy_mode
104 // Params: const tBTM_PM_MODE& mode, bool interop_check
105 // Returns: bool
106 struct controller_supports_link_policy_mode {
107   std::function<bool(const tBTM_PM_MODE& mode, bool interop_check)> body{
108       [](const tBTM_PM_MODE& mode, bool interop_check) { return false; }};
operatorcontroller_supports_link_policy_mode109   bool operator()(const tBTM_PM_MODE& mode, bool interop_check) {
110     return body(mode, interop_check);
111   };
112 };
113 extern struct controller_supports_link_policy_mode
114     controller_supports_link_policy_mode;
115 // Name: bluetooth::shim::RegisterLinkPolicyClient
116 // Params: tBTM_PM_STATUS_CBACK* p_cb
117 // Returns: bool
118 struct RegisterLinkPolicyClient {
119   std::function<bool(tBTM_PM_STATUS_CBACK* p_cb)> body{
120       [](tBTM_PM_STATUS_CBACK* p_cb) { return false; }};
operatorRegisterLinkPolicyClient121   bool operator()(tBTM_PM_STATUS_CBACK* p_cb) { return body(p_cb); };
122 };
123 extern struct RegisterLinkPolicyClient RegisterLinkPolicyClient;
124 // Name: bluetooth::shim::UnregisterLinkPolicyClient
125 // Params: tBTM_PM_STATUS_CBACK* p_cb
126 // Returns: bool
127 struct UnregisterLinkPolicyClient {
128   std::function<bool(tBTM_PM_STATUS_CBACK* p_cb)> body{
129       [](tBTM_PM_STATUS_CBACK* p_cb) { return false; }};
operatorUnregisterLinkPolicyClient130   bool operator()(tBTM_PM_STATUS_CBACK* p_cb) { return body(p_cb); };
131 };
132 extern struct UnregisterLinkPolicyClient UnregisterLinkPolicyClient;
133 // Name: bluetooth::shim::BTM_SetPowerMode
134 // Params: uint16_t handle, const tBTM_PM_PWR_MD& new_mode
135 // Returns: tBTM_STATUS
136 struct BTM_SetPowerMode {
137   std::function<tBTM_STATUS(uint16_t handle, const tBTM_PM_PWR_MD& new_mode)>
138       body{[](uint16_t handle, const tBTM_PM_PWR_MD& new_mode) { return 0; }};
operatorBTM_SetPowerMode139   tBTM_STATUS operator()(uint16_t handle, const tBTM_PM_PWR_MD& new_mode) {
140     return body(handle, new_mode);
141   };
142 };
143 extern struct BTM_SetPowerMode BTM_SetPowerMode;
144 // Name: bluetooth::shim::btm_pm_on_mode_change
145 // Params: tHCI_STATUS status, uint16_t handle, tHCI_MODE hci_mode, uint16_t
146 // interval Returns: void
147 struct btm_pm_on_mode_change {
148   std::function<void(tHCI_STATUS status, uint16_t handle, tHCI_MODE hci_mode,
149                      uint16_t interval)>
150       body{[](tHCI_STATUS status, uint16_t handle, tHCI_MODE hci_mode,
151               uint16_t interval) {}};
operatorbtm_pm_on_mode_change152   void operator()(tHCI_STATUS status, uint16_t handle, tHCI_MODE hci_mode,
153                   uint16_t interval) {
154     body(status, handle, hci_mode, interval);
155   };
156 };
157 extern struct btm_pm_on_mode_change btm_pm_on_mode_change;
158 // Name: bluetooth::shim::BTM_SetSsrParams
159 // Params: uint16_t handle, uint16_t max_lat, uint16_t min_rmt_to, uint16_t
160 // min_loc_to Returns: tBTM_STATUS
161 struct BTM_SetSsrParams {
162   std::function<tBTM_STATUS(uint16_t handle, uint16_t max_lat,
163                             uint16_t min_rmt_to, uint16_t min_loc_to)>
164       body{[](uint16_t handle, uint16_t max_lat, uint16_t min_rmt_to,
165               uint16_t min_loc_to) { return 0; }};
operatorBTM_SetSsrParams166   tBTM_STATUS operator()(uint16_t handle, uint16_t max_lat, uint16_t min_rmt_to,
167                          uint16_t min_loc_to) {
168     return body(handle, max_lat, min_rmt_to, min_loc_to);
169   };
170 };
171 extern struct BTM_SetSsrParams BTM_SetSsrParams;
172 // Name: bluetooth::shim::btm_pm_on_sniff_subrating
173 // Params:  tHCI_STATUS status, uint16_t handle, uint16_t
174 // maximum_transmit_latency, UNUSED_ATTR uint16_t maximum_receive_latency,
175 // uint16_t minimum_remote_timeout, uint16_t minimum_local_timeout Returns: void
176 struct btm_pm_on_sniff_subrating {
177   std::function<void(
178       tHCI_STATUS status, uint16_t handle, uint16_t maximum_transmit_latency,
179       UNUSED_ATTR uint16_t maximum_receive_latency,
180       uint16_t minimum_remote_timeout, uint16_t minimum_local_timeout)>
181       body{[](tHCI_STATUS status, uint16_t handle,
182               uint16_t maximum_transmit_latency,
183               UNUSED_ATTR uint16_t maximum_receive_latency,
184               uint16_t minimum_remote_timeout,
185               uint16_t minimum_local_timeout) {}};
operatorbtm_pm_on_sniff_subrating186   void operator()(tHCI_STATUS status, uint16_t handle,
187                   uint16_t maximum_transmit_latency,
188                   UNUSED_ATTR uint16_t maximum_receive_latency,
189                   uint16_t minimum_remote_timeout,
190                   uint16_t minimum_local_timeout) {
191     body(status, handle, maximum_transmit_latency, maximum_receive_latency,
192          minimum_remote_timeout, minimum_local_timeout);
193   };
194 };
195 extern struct btm_pm_on_sniff_subrating btm_pm_on_sniff_subrating;
196 
197 }  // namespace main_shim_link_policy
198 }  // namespace mock
199 }  // namespace test
200 
201 // END mockcify generation
202