1 /*
2 * Copyright 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /*
18 * Generated mock file from original source file
19 * Functions generated:33
20 *
21 * mockcify.pl ver 0.2
22 */
23 #include "test/mock/mock_stack_l2cap_api.h"
24
25 // Original included files, if any
26
27 #include "test/common/mock_functions.h"
28
29 // Mocked compile conditionals, if any
30 // Mocked internal structures, if any
31
32 namespace test {
33 namespace mock {
34 namespace stack_l2cap_api {
35
36 // Function state capture and return values, if needed
37 struct l2c_get_transport_from_fixed_cid l2c_get_transport_from_fixed_cid;
38 struct L2CA_RegisterWithSecurity L2CA_RegisterWithSecurity;
39 struct L2CA_Register L2CA_Register;
40 struct L2CA_Deregister L2CA_Deregister;
41 struct L2CA_AllocateLePSM L2CA_AllocateLePSM;
42 struct L2CA_FreeLePSM L2CA_FreeLePSM;
43 struct L2CA_ConnectReqWithSecurity L2CA_ConnectReqWithSecurity;
44 struct L2CA_ConnectReq L2CA_ConnectReq;
45 struct L2CA_RegisterLECoc L2CA_RegisterLECoc;
46 struct L2CA_DeregisterLECoc L2CA_DeregisterLECoc;
47 struct L2CA_ConnectLECocReq L2CA_ConnectLECocReq;
48 struct L2CA_GetPeerLECocConfig L2CA_GetPeerLECocConfig;
49 struct L2CA_ConnectCreditBasedRsp L2CA_ConnectCreditBasedRsp;
50 struct L2CA_ConnectCreditBasedReq L2CA_ConnectCreditBasedReq;
51 struct L2CA_ReconfigCreditBasedConnsReq L2CA_ReconfigCreditBasedConnsReq;
52 struct L2CA_DisconnectReq L2CA_DisconnectReq;
53 struct L2CA_DisconnectLECocReq L2CA_DisconnectLECocReq;
54 struct L2CA_GetRemoteChannelId L2CA_GetRemoteChannelId;
55 struct L2CA_SetIdleTimeoutByBdAddr L2CA_SetIdleTimeoutByBdAddr;
56 struct L2CA_UseLatencyMode L2CA_UseLatencyMode;
57 struct L2CA_SetAclPriority L2CA_SetAclPriority;
58 struct L2CA_SetAclLatency L2CA_SetAclLatency;
59 struct L2CA_SetTxPriority L2CA_SetTxPriority;
60 struct L2CA_GetPeerFeatures L2CA_GetPeerFeatures;
61 struct L2CA_RegisterFixedChannel L2CA_RegisterFixedChannel;
62 struct L2CA_ConnectFixedChnl L2CA_ConnectFixedChnl;
63 struct L2CA_SendFixedChnlData L2CA_SendFixedChnlData;
64 struct L2CA_RemoveFixedChnl L2CA_RemoveFixedChnl;
65 struct L2CA_SetLeGattTimeout L2CA_SetLeGattTimeout;
66 struct L2CA_MarkLeLinkAsActive L2CA_MarkLeLinkAsActive;
67 struct L2CA_DataWrite L2CA_DataWrite;
68 struct L2CA_LECocDataWrite L2CA_LECocDataWrite;
69 struct L2CA_SetChnlFlushability L2CA_SetChnlFlushability;
70 struct L2CA_FlushChannel L2CA_FlushChannel;
71 struct L2CA_IsLinkEstablished L2CA_IsLinkEstablished;
72 struct L2CA_SetMediaStreamChannel L2CA_SetMediaStreamChannel;
73 struct L2CA_isMediaChannel L2CA_isMediaChannel;
74 struct L2CA_LeCreditDefault L2CA_LeCreditDefault;
75 struct L2CA_LeCreditThreshold L2CA_LeCreditThreshold;
76
77 } // namespace stack_l2cap_api
78 } // namespace mock
79 } // namespace test
80
81 // Mocked functions, if any
l2c_get_transport_from_fixed_cid(uint16_t fixed_cid)82 tBT_TRANSPORT l2c_get_transport_from_fixed_cid(uint16_t fixed_cid) {
83 inc_func_call_count(__func__);
84 return test::mock::stack_l2cap_api::l2c_get_transport_from_fixed_cid(
85 fixed_cid);
86 }
L2CA_RegisterWithSecurity(uint16_t psm,const tL2CAP_APPL_INFO & p_cb_info,bool enable_snoop,tL2CAP_ERTM_INFO * p_ertm_info,uint16_t my_mtu,uint16_t required_remote_mtu,uint16_t sec_level)87 uint16_t L2CA_RegisterWithSecurity(
88 uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop,
89 tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu,
90 uint16_t required_remote_mtu, uint16_t sec_level) {
91 inc_func_call_count(__func__);
92 return test::mock::stack_l2cap_api::L2CA_RegisterWithSecurity(
93 psm, p_cb_info, enable_snoop, p_ertm_info, my_mtu, required_remote_mtu,
94 sec_level);
95 }
L2CA_Register(uint16_t psm,const tL2CAP_APPL_INFO & p_cb_info,bool enable_snoop,tL2CAP_ERTM_INFO * p_ertm_info,uint16_t my_mtu,uint16_t required_remote_mtu,uint16_t sec_level)96 uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
97 bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
98 uint16_t my_mtu, uint16_t required_remote_mtu,
99 uint16_t sec_level) {
100 inc_func_call_count(__func__);
101 return test::mock::stack_l2cap_api::L2CA_Register(
102 psm, p_cb_info, enable_snoop, p_ertm_info, my_mtu, required_remote_mtu,
103 sec_level);
104 }
L2CA_Deregister(uint16_t psm)105 void L2CA_Deregister(uint16_t psm) {
106 inc_func_call_count(__func__);
107 test::mock::stack_l2cap_api::L2CA_Deregister(psm);
108 }
L2CA_AllocateLePSM(void)109 uint16_t L2CA_AllocateLePSM(void) {
110 inc_func_call_count(__func__);
111 return test::mock::stack_l2cap_api::L2CA_AllocateLePSM();
112 }
L2CA_FreeLePSM(uint16_t psm)113 void L2CA_FreeLePSM(uint16_t psm) {
114 inc_func_call_count(__func__);
115 test::mock::stack_l2cap_api::L2CA_FreeLePSM(psm);
116 }
L2CA_ConnectReqWithSecurity(uint16_t psm,const RawAddress & p_bd_addr,uint16_t sec_level)117 uint16_t L2CA_ConnectReqWithSecurity(uint16_t psm, const RawAddress& p_bd_addr,
118 uint16_t sec_level) {
119 inc_func_call_count(__func__);
120 return test::mock::stack_l2cap_api::L2CA_ConnectReqWithSecurity(
121 psm, p_bd_addr, sec_level);
122 }
L2CA_ConnectReq(uint16_t psm,const RawAddress & p_bd_addr)123 uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& p_bd_addr) {
124 inc_func_call_count(__func__);
125 return test::mock::stack_l2cap_api::L2CA_ConnectReq(psm, p_bd_addr);
126 }
L2CA_RegisterLECoc(uint16_t psm,const tL2CAP_APPL_INFO & p_cb_info,uint16_t sec_level,tL2CAP_LE_CFG_INFO cfg)127 uint16_t L2CA_RegisterLECoc(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
128 uint16_t sec_level, tL2CAP_LE_CFG_INFO cfg) {
129 inc_func_call_count(__func__);
130 return test::mock::stack_l2cap_api::L2CA_RegisterLECoc(psm, p_cb_info,
131 sec_level, cfg);
132 }
L2CA_DeregisterLECoc(uint16_t psm)133 void L2CA_DeregisterLECoc(uint16_t psm) {
134 inc_func_call_count(__func__);
135 test::mock::stack_l2cap_api::L2CA_DeregisterLECoc(psm);
136 }
L2CA_ConnectLECocReq(uint16_t psm,const RawAddress & p_bd_addr,tL2CAP_LE_CFG_INFO * p_cfg,uint16_t sec_level)137 uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr,
138 tL2CAP_LE_CFG_INFO* p_cfg, uint16_t sec_level) {
139 inc_func_call_count(__func__);
140 return test::mock::stack_l2cap_api::L2CA_ConnectLECocReq(psm, p_bd_addr,
141 p_cfg, sec_level);
142 }
L2CA_GetPeerLECocConfig(uint16_t lcid,tL2CAP_LE_CFG_INFO * peer_cfg)143 bool L2CA_GetPeerLECocConfig(uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg) {
144 inc_func_call_count(__func__);
145 return test::mock::stack_l2cap_api::L2CA_GetPeerLECocConfig(lcid, peer_cfg);
146 }
L2CA_ConnectCreditBasedRsp(const RawAddress & p_bd_addr,uint8_t id,std::vector<uint16_t> & accepted_lcids,uint16_t result,tL2CAP_LE_CFG_INFO * p_cfg)147 bool L2CA_ConnectCreditBasedRsp(const RawAddress& p_bd_addr, uint8_t id,
148 std::vector<uint16_t>& accepted_lcids,
149 uint16_t result, tL2CAP_LE_CFG_INFO* p_cfg) {
150 inc_func_call_count(__func__);
151 return test::mock::stack_l2cap_api::L2CA_ConnectCreditBasedRsp(
152 p_bd_addr, id, accepted_lcids, result, p_cfg);
153 }
L2CA_ConnectCreditBasedReq(uint16_t psm,const RawAddress & p_bd_addr,tL2CAP_LE_CFG_INFO * p_cfg)154 std::vector<uint16_t> L2CA_ConnectCreditBasedReq(uint16_t psm,
155 const RawAddress& p_bd_addr,
156 tL2CAP_LE_CFG_INFO* p_cfg) {
157 inc_func_call_count(__func__);
158 return test::mock::stack_l2cap_api::L2CA_ConnectCreditBasedReq(psm, p_bd_addr,
159 p_cfg);
160 }
L2CA_ReconfigCreditBasedConnsReq(const RawAddress & bda,std::vector<uint16_t> & lcids,tL2CAP_LE_CFG_INFO * p_cfg)161 bool L2CA_ReconfigCreditBasedConnsReq(const RawAddress& bda,
162 std::vector<uint16_t>& lcids,
163 tL2CAP_LE_CFG_INFO* p_cfg) {
164 inc_func_call_count(__func__);
165 return test::mock::stack_l2cap_api::L2CA_ReconfigCreditBasedConnsReq(
166 bda, lcids, p_cfg);
167 }
L2CA_DisconnectReq(uint16_t cid)168 bool L2CA_DisconnectReq(uint16_t cid) {
169 inc_func_call_count(__func__);
170 return test::mock::stack_l2cap_api::L2CA_DisconnectReq(cid);
171 }
L2CA_DisconnectLECocReq(uint16_t cid)172 bool L2CA_DisconnectLECocReq(uint16_t cid) {
173 inc_func_call_count(__func__);
174 return test::mock::stack_l2cap_api::L2CA_DisconnectLECocReq(cid);
175 }
L2CA_GetRemoteChannelId(uint16_t lcid,uint16_t * rcid)176 bool L2CA_GetRemoteChannelId(uint16_t lcid, uint16_t* rcid) {
177 inc_func_call_count(__func__);
178 return test::mock::stack_l2cap_api::L2CA_GetRemoteChannelId(lcid, rcid);
179 }
L2CA_SetIdleTimeoutByBdAddr(const RawAddress & bd_addr,uint16_t timeout,tBT_TRANSPORT transport)180 bool L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr, uint16_t timeout,
181 tBT_TRANSPORT transport) {
182 inc_func_call_count(__func__);
183 return test::mock::stack_l2cap_api::L2CA_SetIdleTimeoutByBdAddr(
184 bd_addr, timeout, transport);
185 }
L2CA_UseLatencyMode(const RawAddress & bd_addr,bool use_latency_mode)186 bool L2CA_UseLatencyMode(const RawAddress& bd_addr, bool use_latency_mode) {
187 inc_func_call_count(__func__);
188 return test::mock::stack_l2cap_api::L2CA_UseLatencyMode(bd_addr,
189 use_latency_mode);
190 }
L2CA_SetAclPriority(const RawAddress & bd_addr,tL2CAP_PRIORITY priority)191 bool L2CA_SetAclPriority(const RawAddress& bd_addr, tL2CAP_PRIORITY priority) {
192 inc_func_call_count(__func__);
193 return test::mock::stack_l2cap_api::L2CA_SetAclPriority(bd_addr, priority);
194 }
L2CA_SetAclLatency(const RawAddress & bd_addr,tL2CAP_LATENCY latency)195 bool L2CA_SetAclLatency(const RawAddress& bd_addr, tL2CAP_LATENCY latency) {
196 inc_func_call_count(__func__);
197 return test::mock::stack_l2cap_api::L2CA_SetAclLatency(bd_addr, latency);
198 }
L2CA_SetTxPriority(uint16_t cid,tL2CAP_CHNL_PRIORITY priority)199 bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) {
200 inc_func_call_count(__func__);
201 return test::mock::stack_l2cap_api::L2CA_SetTxPriority(cid, priority);
202 }
L2CA_GetPeerFeatures(const RawAddress & bd_addr,uint32_t * p_ext_feat,uint8_t * p_chnl_mask)203 bool L2CA_GetPeerFeatures(const RawAddress& bd_addr, uint32_t* p_ext_feat,
204 uint8_t* p_chnl_mask) {
205 inc_func_call_count(__func__);
206 return test::mock::stack_l2cap_api::L2CA_GetPeerFeatures(bd_addr, p_ext_feat,
207 p_chnl_mask);
208 }
L2CA_RegisterFixedChannel(uint16_t fixed_cid,tL2CAP_FIXED_CHNL_REG * p_freg)209 bool L2CA_RegisterFixedChannel(uint16_t fixed_cid,
210 tL2CAP_FIXED_CHNL_REG* p_freg) {
211 inc_func_call_count(__func__);
212 return test::mock::stack_l2cap_api::L2CA_RegisterFixedChannel(fixed_cid,
213 p_freg);
214 }
L2CA_ConnectFixedChnl(uint16_t fixed_cid,const RawAddress & rem_bda)215 bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
216 inc_func_call_count(__func__);
217 return test::mock::stack_l2cap_api::L2CA_ConnectFixedChnl(fixed_cid, rem_bda);
218 }
L2CA_SendFixedChnlData(uint16_t fixed_cid,const RawAddress & rem_bda,BT_HDR * p_buf)219 uint16_t L2CA_SendFixedChnlData(uint16_t fixed_cid, const RawAddress& rem_bda,
220 BT_HDR* p_buf) {
221 inc_func_call_count(__func__);
222 return test::mock::stack_l2cap_api::L2CA_SendFixedChnlData(fixed_cid, rem_bda,
223 p_buf);
224 }
L2CA_RemoveFixedChnl(uint16_t fixed_cid,const RawAddress & rem_bda)225 bool L2CA_RemoveFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda) {
226 inc_func_call_count(__func__);
227 return test::mock::stack_l2cap_api::L2CA_RemoveFixedChnl(fixed_cid, rem_bda);
228 }
L2CA_SetLeGattTimeout(const RawAddress & rem_bda,uint16_t idle_tout)229 bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda, uint16_t idle_tout) {
230 inc_func_call_count(__func__);
231 return test::mock::stack_l2cap_api::L2CA_SetLeGattTimeout(rem_bda, idle_tout);
232 }
L2CA_MarkLeLinkAsActive(const RawAddress & rem_bda)233 bool L2CA_MarkLeLinkAsActive(const RawAddress& rem_bda) {
234 inc_func_call_count(__func__);
235 return test::mock::stack_l2cap_api::L2CA_MarkLeLinkAsActive(rem_bda);
236 }
L2CA_DataWrite(uint16_t cid,BT_HDR * p_data)237 uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
238 inc_func_call_count(__func__);
239 return test::mock::stack_l2cap_api::L2CA_DataWrite(cid, p_data);
240 }
L2CA_LECocDataWrite(uint16_t cid,BT_HDR * p_data)241 uint8_t L2CA_LECocDataWrite(uint16_t cid, BT_HDR* p_data) {
242 inc_func_call_count(__func__);
243 return test::mock::stack_l2cap_api::L2CA_LECocDataWrite(cid, p_data);
244 }
L2CA_SetChnlFlushability(uint16_t cid,bool is_flushable)245 bool L2CA_SetChnlFlushability(uint16_t cid, bool is_flushable) {
246 inc_func_call_count(__func__);
247 return test::mock::stack_l2cap_api::L2CA_SetChnlFlushability(cid,
248 is_flushable);
249 }
L2CA_FlushChannel(uint16_t lcid,uint16_t num_to_flush)250 uint16_t L2CA_FlushChannel(uint16_t lcid, uint16_t num_to_flush) {
251 inc_func_call_count(__func__);
252 return test::mock::stack_l2cap_api::L2CA_FlushChannel(lcid, num_to_flush);
253 }
L2CA_IsLinkEstablished(const RawAddress & bd_addr,tBT_TRANSPORT transport)254 bool L2CA_IsLinkEstablished(const RawAddress& bd_addr,
255 tBT_TRANSPORT transport) {
256 inc_func_call_count(__func__);
257 return test::mock::stack_l2cap_api::L2CA_IsLinkEstablished(bd_addr,
258 transport);
259 }
L2CA_SetMediaStreamChannel(uint16_t local_media_cid,bool status)260 void L2CA_SetMediaStreamChannel(uint16_t local_media_cid, bool status) {
261 inc_func_call_count(__func__);
262 return test::mock::stack_l2cap_api::L2CA_SetMediaStreamChannel(
263 local_media_cid, status);
264 }
L2CA_isMediaChannel(uint16_t handle,uint16_t channel_id,bool is_local_cid)265 bool L2CA_isMediaChannel(uint16_t handle, uint16_t channel_id,
266 bool is_local_cid) {
267 inc_func_call_count(__func__);
268 return test::mock::stack_l2cap_api::L2CA_isMediaChannel(handle, channel_id,
269 is_local_cid);
270 }
L2CA_LeCreditDefault()271 uint16_t L2CA_LeCreditDefault() {
272 inc_func_call_count(__func__);
273 return test::mock::stack_l2cap_api::L2CA_LeCreditDefault();
274 }
L2CA_LeCreditThreshold()275 uint16_t L2CA_LeCreditThreshold() {
276 inc_func_call_count(__func__);
277 return test::mock::stack_l2cap_api::L2CA_LeCreditThreshold();
278 }
279
280 // END mockcify generation
281
L2CA_Dumpsys(int)282 void L2CA_Dumpsys(int /* fd */) { inc_func_call_count(__func__); }
283