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 <base/functional/callback.h>
20 #include <gmock/gmock.h>
21 
22 #include "bta_api.h"
23 #include "bta_dm_api.h"
24 #include "bta_sec_api.h"
25 
26 namespace dm {
27 
28 class BtaDmInterface {
29 public:
30   virtual void BTA_DmBleScan(bool start, uint8_t duration) = 0;
31   virtual void BTA_DmBleCsisObserve(bool observe, tBTA_DM_SEARCH_CBACK* p_results_cb) = 0;
32   virtual void BTA_DmSirkSecCbRegister(tBTA_DM_SEC_CBACK* p_cback) = 0;
33   virtual void BTA_DmSirkConfirmDeviceReply(const RawAddress& bd_addr, bool accept) = 0;
34   virtual ~BtaDmInterface() = default;
35 };
36 
37 class MockBtaDmInterface : public BtaDmInterface {
38 public:
39   MOCK_METHOD((void), BTA_DmBleScan, (bool start, uint8_t duration));
40   MOCK_METHOD((void), BTA_DmBleCsisObserve, (bool observe, tBTA_DM_SEARCH_CBACK* p_results_cb));
41   MOCK_METHOD((void), BTA_DmSirkSecCbRegister, (tBTA_DM_SEC_CBACK * p_cback));
42   MOCK_METHOD((void), BTA_DmSirkConfirmDeviceReply, (const RawAddress& bd_addr, bool accept));
43 };
44 
45 /**
46  * Set the {@link MockBtaDmInterface} for testing
47  *
48  * @param mock_bta_dm_interface pointer to mock bta dm interface,
49  * could be null
50  */
51 void SetMockBtaDmInterface(MockBtaDmInterface* mock_bta_dm_interface);
52 
53 }  // namespace dm
54