1 /*
2 * Copyright 2020 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:77
20 */
21
22 #include <map>
23 #include <string>
24
25 extern std::map<std::string, int> mock_function_count_map;
26 #define UNUSED_ATTR
27
28 #include <stddef.h>
29 #include "types/raw_address.h"
30
31 #include "bt_common.h"
32 #include "bt_target.h"
33 #include "btu.h"
34 #include "hcidefs.h"
35 #include "hcimsgs.h"
36 #include "stack/include/acl_hci_link_interface.h"
37
38 namespace test {
39 namespace mock {
40 namespace hcic_hcicmds {
41
42 struct btsnd_hcic_change_conn_type {
43 uint16_t handle{0};
44 uint16_t packet_types{0};
45 } btsnd_hcic_change_conn_type;
46
47 } // namespace hcic_hcicmds
48 } // namespace mock
49 } // namespace test
50
51 namespace mock = test::mock::hcic_hcicmds;
52
53 // Global by definition
btsnd_hcic_accept_conn(const RawAddress & dest,uint8_t role)54 void btsnd_hcic_accept_conn(const RawAddress& dest, uint8_t role) {
55 mock_function_count_map[__func__]++;
56 }
btsnd_hcic_accept_esco_conn(const RawAddress & bd_addr,uint32_t transmit_bandwidth,uint32_t receive_bandwidth,uint16_t max_latency,uint16_t content_fmt,uint8_t retrans_effort,uint16_t packet_types)57 void btsnd_hcic_accept_esco_conn(const RawAddress& bd_addr,
58 uint32_t transmit_bandwidth,
59 uint32_t receive_bandwidth,
60 uint16_t max_latency, uint16_t content_fmt,
61 uint8_t retrans_effort,
62 uint16_t packet_types) {
63 mock_function_count_map[__func__]++;
64 }
btsnd_hcic_add_SCO_conn(uint16_t handle,uint16_t packet_types)65 void btsnd_hcic_add_SCO_conn(uint16_t handle, uint16_t packet_types) {
66 mock_function_count_map[__func__]++;
67 }
btsnd_hcic_auth_request(uint16_t handle)68 void btsnd_hcic_auth_request(uint16_t handle) {
69 mock_function_count_map[__func__]++;
70 }
btsnd_hcic_change_conn_type(uint16_t handle,uint16_t packet_types)71 void btsnd_hcic_change_conn_type(uint16_t handle, uint16_t packet_types) {
72 mock::btsnd_hcic_change_conn_type.handle = handle;
73 mock::btsnd_hcic_change_conn_type.packet_types = packet_types;
74 mock_function_count_map[__func__]++;
75 }
btsnd_hcic_change_name(BD_NAME name)76 void btsnd_hcic_change_name(BD_NAME name) {
77 mock_function_count_map[__func__]++;
78 }
btsnd_hcic_create_conn(const RawAddress & dest,uint16_t packet_types,uint8_t page_scan_rep_mode,uint8_t page_scan_mode,uint16_t clock_offset,uint8_t allow_switch)79 void btsnd_hcic_create_conn(const RawAddress& dest, uint16_t packet_types,
80 uint8_t page_scan_rep_mode, uint8_t page_scan_mode,
81 uint16_t clock_offset, uint8_t allow_switch) {
82 mock_function_count_map[__func__]++;
83 }
btsnd_hcic_create_conn_cancel(const RawAddress & dest)84 void btsnd_hcic_create_conn_cancel(const RawAddress& dest) {
85 mock_function_count_map[__func__]++;
86 }
btsnd_hcic_delete_stored_key(const RawAddress & bd_addr,bool delete_all_flag)87 void btsnd_hcic_delete_stored_key(const RawAddress& bd_addr,
88 bool delete_all_flag) {
89 mock_function_count_map[__func__]++;
90 }
btsnd_hcic_disconnect(uint16_t handle,uint8_t reason)91 static void btsnd_hcic_disconnect(uint16_t handle, uint8_t reason) {
92 mock_function_count_map[__func__]++;
93 }
btsnd_hcic_enable_test_mode(void)94 void btsnd_hcic_enable_test_mode(void) { mock_function_count_map[__func__]++; }
btsnd_hcic_enhanced_accept_synchronous_connection(const RawAddress & bd_addr,enh_esco_params_t * p_params)95 void btsnd_hcic_enhanced_accept_synchronous_connection(
96 const RawAddress& bd_addr, enh_esco_params_t* p_params) {
97 mock_function_count_map[__func__]++;
98 }
btsnd_hcic_enhanced_flush(uint16_t handle,uint8_t packet_type)99 void btsnd_hcic_enhanced_flush(uint16_t handle, uint8_t packet_type) {
100 mock_function_count_map[__func__]++;
101 }
btsnd_hcic_enhanced_set_up_synchronous_connection(uint16_t conn_handle,enh_esco_params_t * p_params)102 void btsnd_hcic_enhanced_set_up_synchronous_connection(
103 uint16_t conn_handle, enh_esco_params_t* p_params) {
104 mock_function_count_map[__func__]++;
105 }
btsnd_hcic_exit_park_mode(uint16_t handle)106 void btsnd_hcic_exit_park_mode(uint16_t handle) {
107 mock_function_count_map[__func__]++;
108 }
btsnd_hcic_exit_per_inq(void)109 void btsnd_hcic_exit_per_inq(void) { mock_function_count_map[__func__]++; }
btsnd_hcic_exit_sniff_mode(uint16_t handle)110 void btsnd_hcic_exit_sniff_mode(uint16_t handle) {
111 mock_function_count_map[__func__]++;
112 }
btsnd_hcic_get_link_quality(uint16_t handle)113 void btsnd_hcic_get_link_quality(uint16_t handle) {
114 mock_function_count_map[__func__]++;
115 }
btsnd_hcic_hold_mode(uint16_t handle,uint16_t max_hold_period,uint16_t min_hold_period)116 void btsnd_hcic_hold_mode(uint16_t handle, uint16_t max_hold_period,
117 uint16_t min_hold_period) {
118 mock_function_count_map[__func__]++;
119 }
btsnd_hcic_host_num_xmitted_pkts(uint8_t num_handles,uint16_t * handle,uint16_t * num_pkts)120 void btsnd_hcic_host_num_xmitted_pkts(uint8_t num_handles, uint16_t* handle,
121 uint16_t* num_pkts) {
122 mock_function_count_map[__func__]++;
123 }
btsnd_hcic_inq_cancel(void)124 void btsnd_hcic_inq_cancel(void) { mock_function_count_map[__func__]++; }
btsnd_hcic_inquiry(const LAP inq_lap,uint8_t duration,uint8_t response_cnt)125 void btsnd_hcic_inquiry(const LAP inq_lap, uint8_t duration,
126 uint8_t response_cnt) {
127 mock_function_count_map[__func__]++;
128 }
btsnd_hcic_io_cap_req_neg_reply(const RawAddress & bd_addr,uint8_t err_code)129 void btsnd_hcic_io_cap_req_neg_reply(const RawAddress& bd_addr,
130 uint8_t err_code) {
131 mock_function_count_map[__func__]++;
132 }
btsnd_hcic_io_cap_req_reply(const RawAddress & bd_addr,uint8_t capability,uint8_t oob_present,uint8_t auth_req)133 void btsnd_hcic_io_cap_req_reply(const RawAddress& bd_addr, uint8_t capability,
134 uint8_t oob_present, uint8_t auth_req) {
135 mock_function_count_map[__func__]++;
136 }
btsnd_hcic_link_key_neg_reply(const RawAddress & bd_addr)137 void btsnd_hcic_link_key_neg_reply(const RawAddress& bd_addr) {
138 mock_function_count_map[__func__]++;
139 }
btsnd_hcic_link_key_req_reply(const RawAddress & bd_addr,const LinkKey & link_key)140 void btsnd_hcic_link_key_req_reply(const RawAddress& bd_addr,
141 const LinkKey& link_key) {
142 mock_function_count_map[__func__]++;
143 }
btsnd_hcic_park_mode(uint16_t handle,uint16_t beacon_max_interval,uint16_t beacon_min_interval)144 void btsnd_hcic_park_mode(uint16_t handle, uint16_t beacon_max_interval,
145 uint16_t beacon_min_interval) {
146 mock_function_count_map[__func__]++;
147 }
btsnd_hcic_per_inq_mode(uint16_t max_period,uint16_t min_period,const LAP inq_lap,uint8_t duration,uint8_t response_cnt)148 void btsnd_hcic_per_inq_mode(uint16_t max_period, uint16_t min_period,
149 const LAP inq_lap, uint8_t duration,
150 uint8_t response_cnt) {
151 mock_function_count_map[__func__]++;
152 }
btsnd_hcic_pin_code_neg_reply(const RawAddress & bd_addr)153 void btsnd_hcic_pin_code_neg_reply(const RawAddress& bd_addr) {
154 mock_function_count_map[__func__]++;
155 }
btsnd_hcic_pin_code_req_reply(const RawAddress & bd_addr,uint8_t pin_code_len,PIN_CODE pin_code)156 void btsnd_hcic_pin_code_req_reply(const RawAddress& bd_addr,
157 uint8_t pin_code_len, PIN_CODE pin_code) {
158 mock_function_count_map[__func__]++;
159 }
btsnd_hcic_qos_setup(uint16_t handle,uint8_t flags,uint8_t service_type,uint32_t token_rate,uint32_t peak,uint32_t latency,uint32_t delay_var)160 void btsnd_hcic_qos_setup(uint16_t handle, uint8_t flags, uint8_t service_type,
161 uint32_t token_rate, uint32_t peak, uint32_t latency,
162 uint32_t delay_var) {
163 mock_function_count_map[__func__]++;
164 }
btsnd_hcic_read_automatic_flush_timeout(uint16_t handle)165 void btsnd_hcic_read_automatic_flush_timeout(uint16_t handle) {
166 mock_function_count_map[__func__]++;
167 }
btsnd_hcic_read_encryption_key_size(uint16_t handle,ReadEncKeySizeCb cb)168 void btsnd_hcic_read_encryption_key_size(uint16_t handle, ReadEncKeySizeCb cb) {
169 mock_function_count_map[__func__]++;
170 }
btsnd_hcic_read_failed_contact_counter(uint16_t handle)171 void btsnd_hcic_read_failed_contact_counter(uint16_t handle) {
172 mock_function_count_map[__func__]++;
173 }
btsnd_hcic_read_inq_tx_power(void)174 void btsnd_hcic_read_inq_tx_power(void) { mock_function_count_map[__func__]++; }
btsnd_hcic_read_lmp_handle(uint16_t handle)175 void btsnd_hcic_read_lmp_handle(uint16_t handle) {
176 mock_function_count_map[__func__]++;
177 }
btsnd_hcic_read_local_oob_data(void)178 void btsnd_hcic_read_local_oob_data(void) {
179 mock_function_count_map[__func__]++;
180 }
btsnd_hcic_read_name(void)181 void btsnd_hcic_read_name(void) { mock_function_count_map[__func__]++; }
btsnd_hcic_read_rmt_clk_offset(uint16_t handle)182 void btsnd_hcic_read_rmt_clk_offset(uint16_t handle) {
183 mock_function_count_map[__func__]++;
184 }
btsnd_hcic_read_rssi(uint16_t handle)185 void btsnd_hcic_read_rssi(uint16_t handle) {
186 mock_function_count_map[__func__]++;
187 }
btsnd_hcic_read_tx_power(uint16_t handle,uint8_t type)188 void btsnd_hcic_read_tx_power(uint16_t handle, uint8_t type) {
189 mock_function_count_map[__func__]++;
190 }
btsnd_hcic_reject_conn(const RawAddress & dest,uint8_t reason)191 void btsnd_hcic_reject_conn(const RawAddress& dest, uint8_t reason) {
192 mock_function_count_map[__func__]++;
193 }
btsnd_hcic_reject_esco_conn(const RawAddress & bd_addr,uint8_t reason)194 void btsnd_hcic_reject_esco_conn(const RawAddress& bd_addr, uint8_t reason) {
195 mock_function_count_map[__func__]++;
196 }
btsnd_hcic_rem_oob_neg_reply(const RawAddress & bd_addr)197 void btsnd_hcic_rem_oob_neg_reply(const RawAddress& bd_addr) {
198 mock_function_count_map[__func__]++;
199 }
btsnd_hcic_rem_oob_reply(const RawAddress & bd_addr,const Octet16 & c,const Octet16 & r)200 void btsnd_hcic_rem_oob_reply(const RawAddress& bd_addr, const Octet16& c,
201 const Octet16& r) {
202 mock_function_count_map[__func__]++;
203 }
btsnd_hcic_rmt_ext_features(uint16_t handle,uint8_t page_num)204 void btsnd_hcic_rmt_ext_features(uint16_t handle, uint8_t page_num) {
205 mock_function_count_map[__func__]++;
206 }
btsnd_hcic_rmt_features_req(uint16_t handle)207 void btsnd_hcic_rmt_features_req(uint16_t handle) {
208 mock_function_count_map[__func__]++;
209 }
btsnd_hcic_rmt_name_req(const RawAddress & bd_addr,uint8_t page_scan_rep_mode,uint8_t page_scan_mode,uint16_t clock_offset)210 void btsnd_hcic_rmt_name_req(const RawAddress& bd_addr,
211 uint8_t page_scan_rep_mode, uint8_t page_scan_mode,
212 uint16_t clock_offset) {
213 mock_function_count_map[__func__]++;
214 }
btsnd_hcic_rmt_name_req_cancel(const RawAddress & bd_addr)215 void btsnd_hcic_rmt_name_req_cancel(const RawAddress& bd_addr) {
216 mock_function_count_map[__func__]++;
217 }
btsnd_hcic_rmt_ver_req(uint16_t handle)218 void btsnd_hcic_rmt_ver_req(uint16_t handle) {
219 mock_function_count_map[__func__]++;
220 }
btsnd_hcic_send_keypress_notif(const RawAddress & bd_addr,uint8_t notif)221 void btsnd_hcic_send_keypress_notif(const RawAddress& bd_addr, uint8_t notif) {
222 mock_function_count_map[__func__]++;
223 }
btsnd_hcic_set_conn_encrypt(uint16_t handle,bool enable)224 void btsnd_hcic_set_conn_encrypt(uint16_t handle, bool enable) {
225 mock_function_count_map[__func__]++;
226 }
btsnd_hcic_set_event_filter(uint8_t filt_type,uint8_t filt_cond_type,uint8_t * filt_cond,uint8_t filt_cond_len)227 void btsnd_hcic_set_event_filter(uint8_t filt_type, uint8_t filt_cond_type,
228 uint8_t* filt_cond, uint8_t filt_cond_len) {
229 mock_function_count_map[__func__]++;
230 }
btsnd_hcic_setup_esco_conn(uint16_t handle,uint32_t transmit_bandwidth,uint32_t receive_bandwidth,uint16_t max_latency,uint16_t voice,uint8_t retrans_effort,uint16_t packet_types)231 void btsnd_hcic_setup_esco_conn(uint16_t handle, uint32_t transmit_bandwidth,
232 uint32_t receive_bandwidth,
233 uint16_t max_latency, uint16_t voice,
234 uint8_t retrans_effort, uint16_t packet_types) {
235 mock_function_count_map[__func__]++;
236 }
btsnd_hcic_sniff_mode(uint16_t handle,uint16_t max_sniff_period,uint16_t min_sniff_period,uint16_t sniff_attempt,uint16_t sniff_timeout)237 void btsnd_hcic_sniff_mode(uint16_t handle, uint16_t max_sniff_period,
238 uint16_t min_sniff_period, uint16_t sniff_attempt,
239 uint16_t sniff_timeout) {
240 mock_function_count_map[__func__]++;
241 }
btsnd_hcic_sniff_sub_rate(uint16_t handle,uint16_t max_lat,uint16_t min_remote_lat,uint16_t min_local_lat)242 void btsnd_hcic_sniff_sub_rate(uint16_t handle, uint16_t max_lat,
243 uint16_t min_remote_lat,
244 uint16_t min_local_lat) {
245 mock_function_count_map[__func__]++;
246 }
btsnd_hcic_switch_role(const RawAddress & bd_addr,uint8_t role)247 void btsnd_hcic_switch_role(const RawAddress& bd_addr, uint8_t role) {
248 mock_function_count_map[__func__]++;
249 }
btsnd_hcic_user_conf_reply(const RawAddress & bd_addr,bool is_yes)250 void btsnd_hcic_user_conf_reply(const RawAddress& bd_addr, bool is_yes) {
251 mock_function_count_map[__func__]++;
252 }
btsnd_hcic_user_passkey_neg_reply(const RawAddress & bd_addr)253 void btsnd_hcic_user_passkey_neg_reply(const RawAddress& bd_addr) {
254 mock_function_count_map[__func__]++;
255 }
btsnd_hcic_user_passkey_reply(const RawAddress & bd_addr,uint32_t value)256 void btsnd_hcic_user_passkey_reply(const RawAddress& bd_addr, uint32_t value) {
257 mock_function_count_map[__func__]++;
258 }
btsnd_hcic_vendor_spec_cmd(void * buffer,uint16_t opcode,uint8_t len,uint8_t * p_data,void * p_cmd_cplt_cback)259 void btsnd_hcic_vendor_spec_cmd(void* buffer, uint16_t opcode, uint8_t len,
260 uint8_t* p_data, void* p_cmd_cplt_cback) {
261 mock_function_count_map[__func__]++;
262 }
btsnd_hcic_write_auth_enable(uint8_t flag)263 void btsnd_hcic_write_auth_enable(uint8_t flag) {
264 mock_function_count_map[__func__]++;
265 }
btsnd_hcic_write_auto_flush_tout(uint16_t handle,uint16_t tout)266 void btsnd_hcic_write_auto_flush_tout(uint16_t handle, uint16_t tout) {
267 mock_function_count_map[__func__]++;
268 }
btsnd_hcic_write_cur_iac_lap(uint8_t num_cur_iac,LAP * const iac_lap)269 void btsnd_hcic_write_cur_iac_lap(uint8_t num_cur_iac, LAP* const iac_lap) {
270 mock_function_count_map[__func__]++;
271 }
btsnd_hcic_write_def_policy_set(uint16_t settings)272 void btsnd_hcic_write_def_policy_set(uint16_t settings) {
273 mock_function_count_map[__func__]++;
274 }
btsnd_hcic_write_dev_class(DEV_CLASS dev_class)275 void btsnd_hcic_write_dev_class(DEV_CLASS dev_class) {
276 mock_function_count_map[__func__]++;
277 }
btsnd_hcic_write_ext_inquiry_response(void * buffer,uint8_t fec_req)278 void btsnd_hcic_write_ext_inquiry_response(void* buffer, uint8_t fec_req) {
279 mock_function_count_map[__func__]++;
280 }
btsnd_hcic_write_inqscan_cfg(uint16_t interval,uint16_t window)281 void btsnd_hcic_write_inqscan_cfg(uint16_t interval, uint16_t window) {
282 mock_function_count_map[__func__]++;
283 }
btsnd_hcic_write_inqscan_type(uint8_t type)284 void btsnd_hcic_write_inqscan_type(uint8_t type) {
285 mock_function_count_map[__func__]++;
286 }
btsnd_hcic_write_inquiry_mode(uint8_t mode)287 void btsnd_hcic_write_inquiry_mode(uint8_t mode) {
288 mock_function_count_map[__func__]++;
289 }
btsnd_hcic_write_link_super_tout(uint8_t local_controller_id,uint16_t handle,uint16_t timeout)290 void btsnd_hcic_write_link_super_tout(uint8_t local_controller_id,
291 uint16_t handle, uint16_t timeout) {
292 mock_function_count_map[__func__]++;
293 }
btsnd_hcic_write_page_tout(uint16_t timeout)294 void btsnd_hcic_write_page_tout(uint16_t timeout) {
295 mock_function_count_map[__func__]++;
296 }
btsnd_hcic_write_pagescan_cfg(uint16_t interval,uint16_t window)297 void btsnd_hcic_write_pagescan_cfg(uint16_t interval, uint16_t window) {
298 mock_function_count_map[__func__]++;
299 }
btsnd_hcic_write_pagescan_type(uint8_t type)300 void btsnd_hcic_write_pagescan_type(uint8_t type) {
301 mock_function_count_map[__func__]++;
302 }
btsnd_hcic_write_pin_type(uint8_t type)303 void btsnd_hcic_write_pin_type(uint8_t type) {
304 mock_function_count_map[__func__]++;
305 }
btsnd_hcic_write_policy_set(uint16_t handle,uint16_t settings)306 void btsnd_hcic_write_policy_set(uint16_t handle, uint16_t settings) {
307 mock_function_count_map[__func__]++;
308 }
btsnd_hcic_write_scan_enable(uint8_t flag)309 void btsnd_hcic_write_scan_enable(uint8_t flag) {
310 mock_function_count_map[__func__]++;
311 }
btsnd_hcic_write_voice_settings(uint16_t flags)312 void btsnd_hcic_write_voice_settings(uint16_t flags) {
313 mock_function_count_map[__func__]++;
314 }
315
316 bluetooth::legacy::hci::Interface interface_ = {
317 .Disconnect = btsnd_hcic_disconnect,
318 .StartRoleSwitch = btsnd_hcic_switch_role,
319 .ChangeConnectionPacketType = btsnd_hcic_change_conn_type,
320 };
321
322 const bluetooth::legacy::hci::Interface&
GetInterface()323 bluetooth::legacy::hci::GetInterface() {
324 return interface_;
325 }
326