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
18 #include "bta_dm_api_mock.h"
19
20 #include <bluetooth/log.h>
21
22 using namespace bluetooth;
23
24 static dm::MockBtaDmInterface* dm_interface = nullptr;
25
SetMockBtaDmInterface(MockBtaDmInterface * mock_bta_dm_interface)26 void dm::SetMockBtaDmInterface(MockBtaDmInterface* mock_bta_dm_interface) {
27 dm_interface = mock_bta_dm_interface;
28 }
29
BTA_DmBleScan(bool start,uint8_t duration,bool low_latency_scan)30 void BTA_DmBleScan(bool start, uint8_t duration, bool low_latency_scan) {
31 log::assert_that(dm_interface != nullptr, "Mock BTA DM interface not set!");
32 return dm_interface->BTA_DmBleScan(start, duration, low_latency_scan);
33 }
34
BTA_DmBleCsisObserve(bool observe,tBTA_DM_SEARCH_CBACK * p_results_cb)35 void BTA_DmBleCsisObserve(bool observe, tBTA_DM_SEARCH_CBACK* p_results_cb) {
36 log::assert_that(dm_interface != nullptr, "Mock BTA DM interface not set!");
37 return dm_interface->BTA_DmBleCsisObserve(observe, p_results_cb);
38 }
39
BTA_DmSirkSecCbRegister(tBTA_DM_SEC_CBACK * p_cback)40 void BTA_DmSirkSecCbRegister(tBTA_DM_SEC_CBACK* p_cback) {
41 log::assert_that(dm_interface != nullptr, "Mock BTA DM interface not set!");
42 return dm_interface->BTA_DmSirkSecCbRegister(p_cback);
43 }
44
BTA_DmSirkConfirmDeviceReply(const RawAddress & bd_addr,bool accept)45 void BTA_DmSirkConfirmDeviceReply(const RawAddress& bd_addr, bool accept) {
46 log::assert_that(dm_interface != nullptr, "Mock BTA DM interface not set!");
47 return dm_interface->BTA_DmSirkConfirmDeviceReply(bd_addr, accept);
48 }
49