1 /*
2  * Copyright 2020 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 "mock_gatt_layer.h"
19 
20 #include "types/raw_address.h"
21 
22 static bluetooth::gatt::MockGattInterface* gatt_interface = nullptr;
23 
24 bluetooth::common::TimestampedCircularBuffer<tTCB_STATE_HISTORY> tcb_state_history_(
25         100 /*history size*/);
26 
SetMockGattInterface(MockGattInterface * mock_gatt_interface)27 void bluetooth::gatt::SetMockGattInterface(MockGattInterface* mock_gatt_interface) {
28   gatt_interface = mock_gatt_interface;
29 }
30 
gatt_profile_get_eatt_support(const RawAddress & peer_bda)31 bool gatt_profile_get_eatt_support(const RawAddress& peer_bda) {
32   return gatt_interface->GetEattSupport(peer_bda);
33 }
34 
gatt_cl_init_sr_status(tGATT_TCB & tcb)35 void gatt_cl_init_sr_status(tGATT_TCB& tcb) { return gatt_interface->ClientInitServerStatus(tcb); }
36 
gatt_cl_read_sr_supp_feat_req(const RawAddress & peer_bda,base::OnceCallback<void (const RawAddress &,uint8_t)> cb)37 bool gatt_cl_read_sr_supp_feat_req(const RawAddress& peer_bda,
38                                    base::OnceCallback<void(const RawAddress&, uint8_t)> cb) {
39   return gatt_interface->ClientReadSupportedFeatures(peer_bda, std::move(cb));
40 }
41