1 /*
2  * Copyright 2022 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 #pragma once
17 
18 /*
19  * Generated mock file from original source file
20  *   Functions generated:26
21  *
22  *  mockcify.pl ver 0.5.0
23  */
24 
25 #include <cstdint>
26 #include <functional>
27 #include <string>
28 
29 // Original included files, if any
30 
31 #include <string>
32 
33 #include "stack/include/gatt_api.h"
34 #include "types/bluetooth/uuid.h"
35 #include "types/bt_transport.h"
36 #include "types/raw_address.h"
37 
38 // Original usings
39 using bluetooth::Uuid;
40 
41 // Mocked compile conditionals, if any
42 
43 namespace test {
44 namespace mock {
45 namespace stack_gatt_api {
46 
47 // Shared state between mocked functions and tests
48 // Name: GATTC_GetAndRemoveListOfConnIdsWaitingForMtuRequest
49 // Params: RawAddress& remote_bda
50 // Return: std::list<uint16_t>
51 struct GATTC_GetAndRemoveListOfConnIdsWaitingForMtuRequest {
52   static std::list<uint16_t> return_value;
53   std::function<std::list<uint16_t>(const RawAddress& remote_bda)> body{
54       [](const RawAddress& /* remote_bda */) { return return_value; }};
operatorGATTC_GetAndRemoveListOfConnIdsWaitingForMtuRequest55   std::list<uint16_t> operator()(const RawAddress& remote_bda) {
56     return body(remote_bda);
57   };
58 };
59 extern struct GATTC_GetAndRemoveListOfConnIdsWaitingForMtuRequest
60     GATTC_GetAndRemoveListOfConnIdsWaitingForMtuRequest;
61 
62 // Shared state between mocked functions and tests
63 // Name: GATTC_ConfigureMTU
64 // Params: RawAddress& remote_bda, tBT_TRANSPORT transport, uint16_t conn_id,
65 //         uint16_t *current_mtu
66 // Return: tGATTC_TryMtuRequestResult
67 struct GATTC_TryMtuRequest {
68   static tGATTC_TryMtuRequestResult return_value;
69   std::function<tGATTC_TryMtuRequestResult(
70       const RawAddress& remote_bda, tBT_TRANSPORT transport, uint16_t conn_id,
71       uint16_t* current_mtu)>
72       body{[](const RawAddress& /* remote_bda */, tBT_TRANSPORT /* transport */,
73               uint16_t /* conn_id */,
74               uint16_t* /* current_mtu */) { return return_value; }};
operatorGATTC_TryMtuRequest75   tGATTC_TryMtuRequestResult operator()(const RawAddress& remote_bda,
76                                         tBT_TRANSPORT transport,
77                                         uint16_t conn_id,
78                                         uint16_t* current_mtu) {
79     return body(remote_bda, transport, conn_id, current_mtu);
80   };
81 };
82 extern struct GATTC_TryMtuRequest GATTC_TryMtuRequest;
83 
84 // Shared state between mocked functions and tests
85 // Name: GATTC_ConfigureMTU
86 // Params: RawAddress& remote_bda, tBT_TRANSPORT transport,
87 //         uint16_t user_mtu
88 // Return: void
89 struct GATTC_UpdateUserAttMtuIfNeeded {
90   std::function<void(const RawAddress& remote_bda, tBT_TRANSPORT transport,
91                      uint16_t user_mtu)>
92       body{[](const RawAddress& /* remote_bda */, tBT_TRANSPORT /* transport */,
93               uint16_t /* user_mtu */) {}};
operatorGATTC_UpdateUserAttMtuIfNeeded94   void operator()(const RawAddress& remote_bda, tBT_TRANSPORT transport,
95                   uint16_t user_mtu) {
96     body(remote_bda, transport, user_mtu);
97   };
98 };
99 extern struct GATTC_UpdateUserAttMtuIfNeeded GATTC_UpdateUserAttMtuIfNeeded;
100 
101 // Shared state between mocked functions and tests
102 // Name: GATTC_ConfigureMTU
103 // Params: uint16_t conn_id, uint16_t mtu
104 // Return: tGATT_STATUS
105 struct GATTC_ConfigureMTU {
106   static tGATT_STATUS return_value;
107   std::function<tGATT_STATUS(uint16_t conn_id, uint16_t mtu)> body{
108       [](uint16_t /* conn_id */, uint16_t /* mtu */) { return return_value; }};
operatorGATTC_ConfigureMTU109   tGATT_STATUS operator()(uint16_t conn_id, uint16_t mtu) {
110     return body(conn_id, mtu);
111   };
112 };
113 extern struct GATTC_ConfigureMTU GATTC_ConfigureMTU;
114 
115 // Name: GATTC_Discover
116 // Params: uint16_t conn_id, tGATT_DISC_TYPE disc_type, uint16_t start_handle,
117 // uint16_t end_handle Return: tGATT_STATUS
118 struct GATTC_Discover {
119   static tGATT_STATUS return_value;
120   std::function<tGATT_STATUS(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
121                              uint16_t start_handle, uint16_t end_handle)>
122       body{[](uint16_t /* conn_id */, tGATT_DISC_TYPE /* disc_type */,
123               uint16_t /* start_handle */,
124               uint16_t /* end_handle */) { return return_value; }};
operatorGATTC_Discover125   tGATT_STATUS operator()(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
126                           uint16_t start_handle, uint16_t end_handle) {
127     return body(conn_id, disc_type, start_handle, end_handle);
128   };
129 };
130 extern struct GATTC_Discover GATTC_Discover;
131 
132 // Name: GATTC_ExecuteWrite
133 // Params: uint16_t conn_id, bool is_execute
134 // Return: tGATT_STATUS
135 struct GATTC_ExecuteWrite {
136   static tGATT_STATUS return_value;
137   std::function<tGATT_STATUS(uint16_t conn_id, bool is_execute)> body{
138       [](uint16_t /* conn_id */, bool /* is_execute */) {
139         return return_value;
140       }};
operatorGATTC_ExecuteWrite141   tGATT_STATUS operator()(uint16_t conn_id, bool is_execute) {
142     return body(conn_id, is_execute);
143   };
144 };
145 extern struct GATTC_ExecuteWrite GATTC_ExecuteWrite;
146 
147 // Name: GATTC_Read
148 // Params: uint16_t conn_id, tGATT_READ_TYPE type, tGATT_READ_PARAM* p_read
149 // Return: tGATT_STATUS
150 struct GATTC_Read {
151   static tGATT_STATUS return_value;
152   std::function<tGATT_STATUS(uint16_t conn_id, tGATT_READ_TYPE type,
153                              tGATT_READ_PARAM* p_read)>
154       body{[](uint16_t /* conn_id */, tGATT_READ_TYPE /* type */,
155               tGATT_READ_PARAM* /* p_read */) { return return_value; }};
operatorGATTC_Read156   tGATT_STATUS operator()(uint16_t conn_id, tGATT_READ_TYPE type,
157                           tGATT_READ_PARAM* p_read) {
158     return body(conn_id, type, p_read);
159   };
160 };
161 extern struct GATTC_Read GATTC_Read;
162 
163 // Name: GATTC_SendHandleValueConfirm
164 // Params: uint16_t conn_id, uint16_t cid
165 // Return: tGATT_STATUS
166 struct GATTC_SendHandleValueConfirm {
167   static tGATT_STATUS return_value;
168   std::function<tGATT_STATUS(uint16_t conn_id, uint16_t cid)> body{
169       [](uint16_t /* conn_id */, uint16_t /* cid */) { return return_value; }};
operatorGATTC_SendHandleValueConfirm170   tGATT_STATUS operator()(uint16_t conn_id, uint16_t cid) {
171     return body(conn_id, cid);
172   };
173 };
174 extern struct GATTC_SendHandleValueConfirm GATTC_SendHandleValueConfirm;
175 
176 // Name: GATTC_Write
177 // Params: uint16_t conn_id, tGATT_WRITE_TYPE type, tGATT_VALUE* p_write
178 // Return: tGATT_STATUS
179 struct GATTC_Write {
180   static tGATT_STATUS return_value;
181   std::function<tGATT_STATUS(uint16_t conn_id, tGATT_WRITE_TYPE type,
182                              tGATT_VALUE* p_write)>
183       body{[](uint16_t /* conn_id */, tGATT_WRITE_TYPE /* type */,
184               tGATT_VALUE* /* p_write */) { return return_value; }};
operatorGATTC_Write185   tGATT_STATUS operator()(uint16_t conn_id, tGATT_WRITE_TYPE type,
186                           tGATT_VALUE* p_write) {
187     return body(conn_id, type, p_write);
188   };
189 };
190 extern struct GATTC_Write GATTC_Write;
191 
192 // Name: GATTS_AddService
193 // Params: tGATT_IF gatt_if, btgatt_db_element_t* service, int count
194 // Return: tGATT_STATUS
195 struct GATTS_AddService {
196   static tGATT_STATUS return_value;
197   std::function<tGATT_STATUS(tGATT_IF gatt_if, btgatt_db_element_t* service,
198                              int count)>
199       body{[](tGATT_IF /* gatt_if */, btgatt_db_element_t* /* service */,
200               int /* count */) { return return_value; }};
operatorGATTS_AddService201   tGATT_STATUS operator()(tGATT_IF gatt_if, btgatt_db_element_t* service,
202                           int count) {
203     return body(gatt_if, service, count);
204   };
205 };
206 extern struct GATTS_AddService GATTS_AddService;
207 
208 // Name: GATTS_DeleteService
209 // Params: tGATT_IF gatt_if, Uuid* p_svc_uuid, uint16_t svc_inst
210 // Return: bool
211 struct GATTS_DeleteService {
212   static bool return_value;
213   std::function<bool(tGATT_IF gatt_if, Uuid* p_svc_uuid, uint16_t svc_inst)>
214       body{[](tGATT_IF /* gatt_if */, Uuid* /* p_svc_uuid */,
215               uint16_t /* svc_inst */) { return return_value; }};
operatorGATTS_DeleteService216   bool operator()(tGATT_IF gatt_if, Uuid* p_svc_uuid, uint16_t svc_inst) {
217     return body(gatt_if, p_svc_uuid, svc_inst);
218   };
219 };
220 extern struct GATTS_DeleteService GATTS_DeleteService;
221 
222 // Name: GATTS_HandleValueIndication
223 // Params: uint16_t conn_id, uint16_t attr_handle, uint16_t val_len, uint8_t*
224 // p_val Return: tGATT_STATUS
225 struct GATTS_HandleValueIndication {
226   static tGATT_STATUS return_value;
227   std::function<tGATT_STATUS(uint16_t conn_id, uint16_t attr_handle,
228                              uint16_t val_len, uint8_t* p_val)>
229       body{[](uint16_t /* conn_id */, uint16_t /* attr_handle */,
230               uint16_t /* val_len */,
231               uint8_t* /* p_val */) { return return_value; }};
operatorGATTS_HandleValueIndication232   tGATT_STATUS operator()(uint16_t conn_id, uint16_t attr_handle,
233                           uint16_t val_len, uint8_t* p_val) {
234     return body(conn_id, attr_handle, val_len, p_val);
235   };
236 };
237 extern struct GATTS_HandleValueIndication GATTS_HandleValueIndication;
238 
239 // Name: GATTS_HandleValueNotification
240 // Params: uint16_t conn_id, uint16_t attr_handle, uint16_t val_len, uint8_t*
241 // p_val Return: tGATT_STATUS
242 struct GATTS_HandleValueNotification {
243   static tGATT_STATUS return_value;
244   std::function<tGATT_STATUS(uint16_t conn_id, uint16_t attr_handle,
245                              uint16_t val_len, uint8_t* p_val)>
246       body{[](uint16_t /* conn_id */, uint16_t /* attr_handle */,
247               uint16_t /* val_len */,
248               uint8_t* /* p_val */) { return return_value; }};
operatorGATTS_HandleValueNotification249   tGATT_STATUS operator()(uint16_t conn_id, uint16_t attr_handle,
250                           uint16_t val_len, uint8_t* p_val) {
251     return body(conn_id, attr_handle, val_len, p_val);
252   };
253 };
254 extern struct GATTS_HandleValueNotification GATTS_HandleValueNotification;
255 
256 // Name: GATTS_NVRegister
257 // Params: tGATT_APPL_INFO* p_cb_info
258 // Return: bool
259 struct GATTS_NVRegister {
260   static bool return_value;
261   std::function<bool(tGATT_APPL_INFO* p_cb_info)> body{
262       [](tGATT_APPL_INFO* /* p_cb_info */) { return return_value; }};
operatorGATTS_NVRegister263   bool operator()(tGATT_APPL_INFO* p_cb_info) { return body(p_cb_info); };
264 };
265 extern struct GATTS_NVRegister GATTS_NVRegister;
266 
267 // Name: GATTS_SendRsp
268 // Params: uint16_t conn_id, uint32_t trans_id, tGATT_STATUS status, tGATTS_RSP*
269 // p_msg Return: tGATT_STATUS
270 struct GATTS_SendRsp {
271   static tGATT_STATUS return_value;
272   std::function<tGATT_STATUS(uint16_t conn_id, uint32_t trans_id,
273                              tGATT_STATUS status, tGATTS_RSP* p_msg)>
274       body{[](uint16_t /* conn_id */, uint32_t /* trans_id */,
275               tGATT_STATUS /* status */,
276               tGATTS_RSP* /* p_msg */) { return return_value; }};
operatorGATTS_SendRsp277   tGATT_STATUS operator()(uint16_t conn_id, uint32_t trans_id,
278                           tGATT_STATUS status, tGATTS_RSP* p_msg) {
279     return body(conn_id, trans_id, status, p_msg);
280   };
281 };
282 extern struct GATTS_SendRsp GATTS_SendRsp;
283 
284 // Name: GATTS_StopService
285 // Params: uint16_t service_handle
286 // Return: void
287 struct GATTS_StopService {
288   std::function<void(uint16_t service_handle)> body{
289       [](uint16_t /* service_handle */) {}};
operatorGATTS_StopService290   void operator()(uint16_t service_handle) { body(service_handle); };
291 };
292 extern struct GATTS_StopService GATTS_StopService;
293 
294 // Name: GATT_CancelConnect
295 // Params: tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct
296 // Return: bool
297 struct GATT_CancelConnect {
298   static bool return_value;
299   std::function<bool(tGATT_IF gatt_if, const RawAddress& bd_addr,
300                      bool is_direct)>
301       body{[](tGATT_IF /* gatt_if */, const RawAddress& /* bd_addr */,
302               bool /* is_direct */) { return return_value; }};
operatorGATT_CancelConnect303   bool operator()(tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct) {
304     return body(gatt_if, bd_addr, is_direct);
305   };
306 };
307 extern struct GATT_CancelConnect GATT_CancelConnect;
308 
309 // Name: GATT_Connect
310 // Params: tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct,
311 // tBT_TRANSPORT transport, bool opportunistic, uint8_t initiating_phys Return:
312 // bool
313 struct GATT_Connect {
314   static bool return_value;
315   std::function<bool(tGATT_IF gatt_if, const RawAddress& bd_addr,
316                      tBLE_ADDR_TYPE addr_type, bool is_direct,
317                      tBT_TRANSPORT transport, bool opportunistic,
318                      uint8_t initiating_phys)>
319       body{[](tGATT_IF /* gatt_if */, const RawAddress& /* bd_addr */,
320               tBLE_ADDR_TYPE /* addr_type */, bool /* is_direct */,
321               tBT_TRANSPORT /* transport */, bool /* opportunistic */,
322               uint8_t /* initiating_phys */) { return return_value; }};
operatorGATT_Connect323   bool operator()(tGATT_IF gatt_if, const RawAddress& bd_addr,
324                   tBLE_ADDR_TYPE addr_type, bool is_direct,
325                   tBT_TRANSPORT transport, bool opportunistic,
326                   uint8_t initiating_phys) {
327     return body(gatt_if, bd_addr, addr_type, is_direct, transport,
328                 opportunistic, initiating_phys);
329   };
330 };
331 extern struct GATT_Connect GATT_Connect;
332 
333 // Name: GATT_Deregister
334 // Params: tGATT_IF gatt_if
335 // Return: void
336 struct GATT_Deregister {
337   std::function<void(tGATT_IF gatt_if)> body{[](tGATT_IF /* gatt_if */) {}};
operatorGATT_Deregister338   void operator()(tGATT_IF gatt_if) { body(gatt_if); };
339 };
340 extern struct GATT_Deregister GATT_Deregister;
341 
342 // Name: GATT_Disconnect
343 // Params: uint16_t conn_id
344 // Return: tGATT_STATUS
345 struct GATT_Disconnect {
346   static tGATT_STATUS return_value;
347   std::function<tGATT_STATUS(uint16_t conn_id)> body{
348       [](uint16_t /* conn_id */) { return return_value; }};
operatorGATT_Disconnect349   tGATT_STATUS operator()(uint16_t conn_id) { return body(conn_id); };
350 };
351 extern struct GATT_Disconnect GATT_Disconnect;
352 
353 // Name: GATT_GetConnIdIfConnected
354 // Params: tGATT_IF gatt_if, const RawAddress& bd_addr, uint16_t* p_conn_id,
355 // tBT_TRANSPORT transport Return: bool
356 struct GATT_GetConnIdIfConnected {
357   static bool return_value;
358   std::function<bool(tGATT_IF gatt_if, const RawAddress& bd_addr,
359                      uint16_t* p_conn_id, tBT_TRANSPORT transport)>
360       body{[](tGATT_IF /* gatt_if */, const RawAddress& /* bd_addr */,
361               uint16_t* /* p_conn_id */,
362               tBT_TRANSPORT /* transport */) { return return_value; }};
operatorGATT_GetConnIdIfConnected363   bool operator()(tGATT_IF gatt_if, const RawAddress& bd_addr,
364                   uint16_t* p_conn_id, tBT_TRANSPORT transport) {
365     return body(gatt_if, bd_addr, p_conn_id, transport);
366   };
367 };
368 extern struct GATT_GetConnIdIfConnected GATT_GetConnIdIfConnected;
369 
370 // Name: GATT_GetConnectionInfor
371 // Params: uint16_t conn_id, tGATT_IF* p_gatt_if, RawAddress& bd_addr,
372 // tBT_TRANSPORT* p_transport Return: bool
373 struct GATT_GetConnectionInfor {
374   static bool return_value;
375   std::function<bool(uint16_t conn_id, tGATT_IF* p_gatt_if, RawAddress& bd_addr,
376                      tBT_TRANSPORT* p_transport)>
377       body{[](uint16_t /* conn_id */, tGATT_IF* /* p_gatt_if */,
378               RawAddress& /* bd_addr */,
379               tBT_TRANSPORT* /* p_transport */) { return return_value; }};
operatorGATT_GetConnectionInfor380   bool operator()(uint16_t conn_id, tGATT_IF* p_gatt_if, RawAddress& bd_addr,
381                   tBT_TRANSPORT* p_transport) {
382     return body(conn_id, p_gatt_if, bd_addr, p_transport);
383   };
384 };
385 extern struct GATT_GetConnectionInfor GATT_GetConnectionInfor;
386 
387 // Name: GATT_Register
388 // Params: const Uuid& app_uuid128, std::string name, tGATT_CBACK* p_cb_info,
389 // bool eatt_support Return: tGATT_IF
390 struct GATT_Register {
391   static tGATT_IF return_value;
392   std::function<tGATT_IF(const Uuid& app_uuid128, const std::string& name,
393                          tGATT_CBACK* p_cb_info, bool eatt_support)>
394       body{[](const Uuid& /* app_uuid128 */, const std::string& /* name */,
395               tGATT_CBACK* /* p_cb_info */,
396               bool /* eatt_support */) { return return_value; }};
operatorGATT_Register397   tGATT_IF operator()(const Uuid& app_uuid128, const std::string& name,
398                       tGATT_CBACK* p_cb_info, bool eatt_support) {
399     return body(app_uuid128, name, p_cb_info, eatt_support);
400   };
401 };
402 extern struct GATT_Register GATT_Register;
403 
404 // Name: GATT_SetIdleTimeout
405 // Params: const RawAddress& bd_addr, uint16_t idle_tout, tBT_TRANSPORT
406 // transport Return: void
407 struct GATT_SetIdleTimeout {
408   std::function<void(const RawAddress& bd_addr, uint16_t idle_tout,
409                      tBT_TRANSPORT transport, bool is_active)>
410       body{[](const RawAddress& /* bd_addr */, uint16_t /* idle_tout */,
411               tBT_TRANSPORT /* transport */, bool /* is_active */) {}};
operatorGATT_SetIdleTimeout412   void operator()(const RawAddress& bd_addr, uint16_t idle_tout,
413                   tBT_TRANSPORT transport, bool is_active) {
414     body(bd_addr, idle_tout, transport, is_active);
415   };
416 };
417 extern struct GATT_SetIdleTimeout GATT_SetIdleTimeout;
418 
419 // Name: GATT_StartIf
420 // Params: tGATT_IF gatt_if
421 // Return: void
422 struct GATT_StartIf {
423   std::function<void(tGATT_IF gatt_if)> body{[](tGATT_IF /* gatt_if */) {}};
operatorGATT_StartIf424   void operator()(tGATT_IF gatt_if) { body(gatt_if); };
425 };
426 extern struct GATT_StartIf GATT_StartIf;
427 
428 // // Name: gatt_add_an_item_to_list
429 // // Params: uint16_t s_handle
430 // // Return: tGATT_HDL_LIST_ELEM&
431 // struct gatt_add_an_item_to_list {
432 //   static tGATT_HDL_LIST_ELEM return_value;
433 //   std::function<tGATT_HDL_LIST_ELEM&(uint16_t s_handle)> body{
434 //       [](uint16_t s_handle) { return return_value; }};
435 //   tGATT_HDL_LIST_ELEM& operator()(uint16_t s_handle) { return body(s_handle);
436 //   };
437 // };
438 // extern struct gatt_add_an_item_to_list gatt_add_an_item_to_list;
439 
440 // Name: is_active_service
441 // Params: const Uuid& app_uuid128, Uuid* p_svc_uuid, uint16_t start_handle
442 // Return: bool
443 struct is_active_service {
444   static bool return_value;
445   std::function<bool(const Uuid& app_uuid128, Uuid* p_svc_uuid,
446                      uint16_t start_handle)>
447       body{[](const Uuid& /* app_uuid128 */, Uuid* /* p_svc_uuid */,
448               uint16_t /* start_handle */) { return return_value; }};
operatoris_active_service449   bool operator()(const Uuid& app_uuid128, Uuid* p_svc_uuid,
450                   uint16_t start_handle) {
451     return body(app_uuid128, p_svc_uuid, start_handle);
452   };
453 };
454 extern struct is_active_service is_active_service;
455 
456 }  // namespace stack_gatt_api
457 }  // namespace mock
458 }  // namespace test
459 
460 // END mockcify generation
461