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 #include <cstdint> 25 #include <functional> 26 27 // Original included files, if any 28 #include "stack/l2cap/l2c_int.h" 29 #include "types/ble_address_with_type.h" 30 #include "types/hci_role.h" 31 #include "types/raw_address.h" 32 33 // Mocked compile conditionals, if any 34 namespace test { 35 namespace mock { 36 namespace stack_l2cap_ble { 37 38 // Shared state between mocked functions and tests 39 // Name: L2CA_UpdateBleConnParams 40 // Params: const RawAddress& rem_bda, uint16_t min_int, uint16_t max_int, 41 // uint16_t latency, uint16_t timeout, uint16_t min_ce_len, uint16_t max_ce_len 42 // Returns: bool 43 struct L2CA_UpdateBleConnParams { 44 std::function<bool(const RawAddress& rem_bda, uint16_t min_int, 45 uint16_t max_int, uint16_t latency, uint16_t timeout, 46 uint16_t min_ce_len, uint16_t max_ce_len)> 47 body{[](const RawAddress& /* rem_bda */, uint16_t /* min_int */, 48 uint16_t /* max_int */, uint16_t /* latency */, 49 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, 52 uint16_t latency, uint16_t timeout, uint16_t min_ce_len, 53 uint16_t max_ce_len) { 54 return body(rem_bda, min_int, max_int, latency, timeout, min_ce_len, 55 max_ce_len); 56 }; 57 }; 58 extern struct L2CA_UpdateBleConnParams L2CA_UpdateBleConnParams; 59 // Name: L2CA_LockBleConnParamsForServiceDiscovery 60 // Params: const RawAddress& rem_bda, bool enable 61 // Returns: void 62 struct L2CA_LockBleConnParamsForServiceDiscovery { 63 std::function<void(const RawAddress& rem_bda, bool enable)> body{ 64 [](const RawAddress& /* rem_bda */, bool /* enable */) { return false; }}; operatorL2CA_LockBleConnParamsForServiceDiscovery65 void operator()(const RawAddress& rem_bda, bool enable) { 66 return body(rem_bda, enable); 67 }; 68 }; 69 extern struct L2CA_LockBleConnParamsForServiceDiscovery 70 L2CA_LockBleConnParamsForServiceDiscovery; 71 // Name: L2CA_LockBleConnParamsForProfileConnection 72 // Params: const RawAddress& rem_bda, bool enable 73 // Returns: void 74 struct L2CA_LockBleConnParamsForProfileConnection { 75 std::function<void(const RawAddress& rem_bda, bool enable)> body{ 76 [](const RawAddress& /* rem_bda */, bool /* enable */) { return false; }}; operatorL2CA_LockBleConnParamsForProfileConnection77 void operator()(const RawAddress& rem_bda, bool enable) { 78 return body(rem_bda, enable); 79 }; 80 }; 81 extern struct L2CA_LockBleConnParamsForProfileConnection 82 L2CA_LockBleConnParamsForProfileConnection; 83 struct L2CA_ConsolidateParams { 84 std::function<void(const RawAddress& identity_addr, const RawAddress& rpa)> 85 body{[](const RawAddress& /* identity_addr */, 86 const RawAddress& /* rpa */) { return false; }}; operatorL2CA_ConsolidateParams87 void operator()(const RawAddress& identity_addr, const RawAddress& rpa) { 88 body(identity_addr, rpa); 89 }; 90 }; 91 extern struct L2CA_ConsolidateParams L2CA_ConsolidateParams; 92 // Name: L2CA_GetBleConnRole 93 // Params: const RawAddress& bd_addr 94 // Returns: hci_role_t 95 struct L2CA_GetBleConnRole { 96 std::function<hci_role_t(const RawAddress& bd_addr)> body{ 97 [](const RawAddress& /* bd_addr */) { return HCI_ROLE_CENTRAL; }}; operatorL2CA_GetBleConnRole98 hci_role_t operator()(const RawAddress& bd_addr) { return body(bd_addr); }; 99 }; 100 extern struct L2CA_GetBleConnRole L2CA_GetBleConnRole; 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{ 106 [](const RawAddress& /* bda */) {}}; operatorl2cble_notify_le_connection107 void operator()(const RawAddress& bda) { body(bda); }; 108 }; 109 extern struct l2cble_notify_le_connection l2cble_notify_le_connection; 110 // Name: l2cble_conn_comp 111 // Params: uint16_t handle, uint8_t role, const RawAddress& bda, tBLE_ADDR_TYPE 112 // type, uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout 113 // Returns: bool 114 struct l2cble_conn_comp { 115 std::function<bool(uint16_t handle, uint8_t role, const RawAddress& bda, 116 tBLE_ADDR_TYPE type, uint16_t conn_interval, 117 uint16_t conn_latency, uint16_t conn_timeout)> 118 body{[](uint16_t /* handle */, uint8_t /* role */, 119 const RawAddress& /* bda */, tBLE_ADDR_TYPE /* type */, 120 uint16_t /* conn_interval */, uint16_t /* conn_latency */, 121 uint16_t /* conn_timeout */) { return false; }}; operatorl2cble_conn_comp122 bool operator()(uint16_t handle, uint8_t role, const RawAddress& bda, 123 tBLE_ADDR_TYPE type, uint16_t conn_interval, 124 uint16_t conn_latency, uint16_t conn_timeout) { 125 return body(handle, role, bda, type, conn_interval, conn_latency, 126 conn_timeout); 127 }; 128 }; 129 extern struct l2cble_conn_comp l2cble_conn_comp; 130 // Name: l2cble_process_conn_update_evt 131 // Params: uint16_t handle, uint8_t status, uint16_t interval, uint16_t latency, 132 // uint16_t timeout Returns: void 133 struct l2cble_process_conn_update_evt { 134 std::function<void(uint16_t handle, uint8_t status, uint16_t interval, 135 uint16_t latency, uint16_t timeout)> 136 body{[](uint16_t /* handle */, uint8_t /* status */, 137 uint16_t /* interval */, uint16_t /* latency */, 138 uint16_t /* timeout */) {}}; operatorl2cble_process_conn_update_evt139 void operator()(uint16_t handle, uint8_t status, uint16_t interval, 140 uint16_t latency, uint16_t timeout) { 141 body(handle, status, interval, latency, timeout); 142 }; 143 }; 144 extern struct l2cble_process_conn_update_evt l2cble_process_conn_update_evt; 145 // Name: l2cble_process_sig_cmd 146 // Params: tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len 147 // Returns: void 148 struct l2cble_process_sig_cmd { 149 std::function<void(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len)> body{ 150 [](tL2C_LCB* /* p_lcb */, uint8_t* /* p */, uint16_t /* pkt_len */) {}}; operatorl2cble_process_sig_cmd151 void operator()(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) { 152 body(p_lcb, p, pkt_len); 153 }; 154 }; 155 extern struct l2cble_process_sig_cmd l2cble_process_sig_cmd; 156 // Name: l2cble_create_conn 157 // Params: tL2C_LCB* p_lcb 158 // Returns: bool 159 struct l2cble_create_conn { 160 std::function<bool(tL2C_LCB* p_lcb)> body{ 161 [](tL2C_LCB* /* p_lcb */) { return false; }}; operatorl2cble_create_conn162 bool operator()(tL2C_LCB* p_lcb) { return body(p_lcb); }; 163 }; 164 extern struct l2cble_create_conn l2cble_create_conn; 165 // Name: l2c_link_processs_ble_num_bufs 166 // Params: uint16_t num_lm_ble_bufs 167 // Returns: void 168 struct l2c_link_processs_ble_num_bufs { 169 std::function<void(uint16_t num_lm_ble_bufs)> body{ 170 [](uint16_t /* num_lm_ble_bufs */) {}}; operatorl2c_link_processs_ble_num_bufs171 void operator()(uint16_t num_lm_ble_bufs) { body(num_lm_ble_bufs); }; 172 }; 173 extern struct l2c_link_processs_ble_num_bufs l2c_link_processs_ble_num_bufs; 174 // Name: l2c_ble_link_adjust_allocation 175 // Params: void 176 // Returns: void 177 struct l2c_ble_link_adjust_allocation { 178 std::function<void(void)> body{[](void) {}}; operatorl2c_ble_link_adjust_allocation179 void operator()(void) { body(); }; 180 }; 181 extern struct l2c_ble_link_adjust_allocation l2c_ble_link_adjust_allocation; 182 // Name: l2cble_update_data_length 183 // Params: tL2C_LCB* p_lcb 184 // Returns: void 185 struct l2cble_update_data_length { 186 std::function<void(tL2C_LCB* p_lcb)> body{[](tL2C_LCB* /* p_lcb */) {}}; operatorl2cble_update_data_length187 void operator()(tL2C_LCB* p_lcb) { body(p_lcb); }; 188 }; 189 extern struct l2cble_update_data_length l2cble_update_data_length; 190 // Name: l2cble_process_data_length_change_event 191 // Params: uint16_t handle, uint16_t tx_data_len, uint16_t rx_data_len 192 // Returns: void 193 struct l2cble_process_data_length_change_event { 194 std::function<void(uint16_t handle, uint16_t tx_data_len, 195 uint16_t rx_data_len)> 196 body{[](uint16_t /* handle */, uint16_t /* tx_data_len */, 197 uint16_t /* rx_data_len */) {}}; operatorl2cble_process_data_length_change_event198 void operator()(uint16_t handle, uint16_t tx_data_len, uint16_t rx_data_len) { 199 body(handle, tx_data_len, rx_data_len); 200 }; 201 }; 202 extern struct l2cble_process_data_length_change_event 203 l2cble_process_data_length_change_event; 204 // Name: l2cble_credit_based_conn_req 205 // Params: tL2C_CCB* p_ccb 206 // Returns: void 207 struct l2cble_credit_based_conn_req { 208 std::function<void(tL2C_CCB* p_ccb)> body{[](tL2C_CCB* /* p_ccb */) {}}; operatorl2cble_credit_based_conn_req209 void operator()(tL2C_CCB* p_ccb) { body(p_ccb); }; 210 }; 211 extern struct l2cble_credit_based_conn_req l2cble_credit_based_conn_req; 212 // Name: l2cble_credit_based_conn_res 213 // Params: tL2C_CCB* p_ccb, uint16_t result 214 // Returns: void 215 struct l2cble_credit_based_conn_res { 216 std::function<void(tL2C_CCB* p_ccb, uint16_t result)> body{ 217 [](tL2C_CCB* /* p_ccb */, uint16_t /* result */) {}}; operatorl2cble_credit_based_conn_res218 void operator()(tL2C_CCB* p_ccb, uint16_t result) { body(p_ccb, result); }; 219 }; 220 extern struct l2cble_credit_based_conn_res l2cble_credit_based_conn_res; 221 // Name: l2cble_send_flow_control_credit 222 // Params: tL2C_CCB* p_ccb, uint16_t credit_value 223 // Returns: void 224 struct l2cble_send_flow_control_credit { 225 std::function<void(tL2C_CCB* p_ccb, uint16_t credit_value)> body{ 226 [](tL2C_CCB* /* p_ccb */, uint16_t /* credit_value */) {}}; operatorl2cble_send_flow_control_credit227 void operator()(tL2C_CCB* p_ccb, uint16_t credit_value) { 228 body(p_ccb, credit_value); 229 }; 230 }; 231 extern struct l2cble_send_flow_control_credit l2cble_send_flow_control_credit; 232 // Name: l2cble_send_peer_disc_req 233 // Params: tL2C_CCB* p_ccb 234 // Returns: void 235 struct l2cble_send_peer_disc_req { 236 std::function<void(tL2C_CCB* p_ccb)> body{[](tL2C_CCB* /* p_ccb */) {}}; operatorl2cble_send_peer_disc_req237 void operator()(tL2C_CCB* p_ccb) { body(p_ccb); }; 238 }; 239 extern struct l2cble_send_peer_disc_req l2cble_send_peer_disc_req; 240 // Name: l2cble_sec_comp 241 // Params: const RawAddress* bda, tBT_TRANSPORT transport, void* p_ref_data, 242 // tBTM_STATUS status Returns: void 243 struct l2cble_sec_comp { 244 std::function<void(const RawAddress* bda, tBT_TRANSPORT transport, 245 void* p_ref_data, tBTM_STATUS status)> 246 body{[](const RawAddress* /* bda */, tBT_TRANSPORT /* transport */, 247 void* /* p_ref_data */, tBTM_STATUS /* status */) {}}; operatorl2cble_sec_comp248 void operator()(const RawAddress* bda, tBT_TRANSPORT transport, 249 void* p_ref_data, tBTM_STATUS status) { 250 body(bda, transport, p_ref_data, status); 251 }; 252 }; 253 extern struct l2cble_sec_comp l2cble_sec_comp; 254 // Name: l2ble_sec_access_req 255 // Params: const RawAddress& bd_addr, uint16_t psm, bool is_originator, 256 // tL2CAP_SEC_CBACK* p_callback, void* p_ref_data Returns: tL2CAP_LE_RESULT_CODE 257 struct l2ble_sec_access_req { 258 std::function<tL2CAP_LE_RESULT_CODE( 259 const RawAddress& bd_addr, uint16_t psm, bool is_originator, 260 tBTM_SEC_CALLBACK* p_callback, void* p_ref_data)> 261 body{[](const RawAddress& /* bd_addr */, uint16_t /* psm */, 262 bool /* is_originator */, tBTM_SEC_CALLBACK* /* p_callback */, 263 void* /* p_ref_data */) { return L2CAP_LE_RESULT_CONN_OK; }}; operatorl2ble_sec_access_req264 tL2CAP_LE_RESULT_CODE operator()(const RawAddress& bd_addr, uint16_t psm, 265 bool is_originator, 266 tBTM_SEC_CALLBACK* p_callback, 267 void* p_ref_data) { 268 return body(bd_addr, psm, is_originator, p_callback, p_ref_data); 269 }; 270 }; 271 extern struct l2ble_sec_access_req l2ble_sec_access_req; 272 // Name: L2CA_AdjustConnectionIntervals 273 // Params: uint16_t* min_interval, uint16_t* max_interval, uint16_t 274 // floor_interval Returns: void 275 struct L2CA_AdjustConnectionIntervals { 276 std::function<void(uint16_t* min_interval, uint16_t* max_interval, 277 uint16_t floor_interval)> 278 body{[](uint16_t* /* min_interval */, uint16_t* /* max_interval */, 279 uint16_t /* floor_interval */) {}}; operatorL2CA_AdjustConnectionIntervals280 void operator()(uint16_t* min_interval, uint16_t* max_interval, 281 uint16_t floor_interval) { 282 body(min_interval, max_interval, floor_interval); 283 }; 284 }; 285 extern struct L2CA_AdjustConnectionIntervals L2CA_AdjustConnectionIntervals; 286 // Name: L2CA_SetEcosystemBaseInterval 287 // Params: uint16_t* min_interval, uint16_t* max_interval, uint16_t 288 // floor_interval Returns: void 289 struct L2CA_SetEcosystemBaseInterval { 290 std::function<void(uint32_t base_interval)> body{ 291 [](uint32_t /* base_interval */) {}}; operatorL2CA_SetEcosystemBaseInterval292 void operator()(uint32_t base_interval) { body(base_interval); }; 293 }; 294 extern struct L2CA_SetEcosystemBaseInterval L2CA_SetEcosystemBaseInterval; 295 // Name: l2cble_use_preferred_conn_params 296 // Params: const RawAddress& bda 297 // Returns: void 298 struct l2cble_use_preferred_conn_params { 299 std::function<void(const RawAddress& bda)> body{ 300 [](const RawAddress& /* bda */) {}}; operatorl2cble_use_preferred_conn_params301 void operator()(const RawAddress& bda) { body(bda); }; 302 }; 303 extern struct l2cble_use_preferred_conn_params l2cble_use_preferred_conn_params; 304 // Name: L2CA_SubrateRequest 305 // Params: 306 // Returns: bool 307 struct L2CA_SubrateRequest { 308 std::function<bool(const RawAddress& rem_bda, uint16_t subrate_min, 309 uint16_t subrate_max, uint16_t max_latency, 310 uint16_t cont_num, uint16_t timeout)> 311 body{[](const RawAddress& /* rem_bda */, uint16_t /* subrate_min */, 312 uint16_t /* subrate_max */, uint16_t /* max_latency */, 313 uint16_t /* cont_num */, 314 uint16_t /* timeout */) { return false; }}; operatorL2CA_SubrateRequest315 bool operator()(const RawAddress& rem_bda, uint16_t subrate_min, 316 uint16_t subrate_max, uint16_t max_latency, uint16_t cont_num, 317 uint16_t timeout) { 318 return body(rem_bda, subrate_min, subrate_max, max_latency, cont_num, 319 timeout); 320 }; 321 }; 322 extern struct L2CA_SubrateRequest L2CA_SubrateRequest; 323 // Name: l2cble_process_subrate_change_evt 324 // Params: const RawAddress& bda 325 // Returns: void 326 struct l2cble_process_subrate_change_evt { 327 std::function<void(uint16_t handle, uint8_t status, uint16_t subrate_factor, 328 uint16_t peripheral_latency, uint16_t cont_num, 329 uint16_t timeout)> 330 body{[](uint16_t /* handle */, uint8_t /* status */, 331 uint16_t /* subrate_factor */, uint16_t /* peripheral_latency */, 332 uint16_t /* cont_num */, uint16_t /* timeout */) {}}; operatorl2cble_process_subrate_change_evt333 void operator()(uint16_t handle, uint8_t status, uint16_t subrate_factor, 334 uint16_t peripheral_latency, uint16_t cont_num, 335 uint16_t timeout) { 336 body(handle, status, subrate_factor, peripheral_latency, cont_num, timeout); 337 }; 338 }; 339 extern struct l2cble_process_subrate_change_evt 340 l2cble_process_subrate_change_evt; 341 342 } // namespace stack_l2cap_ble 343 } // namespace mock 344 } // namespace test 345 346 // END mockcify generation 347