1 /* 2 * Copyright 2022 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 #include <functional> 18 19 #include "stack/btm/btm_dev.h" 20 #include "types/raw_address.h" 21 22 namespace test { 23 namespace mock { 24 namespace stack_btm_dev { 25 26 // Function state capture and return values, if needed 27 struct btm_find_dev { 28 std::function<tBTM_SEC_DEV_REC*(const RawAddress& bd_addr)> body{ 29 [](const RawAddress&) { return nullptr; }}; operatorbtm_find_dev30 tBTM_SEC_DEV_REC* operator()(const RawAddress& bd_addr) { return body(bd_addr); } 31 }; 32 extern struct btm_find_dev btm_find_dev; 33 34 struct BTM_Sec_AddressKnown { 35 std::function<bool(const RawAddress& address)> body{ 36 [](const RawAddress& /* address */) { return false; }}; operatorBTM_Sec_AddressKnown37 bool operator()(const RawAddress& address) { return body(address); } 38 }; 39 extern struct BTM_Sec_AddressKnown BTM_Sec_AddressKnown; 40 41 // Name: maybe_resolve_address 42 // Params: RawAddress* bda, tBLE_ADDR_TYPE* bda_type 43 // Returns: bool 44 struct maybe_resolve_address { 45 std::function<bool(RawAddress* bda, tBLE_ADDR_TYPE* bda_type)> body{ 46 [](RawAddress* /* bda */, tBLE_ADDR_TYPE* /* bda_type */) { return false; }}; operatormaybe_resolve_address47 bool operator()(RawAddress* bda, tBLE_ADDR_TYPE* bda_type) { return body(bda, bda_type); } 48 }; 49 extern struct maybe_resolve_address maybe_resolve_address; 50 51 } // namespace stack_btm_dev 52 } // namespace mock 53 } // namespace test 54