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 #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 "stack/include/l2c_api.h" 38 #include "stack/l2cap/l2c_int.h" 39 #include "types/ble_address_with_type.h" 40 #include "types/hci_role.h" 41 #include "types/raw_address.h" 42 43 // Mocked compile conditionals, if any 44 #ifndef UNUSED_ATTR 45 #define UNUSED_ATTR 46 #endif 47 48 namespace test { 49 namespace mock { 50 namespace stack_l2cap_ble { 51 52 // Shared state between mocked functions and tests 53 // Name: L2CA_UpdateBleConnParams 54 // Params: const RawAddress& rem_bda, uint16_t min_int, uint16_t max_int, 55 // uint16_t latency, uint16_t timeout, uint16_t min_ce_len, uint16_t max_ce_len 56 // Returns: bool 57 struct L2CA_UpdateBleConnParams { 58 std::function<bool(const RawAddress& rem_bda, uint16_t min_int, 59 uint16_t max_int, uint16_t latency, uint16_t timeout, 60 uint16_t min_ce_len, uint16_t max_ce_len)> 61 body{[](const RawAddress& rem_bda, uint16_t min_int, uint16_t max_int, 62 uint16_t latency, uint16_t timeout, uint16_t min_ce_len, 63 uint16_t max_ce_len) { return false; }}; operatorL2CA_UpdateBleConnParams64 bool operator()(const RawAddress& rem_bda, uint16_t min_int, uint16_t max_int, 65 uint16_t latency, uint16_t timeout, uint16_t min_ce_len, 66 uint16_t max_ce_len) { 67 return body(rem_bda, min_int, max_int, latency, timeout, min_ce_len, 68 max_ce_len); 69 }; 70 }; 71 extern struct L2CA_UpdateBleConnParams L2CA_UpdateBleConnParams; 72 // Name: L2CA_EnableUpdateBleConnParams 73 // Params: const RawAddress& rem_bda, bool enable 74 // Returns: bool 75 struct L2CA_EnableUpdateBleConnParams { 76 std::function<bool(const RawAddress& rem_bda, bool enable)> body{ 77 [](const RawAddress& rem_bda, bool enable) { return false; }}; operatorL2CA_EnableUpdateBleConnParams78 bool operator()(const RawAddress& rem_bda, bool enable) { 79 return body(rem_bda, enable); 80 }; 81 }; 82 extern struct L2CA_EnableUpdateBleConnParams L2CA_EnableUpdateBleConnParams; 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: l2cble_notify_le_connection 93 // Params: const RawAddress& bda 94 // Returns: void 95 struct l2cble_notify_le_connection { 96 std::function<void(const RawAddress& bda)> body{[](const RawAddress& bda) {}}; operatorl2cble_notify_le_connection97 void operator()(const RawAddress& bda) { body(bda); }; 98 }; 99 extern struct l2cble_notify_le_connection l2cble_notify_le_connection; 100 // Name: l2cble_conn_comp 101 // Params: uint16_t handle, uint8_t role, const RawAddress& bda, tBLE_ADDR_TYPE 102 // type, uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout 103 // Returns: bool 104 struct l2cble_conn_comp { 105 std::function<bool(uint16_t handle, uint8_t role, const RawAddress& bda, 106 tBLE_ADDR_TYPE type, uint16_t conn_interval, 107 uint16_t conn_latency, uint16_t conn_timeout)> 108 body{[](uint16_t handle, uint8_t role, const RawAddress& bda, 109 tBLE_ADDR_TYPE type, uint16_t conn_interval, 110 uint16_t conn_latency, uint16_t conn_timeout) { return false; }}; operatorl2cble_conn_comp111 bool operator()(uint16_t handle, uint8_t role, const RawAddress& bda, 112 tBLE_ADDR_TYPE type, uint16_t conn_interval, 113 uint16_t conn_latency, uint16_t conn_timeout) { 114 return body(handle, role, bda, type, conn_interval, conn_latency, 115 conn_timeout); 116 }; 117 }; 118 extern struct l2cble_conn_comp l2cble_conn_comp; 119 // Name: l2cble_conn_comp_from_address_with_type 120 // Params: uint16_t handle, uint8_t role, const tBLE_BD_ADDR& 121 // address_with_type, uint16_t conn_interval, uint16_t conn_latency, uint16_t 122 // conn_timeout Returns: bool 123 struct l2cble_conn_comp_from_address_with_type { 124 std::function<bool( 125 uint16_t handle, uint8_t role, const tBLE_BD_ADDR& address_with_type, 126 uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout)> 127 body{[](uint16_t handle, uint8_t role, 128 const tBLE_BD_ADDR& address_with_type, uint16_t conn_interval, 129 uint16_t conn_latency, uint16_t conn_timeout) { return false; }}; operatorl2cble_conn_comp_from_address_with_type130 bool operator()(uint16_t handle, uint8_t role, 131 const tBLE_BD_ADDR& address_with_type, uint16_t conn_interval, 132 uint16_t conn_latency, uint16_t conn_timeout) { 133 return body(handle, role, address_with_type, conn_interval, conn_latency, 134 conn_timeout); 135 }; 136 }; 137 extern struct l2cble_conn_comp_from_address_with_type 138 l2cble_conn_comp_from_address_with_type; 139 // Name: l2cble_process_conn_update_evt 140 // Params: uint16_t handle, uint8_t status, uint16_t interval, uint16_t latency, 141 // uint16_t timeout Returns: void 142 struct l2cble_process_conn_update_evt { 143 std::function<void(uint16_t handle, uint8_t status, uint16_t interval, 144 uint16_t latency, uint16_t timeout)> 145 body{[](uint16_t handle, uint8_t status, uint16_t interval, 146 uint16_t latency, uint16_t timeout) {}}; operatorl2cble_process_conn_update_evt147 void operator()(uint16_t handle, uint8_t status, uint16_t interval, 148 uint16_t latency, uint16_t timeout) { 149 body(handle, status, interval, latency, timeout); 150 }; 151 }; 152 extern struct l2cble_process_conn_update_evt l2cble_process_conn_update_evt; 153 // Name: l2cble_process_sig_cmd 154 // Params: tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len 155 // Returns: void 156 struct l2cble_process_sig_cmd { 157 std::function<void(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len)> body{ 158 [](tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) {}}; operatorl2cble_process_sig_cmd159 void operator()(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) { 160 body(p_lcb, p, pkt_len); 161 }; 162 }; 163 extern struct l2cble_process_sig_cmd l2cble_process_sig_cmd; 164 // Name: l2cble_create_conn 165 // Params: tL2C_LCB* p_lcb 166 // Returns: bool 167 struct l2cble_create_conn { 168 std::function<bool(tL2C_LCB* p_lcb)> body{ 169 [](tL2C_LCB* p_lcb) { return false; }}; operatorl2cble_create_conn170 bool operator()(tL2C_LCB* p_lcb) { return body(p_lcb); }; 171 }; 172 extern struct l2cble_create_conn l2cble_create_conn; 173 // Name: l2c_link_processs_ble_num_bufs 174 // Params: uint16_t num_lm_ble_bufs 175 // Returns: void 176 struct l2c_link_processs_ble_num_bufs { 177 std::function<void(uint16_t num_lm_ble_bufs)> body{ 178 [](uint16_t num_lm_ble_bufs) {}}; operatorl2c_link_processs_ble_num_bufs179 void operator()(uint16_t num_lm_ble_bufs) { body(num_lm_ble_bufs); }; 180 }; 181 extern struct l2c_link_processs_ble_num_bufs l2c_link_processs_ble_num_bufs; 182 // Name: l2c_ble_link_adjust_allocation 183 // Params: void 184 // Returns: void 185 struct l2c_ble_link_adjust_allocation { 186 std::function<void(void)> body{[](void) {}}; operatorl2c_ble_link_adjust_allocation187 void operator()(void) { body(); }; 188 }; 189 extern struct l2c_ble_link_adjust_allocation l2c_ble_link_adjust_allocation; 190 // Name: l2cble_process_rc_param_request_evt 191 // Params: uint16_t handle, uint16_t int_min, uint16_t int_max, uint16_t 192 // latency, uint16_t timeout Returns: void 193 struct l2cble_process_rc_param_request_evt { 194 std::function<void(uint16_t handle, uint16_t int_min, uint16_t int_max, 195 uint16_t latency, uint16_t timeout)> 196 body{[](uint16_t handle, uint16_t int_min, uint16_t int_max, 197 uint16_t latency, uint16_t timeout) {}}; operatorl2cble_process_rc_param_request_evt198 void operator()(uint16_t handle, uint16_t int_min, uint16_t int_max, 199 uint16_t latency, uint16_t timeout) { 200 body(handle, int_min, int_max, latency, timeout); 201 }; 202 }; 203 extern struct l2cble_process_rc_param_request_evt 204 l2cble_process_rc_param_request_evt; 205 // Name: l2cble_update_data_length 206 // Params: tL2C_LCB* p_lcb 207 // Returns: void 208 struct l2cble_update_data_length { 209 std::function<void(tL2C_LCB* p_lcb)> body{[](tL2C_LCB* p_lcb) {}}; operatorl2cble_update_data_length210 void operator()(tL2C_LCB* p_lcb) { body(p_lcb); }; 211 }; 212 extern struct l2cble_update_data_length l2cble_update_data_length; 213 // Name: l2cble_process_data_length_change_event 214 // Params: uint16_t handle, uint16_t tx_data_len, uint16_t rx_data_len 215 // Returns: void 216 struct l2cble_process_data_length_change_event { 217 std::function<void(uint16_t handle, uint16_t tx_data_len, 218 uint16_t rx_data_len)> 219 body{[](uint16_t handle, uint16_t tx_data_len, uint16_t rx_data_len) {}}; operatorl2cble_process_data_length_change_event220 void operator()(uint16_t handle, uint16_t tx_data_len, uint16_t rx_data_len) { 221 body(handle, tx_data_len, rx_data_len); 222 }; 223 }; 224 extern struct l2cble_process_data_length_change_event 225 l2cble_process_data_length_change_event; 226 // Name: l2cble_credit_based_conn_req 227 // Params: tL2C_CCB* p_ccb 228 // Returns: void 229 struct l2cble_credit_based_conn_req { 230 std::function<void(tL2C_CCB* p_ccb)> body{[](tL2C_CCB* p_ccb) {}}; operatorl2cble_credit_based_conn_req231 void operator()(tL2C_CCB* p_ccb) { body(p_ccb); }; 232 }; 233 extern struct l2cble_credit_based_conn_req l2cble_credit_based_conn_req; 234 // Name: l2cble_credit_based_conn_res 235 // Params: tL2C_CCB* p_ccb, uint16_t result 236 // Returns: void 237 struct l2cble_credit_based_conn_res { 238 std::function<void(tL2C_CCB* p_ccb, uint16_t result)> body{ 239 [](tL2C_CCB* p_ccb, uint16_t result) {}}; operatorl2cble_credit_based_conn_res240 void operator()(tL2C_CCB* p_ccb, uint16_t result) { body(p_ccb, result); }; 241 }; 242 extern struct l2cble_credit_based_conn_res l2cble_credit_based_conn_res; 243 // Name: l2cble_send_flow_control_credit 244 // Params: tL2C_CCB* p_ccb, uint16_t credit_value 245 // Returns: void 246 struct l2cble_send_flow_control_credit { 247 std::function<void(tL2C_CCB* p_ccb, uint16_t credit_value)> body{ 248 [](tL2C_CCB* p_ccb, uint16_t credit_value) {}}; operatorl2cble_send_flow_control_credit249 void operator()(tL2C_CCB* p_ccb, uint16_t credit_value) { 250 body(p_ccb, credit_value); 251 }; 252 }; 253 extern struct l2cble_send_flow_control_credit l2cble_send_flow_control_credit; 254 // Name: l2cble_send_peer_disc_req 255 // Params: tL2C_CCB* p_ccb 256 // Returns: void 257 struct l2cble_send_peer_disc_req { 258 std::function<void(tL2C_CCB* p_ccb)> body{[](tL2C_CCB* p_ccb) {}}; operatorl2cble_send_peer_disc_req259 void operator()(tL2C_CCB* p_ccb) { body(p_ccb); }; 260 }; 261 extern struct l2cble_send_peer_disc_req l2cble_send_peer_disc_req; 262 // Name: l2cble_sec_comp 263 // Params: const RawAddress* bda, tBT_TRANSPORT transport, void* p_ref_data, 264 // tBTM_STATUS status Returns: void 265 struct l2cble_sec_comp { 266 std::function<void(const RawAddress* bda, tBT_TRANSPORT transport, 267 void* p_ref_data, tBTM_STATUS status)> 268 body{[](const RawAddress* bda, tBT_TRANSPORT transport, void* p_ref_data, 269 tBTM_STATUS status) {}}; operatorl2cble_sec_comp270 void operator()(const RawAddress* bda, tBT_TRANSPORT transport, 271 void* p_ref_data, tBTM_STATUS status) { 272 body(bda, transport, p_ref_data, status); 273 }; 274 }; 275 extern struct l2cble_sec_comp l2cble_sec_comp; 276 // Name: l2ble_sec_access_req 277 // Params: const RawAddress& bd_addr, uint16_t psm, bool is_originator, 278 // tL2CAP_SEC_CBACK* p_callback, void* p_ref_data Returns: tL2CAP_LE_RESULT_CODE 279 struct l2ble_sec_access_req { 280 std::function<tL2CAP_LE_RESULT_CODE( 281 const RawAddress& bd_addr, uint16_t psm, bool is_originator, 282 tL2CAP_SEC_CBACK* p_callback, void* p_ref_data)> 283 body{[](const RawAddress& bd_addr, uint16_t psm, bool is_originator, 284 tL2CAP_SEC_CBACK* p_callback, 285 void* p_ref_data) { return L2CAP_LE_RESULT_CONN_OK; }}; operatorl2ble_sec_access_req286 tL2CAP_LE_RESULT_CODE operator()(const RawAddress& bd_addr, uint16_t psm, 287 bool is_originator, 288 tL2CAP_SEC_CBACK* p_callback, 289 void* p_ref_data) { 290 return body(bd_addr, psm, is_originator, p_callback, p_ref_data); 291 }; 292 }; 293 extern struct l2ble_sec_access_req l2ble_sec_access_req; 294 // Name: L2CA_AdjustConnectionIntervals 295 // Params: uint16_t* min_interval, uint16_t* max_interval, uint16_t 296 // floor_interval Returns: void 297 struct L2CA_AdjustConnectionIntervals { 298 std::function<void(uint16_t* min_interval, uint16_t* max_interval, 299 uint16_t floor_interval)> 300 body{[](uint16_t* min_interval, uint16_t* max_interval, 301 uint16_t floor_interval) {}}; operatorL2CA_AdjustConnectionIntervals302 void operator()(uint16_t* min_interval, uint16_t* max_interval, 303 uint16_t floor_interval) { 304 body(min_interval, max_interval, floor_interval); 305 }; 306 }; 307 extern struct L2CA_AdjustConnectionIntervals L2CA_AdjustConnectionIntervals; 308 // Name: l2cble_use_preferred_conn_params 309 // Params: const RawAddress& bda 310 // Returns: void 311 struct l2cble_use_preferred_conn_params { 312 std::function<void(const RawAddress& bda)> body{[](const RawAddress& bda) {}}; operatorl2cble_use_preferred_conn_params313 void operator()(const RawAddress& bda) { body(bda); }; 314 }; 315 extern struct l2cble_use_preferred_conn_params l2cble_use_preferred_conn_params; 316 317 } // namespace stack_l2cap_ble 318 } // namespace mock 319 } // namespace test 320 321 // END mockcify generation 322