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