1 /* 2 * Copyright 2021 HIMSA II K/S - www.himsa.com. 3 * Represented by EHIMA - www.ehima.com 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 #pragma once 18 19 #include <gmock/gmock.h> 20 21 #include "btm_api.h" 22 23 namespace bluetooth { 24 namespace manager { 25 26 class BtmInterface { 27 public: 28 virtual bool GetSecurityFlagsByTransport(const RawAddress& bd_addr, 29 uint8_t* p_sec_flags, 30 tBT_TRANSPORT transport) = 0; 31 virtual tBTM_STATUS SetEncryption(const RawAddress& bd_addr, 32 tBT_TRANSPORT transport, 33 tBTM_SEC_CALLBACK* p_callback, 34 void* p_ref_data, 35 tBTM_BLE_SEC_ACT sec_act) = 0; 36 virtual ~BtmInterface() = default; 37 }; 38 39 class MockBtmInterface : public BtmInterface { 40 public: 41 MOCK_METHOD((bool), GetSecurityFlagsByTransport, 42 (const RawAddress& bd_addr, uint8_t* p_sec_flags, 43 tBT_TRANSPORT transport), 44 (override)); 45 MOCK_METHOD((tBTM_STATUS), SetEncryption, 46 (const RawAddress& bd_addr, tBT_TRANSPORT transport, 47 tBTM_SEC_CALLBACK* p_callback, void* p_ref_data, 48 tBTM_BLE_SEC_ACT sec_act), 49 (override)); 50 }; 51 52 /** 53 * Set the {@link MockBtmInterface} for testing 54 * 55 * @param mock_btm_interface pointer to mock btm interface, could be null 56 */ 57 void SetMockBtmInterface(MockBtmInterface* mock_btm_interface); 58 59 } // namespace manager 60 } // namespace bluetooth 61