1 /****************************************************************************** 2 * 3 * Copyright 2018 The Android Open Source Project 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_l2cap_layer.h" 19 20 static bluetooth::l2cap::MockL2capInterface* l2cap_interface = nullptr; 21 22 void bluetooth::l2cap::SetMockInterface( 23 MockL2capInterface* mock_l2cap_interface) { 24 l2cap_interface = mock_l2cap_interface; 25 } 26 27 uint16_t L2CA_Register(uint16_t psm, tL2CAP_APPL_INFO* p_cb_info) { 28 VLOG(1) << __func__ << ": psm=" << psm << ", p_cb_info=" << p_cb_info; 29 return l2cap_interface->Register(psm, p_cb_info); 30 } 31 32 uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& bd_addr) { 33 return l2cap_interface->ConnectRequest(psm, bd_addr); 34 } 35 36 bool L2CA_ConnectRsp(const RawAddress& bd_addr, uint8_t id, uint16_t lcid, 37 uint16_t result, uint16_t status) { 38 return l2cap_interface->ConnectResponse(bd_addr, id, lcid, result, status); 39 } 40 41 bool L2CA_DisconnectReq(uint16_t cid) { 42 return l2cap_interface->DisconnectRequest(cid); 43 } 44 45 bool L2CA_DisconnectRsp(uint16_t cid) { 46 return l2cap_interface->DisconnectResponse(cid); 47 } 48 49 bool L2CA_ConfigReq(uint16_t cid, tL2CAP_CFG_INFO* p_cfg) { 50 return l2cap_interface->ConfigRequest(cid, p_cfg); 51 } 52 53 bool L2CA_ConfigRsp(uint16_t cid, tL2CAP_CFG_INFO* p_cfg) { 54 return l2cap_interface->ConfigResponse(cid, p_cfg); 55 } 56 57 uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) { 58 return l2cap_interface->DataWrite(cid, p_data); 59 } 60