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:22 20 * 21 * mockcify.pl ver 0.2 22 */ 23 24 #pragma once 25 26 #include <cstdint> 27 #include <functional> 28 29 // Original included files, if any 30 #include "stack/l2cap/l2c_int.h" 31 #include "types/ble_address_with_type.h" 32 #include "types/hci_role.h" 33 #include "types/raw_address.h" 34 35 // Mocked compile conditionals, if any 36 namespace test { 37 namespace mock { 38 namespace stack_l2cap_ble { 39 40 // Shared state between mocked functions and tests 41 // Name: L2CA_UpdateBleConnParams 42 // Params: const RawAddress& rem_bda, uint16_t min_int, uint16_t max_int, 43 // uint16_t latency, uint16_t timeout, uint16_t min_ce_len, uint16_t max_ce_len 44 // Returns: bool 45 struct L2CA_UpdateBleConnParams { 46 std::function<bool(const RawAddress& rem_bda, uint16_t min_int, uint16_t max_int, 47 uint16_t latency, uint16_t timeout, uint16_t min_ce_len, uint16_t max_ce_len)> 48 body{[](const RawAddress& /* rem_bda */, uint16_t /* min_int */, uint16_t /* max_int */, 49 uint16_t /* latency */, uint16_t /* timeout */, uint16_t /* min_ce_len */, 50 uint16_t /* max_ce_len */) { return false; }}; operatorL2CA_UpdateBleConnParams51 bool operator()(const RawAddress& rem_bda, uint16_t min_int, uint16_t max_int, uint16_t latency, 52 uint16_t timeout, uint16_t min_ce_len, uint16_t max_ce_len) { 53 return body(rem_bda, min_int, max_int, latency, timeout, min_ce_len, max_ce_len); 54 } 55 }; 56 extern struct L2CA_UpdateBleConnParams L2CA_UpdateBleConnParams; 57 // Name: L2CA_LockBleConnParamsForServiceDiscovery 58 // Params: const RawAddress& rem_bda, bool enable 59 // Returns: void 60 struct L2CA_LockBleConnParamsForServiceDiscovery { 61 std::function<void(const RawAddress& rem_bda, bool enable)> body{ 62 [](const RawAddress& /* rem_bda */, bool /* enable */) { return false; }}; operatorL2CA_LockBleConnParamsForServiceDiscovery63 void operator()(const RawAddress& rem_bda, bool enable) { return body(rem_bda, enable); } 64 }; 65 extern struct L2CA_LockBleConnParamsForServiceDiscovery L2CA_LockBleConnParamsForServiceDiscovery; 66 // Name: L2CA_LockBleConnParamsForProfileConnection 67 // Params: const RawAddress& rem_bda, bool enable 68 // Returns: void 69 struct L2CA_LockBleConnParamsForProfileConnection { 70 std::function<void(const RawAddress& rem_bda, bool enable)> body{ 71 [](const RawAddress& /* rem_bda */, bool /* enable */) { return false; }}; operatorL2CA_LockBleConnParamsForProfileConnection72 void operator()(const RawAddress& rem_bda, bool enable) { return body(rem_bda, enable); } 73 }; 74 extern struct L2CA_LockBleConnParamsForProfileConnection L2CA_LockBleConnParamsForProfileConnection; 75 struct L2CA_ConsolidateParams { 76 std::function<void(const RawAddress& identity_addr, const RawAddress& rpa)> body{ 77 [](const RawAddress& /* identity_addr */, const RawAddress& /* rpa */) { return false; }}; operatorL2CA_ConsolidateParams78 void operator()(const RawAddress& identity_addr, const RawAddress& rpa) { 79 body(identity_addr, rpa); 80 } 81 }; 82 extern struct L2CA_ConsolidateParams L2CA_ConsolidateParams; 83 // Name: L2CA_GetBleConnRole 84 // Params: const RawAddress& bd_addr 85 // Returns: hci_role_t 86 struct L2CA_GetBleConnRole { 87 std::function<hci_role_t(const RawAddress& bd_addr)> body{ 88 [](const RawAddress& /* bd_addr */) { return HCI_ROLE_CENTRAL; }}; operatorL2CA_GetBleConnRole89 hci_role_t operator()(const RawAddress& bd_addr) { return body(bd_addr); } 90 }; 91 extern struct L2CA_GetBleConnRole L2CA_GetBleConnRole; 92 // Name: L2CA_GetBleConnInterval 93 // Params: const RawAddress& bd_addr 94 // Returns: uint16_t 95 struct L2CA_GetBleConnInterval { 96 std::function<uint16_t(const RawAddress& bd_addr)> body{ 97 [](const RawAddress& /* bd_addr */) { return 24; }}; operatorL2CA_GetBleConnInterval98 uint16_t operator()(const RawAddress& bd_addr) { return body(bd_addr); } 99 }; 100 extern struct L2CA_GetBleConnInterval L2CA_GetBleConnInterval; 101 // Name: l2cble_notify_le_connection 102 // Params: const RawAddress& bda 103 // Returns: void 104 struct l2cble_notify_le_connection { 105 std::function<void(const RawAddress& bda)> body{[](const RawAddress& /* bda */) {}}; operatorl2cble_notify_le_connection106 void operator()(const RawAddress& bda) { body(bda); } 107 }; 108 extern struct l2cble_notify_le_connection l2cble_notify_le_connection; 109 // Name: l2cble_conn_comp 110 // Params: uint16_t handle, uint8_t role, const RawAddress& bda, tBLE_ADDR_TYPE 111 // type, uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout 112 // Returns: bool 113 struct l2cble_conn_comp { 114 std::function<bool(uint16_t handle, uint8_t role, const RawAddress& bda, tBLE_ADDR_TYPE type, 115 uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout)> 116 body{[](uint16_t /* handle */, uint8_t /* role */, const RawAddress& /* bda */, 117 tBLE_ADDR_TYPE /* type */, uint16_t /* conn_interval */, 118 uint16_t /* conn_latency */, uint16_t /* conn_timeout */) { return false; }}; operatorl2cble_conn_comp119 bool operator()(uint16_t handle, uint8_t role, const RawAddress& bda, tBLE_ADDR_TYPE type, 120 uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout) { 121 return body(handle, role, bda, type, conn_interval, conn_latency, conn_timeout); 122 } 123 }; 124 extern struct l2cble_conn_comp l2cble_conn_comp; 125 // Name: l2cble_process_conn_update_evt 126 // Params: uint16_t handle, uint8_t status, uint16_t interval, uint16_t latency, 127 // uint16_t timeout Returns: void 128 struct l2cble_process_conn_update_evt { 129 std::function<void(uint16_t handle, uint8_t status, uint16_t interval, uint16_t latency, 130 uint16_t timeout)> 131 body{[](uint16_t /* handle */, uint8_t /* status */, uint16_t /* interval */, 132 uint16_t /* latency */, uint16_t /* timeout */) {}}; operatorl2cble_process_conn_update_evt133 void operator()(uint16_t handle, uint8_t status, uint16_t interval, uint16_t latency, 134 uint16_t timeout) { 135 body(handle, status, interval, latency, timeout); 136 } 137 }; 138 extern struct l2cble_process_conn_update_evt l2cble_process_conn_update_evt; 139 // Name: l2cble_process_sig_cmd 140 // Params: tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len 141 // Returns: void 142 struct l2cble_process_sig_cmd { 143 std::function<void(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len)> body{ 144 [](tL2C_LCB* /* p_lcb */, uint8_t* /* p */, uint16_t /* pkt_len */) {}}; operatorl2cble_process_sig_cmd145 void operator()(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) { body(p_lcb, p, pkt_len); } 146 }; 147 extern struct l2cble_process_sig_cmd l2cble_process_sig_cmd; 148 // Name: l2cble_create_conn 149 // Params: tL2C_LCB* p_lcb 150 // Returns: bool 151 struct l2cble_create_conn { 152 std::function<bool(tL2C_LCB* p_lcb)> body{[](tL2C_LCB* /* p_lcb */) { return false; }}; operatorl2cble_create_conn153 bool operator()(tL2C_LCB* p_lcb) { return body(p_lcb); } 154 }; 155 extern struct l2cble_create_conn l2cble_create_conn; 156 // Name: l2c_link_process_ble_num_bufs 157 // Params: uint16_t num_lm_ble_bufs 158 // Returns: void 159 struct l2c_link_process_ble_num_bufs { 160 std::function<void(uint16_t num_lm_ble_bufs)> body{[](uint16_t /* num_lm_ble_bufs */) {}}; operatorl2c_link_process_ble_num_bufs161 void operator()(uint16_t num_lm_ble_bufs) { body(num_lm_ble_bufs); } 162 }; 163 extern struct l2c_link_process_ble_num_bufs l2c_link_process_ble_num_bufs; 164 // Name: l2c_ble_link_adjust_allocation 165 // Params: void 166 // Returns: void 167 struct l2c_ble_link_adjust_allocation { 168 std::function<void(void)> body{[](void) {}}; operatorl2c_ble_link_adjust_allocation169 void operator()(void) { body(); } 170 }; 171 extern struct l2c_ble_link_adjust_allocation l2c_ble_link_adjust_allocation; 172 // Name: l2cble_process_rc_param_request_evt 173 // Params: uint16_t handle, uint16_t int_min, uint16_t int_max, uint16_t 174 // latency, uint16_t timeout Returns: void 175 struct l2cble_process_rc_param_request_evt { 176 std::function<void(uint16_t handle, uint16_t int_min, uint16_t int_max, uint16_t latency, 177 uint16_t timeout)> 178 body{[](uint16_t /* handle */, uint16_t /* int_min */, uint16_t /* int_max */, 179 uint16_t /* latency */, uint16_t /* timeout */) {}}; operatorl2cble_process_rc_param_request_evt180 void operator()(uint16_t handle, uint16_t int_min, uint16_t int_max, uint16_t latency, 181 uint16_t timeout) { 182 body(handle, int_min, int_max, latency, timeout); 183 } 184 }; 185 extern struct l2cble_process_rc_param_request_evt l2cble_process_rc_param_request_evt; 186 // Name: l2cble_update_data_length 187 // Params: tL2C_LCB* p_lcb 188 // Returns: void 189 struct l2cble_update_data_length { 190 std::function<void(tL2C_LCB* p_lcb)> body{[](tL2C_LCB* /* p_lcb */) {}}; operatorl2cble_update_data_length191 void operator()(tL2C_LCB* p_lcb) { body(p_lcb); } 192 }; 193 extern struct l2cble_update_data_length l2cble_update_data_length; 194 // Name: l2cble_process_data_length_change_event 195 // Params: uint16_t handle, uint16_t tx_data_len, uint16_t rx_data_len 196 // Returns: void 197 struct l2cble_process_data_length_change_event { 198 std::function<void(uint16_t handle, uint16_t tx_data_len, uint16_t rx_data_len)> body{ 199 [](uint16_t /* handle */, uint16_t /* tx_data_len */, uint16_t /* rx_data_len */) {}}; operatorl2cble_process_data_length_change_event200 void operator()(uint16_t handle, uint16_t tx_data_len, uint16_t rx_data_len) { 201 body(handle, tx_data_len, rx_data_len); 202 } 203 }; 204 extern struct l2cble_process_data_length_change_event l2cble_process_data_length_change_event; 205 // Name: l2cble_credit_based_conn_req 206 // Params: tL2C_CCB* p_ccb 207 // Returns: void 208 struct l2cble_credit_based_conn_req { 209 std::function<void(tL2C_CCB* p_ccb)> body{[](tL2C_CCB* /* p_ccb */) {}}; operatorl2cble_credit_based_conn_req210 void operator()(tL2C_CCB* p_ccb) { body(p_ccb); } 211 }; 212 extern struct l2cble_credit_based_conn_req l2cble_credit_based_conn_req; 213 // Name: l2cble_credit_based_conn_res 214 // Params: tL2C_CCB* p_ccb, uint16_t result 215 // Returns: void 216 struct l2cble_credit_based_conn_res { 217 std::function<void(tL2C_CCB* p_ccb, tL2CAP_LE_RESULT_CODE result)> body{ 218 [](tL2C_CCB* /* p_ccb */, tL2CAP_LE_RESULT_CODE /* result */) {}}; operatorl2cble_credit_based_conn_res219 void operator()(tL2C_CCB* p_ccb, tL2CAP_LE_RESULT_CODE result) { body(p_ccb, result); } 220 }; 221 extern struct l2cble_credit_based_conn_res l2cble_credit_based_conn_res; 222 // Name: l2cble_send_flow_control_credit 223 // Params: tL2C_CCB* p_ccb, uint16_t credit_value 224 // Returns: void 225 struct l2cble_send_flow_control_credit { 226 std::function<void(tL2C_CCB* p_ccb, uint16_t credit_value)> body{ 227 [](tL2C_CCB* /* p_ccb */, uint16_t /* credit_value */) {}}; operatorl2cble_send_flow_control_credit228 void operator()(tL2C_CCB* p_ccb, uint16_t credit_value) { body(p_ccb, credit_value); } 229 }; 230 extern struct l2cble_send_flow_control_credit l2cble_send_flow_control_credit; 231 // Name: l2cble_send_peer_disc_req 232 // Params: tL2C_CCB* p_ccb 233 // Returns: void 234 struct l2cble_send_peer_disc_req { 235 std::function<void(tL2C_CCB* p_ccb)> body{[](tL2C_CCB* /* p_ccb */) {}}; operatorl2cble_send_peer_disc_req236 void operator()(tL2C_CCB* p_ccb) { body(p_ccb); } 237 }; 238 extern struct l2cble_send_peer_disc_req l2cble_send_peer_disc_req; 239 // Name: l2ble_sec_access_req 240 // Params: const RawAddress& bd_addr, uint16_t psm, bool is_originator, 241 // tL2CAP_SEC_CBACK* p_callback, void* p_ref_data Returns: tL2CAP_LE_RESULT_CODE 242 struct l2ble_sec_access_req { 243 std::function<tL2CAP_LE_RESULT_CODE(const RawAddress& bd_addr, uint16_t psm, bool is_originator, 244 tBTM_SEC_CALLBACK* p_callback, void* p_ref_data)> 245 body{[](const RawAddress& /* bd_addr */, uint16_t /* psm */, bool /* is_originator */, 246 tBTM_SEC_CALLBACK* /* p_callback */, void* /* p_ref_data */) { 247 return tL2CAP_LE_RESULT_CODE::L2CAP_LE_RESULT_CONN_OK; 248 }}; operatorl2ble_sec_access_req249 tL2CAP_LE_RESULT_CODE operator()(const RawAddress& bd_addr, uint16_t psm, bool is_originator, 250 tBTM_SEC_CALLBACK* p_callback, void* p_ref_data) { 251 return body(bd_addr, psm, is_originator, p_callback, p_ref_data); 252 } 253 }; 254 extern struct l2ble_sec_access_req l2ble_sec_access_req; 255 // Name: L2CA_AdjustConnectionIntervals 256 // Params: uint16_t* min_interval, uint16_t* max_interval, uint16_t 257 // floor_interval Returns: void 258 struct L2CA_AdjustConnectionIntervals { 259 std::function<void(uint16_t* min_interval, uint16_t* max_interval, uint16_t floor_interval)> body{ 260 [](uint16_t* /* min_interval */, uint16_t* /* max_interval */, 261 uint16_t /* floor_interval */) {}}; operatorL2CA_AdjustConnectionIntervals262 void operator()(uint16_t* min_interval, uint16_t* max_interval, uint16_t floor_interval) { 263 body(min_interval, max_interval, floor_interval); 264 } 265 }; 266 extern struct L2CA_AdjustConnectionIntervals L2CA_AdjustConnectionIntervals; 267 // Name: L2CA_SetEcosystemBaseInterval 268 // Params: uint16_t* min_interval, uint16_t* max_interval, uint16_t 269 // floor_interval Returns: void 270 struct L2CA_SetEcosystemBaseInterval { 271 std::function<void(uint32_t base_interval)> body{[](uint32_t /* base_interval */) {}}; operatorL2CA_SetEcosystemBaseInterval272 void operator()(uint32_t base_interval) { body(base_interval); } 273 }; 274 extern struct L2CA_SetEcosystemBaseInterval L2CA_SetEcosystemBaseInterval; 275 // Name: l2cble_use_preferred_conn_params 276 // Params: const RawAddress& bda 277 // Returns: void 278 struct l2cble_use_preferred_conn_params { 279 std::function<void(const RawAddress& bda)> body{[](const RawAddress& /* bda */) {}}; operatorl2cble_use_preferred_conn_params280 void operator()(const RawAddress& bda) { body(bda); } 281 }; 282 extern struct l2cble_use_preferred_conn_params l2cble_use_preferred_conn_params; 283 // Name: L2CA_SubrateRequest 284 // Params: 285 // Returns: bool 286 struct L2CA_SubrateRequest { 287 std::function<bool(const RawAddress& rem_bda, uint16_t subrate_min, uint16_t subrate_max, 288 uint16_t max_latency, uint16_t cont_num, uint16_t timeout)> 289 body{[](const RawAddress& /* rem_bda */, uint16_t /* subrate_min */, 290 uint16_t /* subrate_max */, uint16_t /* max_latency */, uint16_t /* cont_num */, 291 uint16_t /* timeout */) { return false; }}; operatorL2CA_SubrateRequest292 bool operator()(const RawAddress& rem_bda, uint16_t subrate_min, uint16_t subrate_max, 293 uint16_t max_latency, uint16_t cont_num, uint16_t timeout) { 294 return body(rem_bda, subrate_min, subrate_max, max_latency, cont_num, timeout); 295 } 296 }; 297 extern struct L2CA_SubrateRequest L2CA_SubrateRequest; 298 // Name: l2cble_process_subrate_change_evt 299 // Params: const RawAddress& bda 300 // Returns: void 301 struct l2cble_process_subrate_change_evt { 302 std::function<void(uint16_t handle, uint8_t status, uint16_t subrate_factor, 303 uint16_t peripheral_latency, uint16_t cont_num, uint16_t timeout)> 304 body{[](uint16_t /* handle */, uint8_t /* status */, uint16_t /* subrate_factor */, 305 uint16_t /* peripheral_latency */, uint16_t /* cont_num */, 306 uint16_t /* timeout */) {}}; operatorl2cble_process_subrate_change_evt307 void operator()(uint16_t handle, uint8_t status, uint16_t subrate_factor, 308 uint16_t peripheral_latency, uint16_t cont_num, uint16_t timeout) { 309 body(handle, status, subrate_factor, peripheral_latency, cont_num, timeout); 310 } 311 }; 312 extern struct l2cble_process_subrate_change_evt l2cble_process_subrate_change_evt; 313 314 } // namespace stack_l2cap_ble 315 } // namespace mock 316 } // namespace test 317 318 // END mockcify generation 319