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) { return body(remote_bda); }
56 };
57 extern struct GATTC_GetAndRemoveListOfConnIdsWaitingForMtuRequest
58         GATTC_GetAndRemoveListOfConnIdsWaitingForMtuRequest;
59 
60 // Shared state between mocked functions and tests
61 // Name: GATTC_ConfigureMTU
62 // Params: RawAddress& remote_bda, tBT_TRANSPORT transport, uint16_t conn_id,
63 //         uint16_t *current_mtu
64 // Return: tGATTC_TryMtuRequestResult
65 struct GATTC_TryMtuRequest {
66   static tGATTC_TryMtuRequestResult return_value;
67   std::function<tGATTC_TryMtuRequestResult(const RawAddress& remote_bda, tBT_TRANSPORT transport,
68                                            uint16_t conn_id, uint16_t* current_mtu)>
69           body{[](const RawAddress& /* remote_bda */, tBT_TRANSPORT /* transport */,
70                   uint16_t /* conn_id */, uint16_t* /* current_mtu */) { return return_value; }};
operatorGATTC_TryMtuRequest71   tGATTC_TryMtuRequestResult operator()(const RawAddress& remote_bda, tBT_TRANSPORT transport,
72                                         uint16_t conn_id, uint16_t* current_mtu) {
73     return body(remote_bda, transport, conn_id, current_mtu);
74   }
75 };
76 extern struct GATTC_TryMtuRequest GATTC_TryMtuRequest;
77 
78 // Shared state between mocked functions and tests
79 // Name: GATTC_ConfigureMTU
80 // Params: RawAddress& remote_bda, tBT_TRANSPORT transport,
81 //         uint16_t user_mtu
82 // Return: void
83 struct GATTC_UpdateUserAttMtuIfNeeded {
84   std::function<void(const RawAddress& remote_bda, tBT_TRANSPORT transport, uint16_t user_mtu)>
85           body{[](const RawAddress& /* remote_bda */, tBT_TRANSPORT /* transport */,
86                   uint16_t /* user_mtu */) {}};
operatorGATTC_UpdateUserAttMtuIfNeeded87   void operator()(const RawAddress& remote_bda, tBT_TRANSPORT transport, uint16_t user_mtu) {
88     body(remote_bda, transport, user_mtu);
89   }
90 };
91 extern struct GATTC_UpdateUserAttMtuIfNeeded GATTC_UpdateUserAttMtuIfNeeded;
92 
93 // Shared state between mocked functions and tests
94 // Name: GATTC_ConfigureMTU
95 // Params: uint16_t conn_id, uint16_t mtu
96 // Return: tGATT_STATUS
97 struct GATTC_ConfigureMTU {
98   static tGATT_STATUS return_value;
99   std::function<tGATT_STATUS(uint16_t conn_id, uint16_t mtu)> body{
100           [](uint16_t /* conn_id */, uint16_t /* mtu */) { return return_value; }};
operatorGATTC_ConfigureMTU101   tGATT_STATUS operator()(uint16_t conn_id, uint16_t mtu) { return body(conn_id, mtu); }
102 };
103 extern struct GATTC_ConfigureMTU GATTC_ConfigureMTU;
104 
105 // Name: GATTC_Discover
106 // Params: uint16_t conn_id, tGATT_DISC_TYPE disc_type, uint16_t start_handle,
107 // uint16_t end_handle Return: tGATT_STATUS
108 struct GATTC_Discover {
109   static tGATT_STATUS return_value;
110   std::function<tGATT_STATUS(uint16_t conn_id, tGATT_DISC_TYPE disc_type, uint16_t start_handle,
111                              uint16_t end_handle)>
112           body{[](uint16_t /* conn_id */, tGATT_DISC_TYPE /* disc_type */,
113                   uint16_t /* start_handle */, uint16_t /* end_handle */) { return return_value; }};
operatorGATTC_Discover114   tGATT_STATUS operator()(uint16_t conn_id, tGATT_DISC_TYPE disc_type, uint16_t start_handle,
115                           uint16_t end_handle) {
116     return body(conn_id, disc_type, start_handle, end_handle);
117   }
118 };
119 extern struct GATTC_Discover GATTC_Discover;
120 
121 // Name: GATTC_ExecuteWrite
122 // Params: uint16_t conn_id, bool is_execute
123 // Return: tGATT_STATUS
124 struct GATTC_ExecuteWrite {
125   static tGATT_STATUS return_value;
126   std::function<tGATT_STATUS(uint16_t conn_id, bool is_execute)> body{
127           [](uint16_t /* conn_id */, bool /* is_execute */) { return return_value; }};
operatorGATTC_ExecuteWrite128   tGATT_STATUS operator()(uint16_t conn_id, bool is_execute) { return body(conn_id, is_execute); }
129 };
130 extern struct GATTC_ExecuteWrite GATTC_ExecuteWrite;
131 
132 // Name: GATTC_Read
133 // Params: uint16_t conn_id, tGATT_READ_TYPE type, tGATT_READ_PARAM* p_read
134 // Return: tGATT_STATUS
135 struct GATTC_Read {
136   static tGATT_STATUS return_value;
137   std::function<tGATT_STATUS(uint16_t conn_id, tGATT_READ_TYPE type, tGATT_READ_PARAM* p_read)>
138           body{[](uint16_t /* conn_id */, tGATT_READ_TYPE /* type */,
139                   tGATT_READ_PARAM* /* p_read */) { return return_value; }};
operatorGATTC_Read140   tGATT_STATUS operator()(uint16_t conn_id, tGATT_READ_TYPE type, tGATT_READ_PARAM* p_read) {
141     return body(conn_id, type, p_read);
142   }
143 };
144 extern struct GATTC_Read GATTC_Read;
145 
146 // Name: GATTC_SendHandleValueConfirm
147 // Params: uint16_t conn_id, uint16_t cid
148 // Return: tGATT_STATUS
149 struct GATTC_SendHandleValueConfirm {
150   static tGATT_STATUS return_value;
151   std::function<tGATT_STATUS(uint16_t conn_id, uint16_t cid)> body{
152           [](uint16_t /* conn_id */, uint16_t /* cid */) { return return_value; }};
operatorGATTC_SendHandleValueConfirm153   tGATT_STATUS operator()(uint16_t conn_id, uint16_t cid) { return body(conn_id, cid); }
154 };
155 extern struct GATTC_SendHandleValueConfirm GATTC_SendHandleValueConfirm;
156 
157 // Name: GATTC_Write
158 // Params: uint16_t conn_id, tGATT_WRITE_TYPE type, tGATT_VALUE* p_write
159 // Return: tGATT_STATUS
160 struct GATTC_Write {
161   static tGATT_STATUS return_value;
162   std::function<tGATT_STATUS(uint16_t conn_id, tGATT_WRITE_TYPE type, tGATT_VALUE* p_write)> body{
163           [](uint16_t /* conn_id */, tGATT_WRITE_TYPE /* type */, tGATT_VALUE* /* p_write */) {
164             return return_value;
165           }};
operatorGATTC_Write166   tGATT_STATUS operator()(uint16_t conn_id, tGATT_WRITE_TYPE type, tGATT_VALUE* p_write) {
167     return body(conn_id, type, p_write);
168   }
169 };
170 extern struct GATTC_Write GATTC_Write;
171 
172 // Name: GATTS_AddService
173 // Params: tGATT_IF gatt_if, btgatt_db_element_t* service, int count
174 // Return: tGATT_STATUS
175 struct GATTS_AddService {
176   static tGATT_STATUS return_value;
177   std::function<tGATT_STATUS(tGATT_IF gatt_if, btgatt_db_element_t* service, int count)> body{
178           [](tGATT_IF /* gatt_if */, btgatt_db_element_t* /* service */, int /* count */) {
179             return return_value;
180           }};
operatorGATTS_AddService181   tGATT_STATUS operator()(tGATT_IF gatt_if, btgatt_db_element_t* service, int count) {
182     return body(gatt_if, service, count);
183   }
184 };
185 extern struct GATTS_AddService GATTS_AddService;
186 
187 // Name: GATTS_DeleteService
188 // Params: tGATT_IF gatt_if, Uuid* p_svc_uuid, uint16_t svc_inst
189 // Return: bool
190 struct GATTS_DeleteService {
191   static bool return_value;
192   std::function<bool(tGATT_IF gatt_if, Uuid* p_svc_uuid, uint16_t svc_inst)> body{
193           [](tGATT_IF /* gatt_if */, Uuid* /* p_svc_uuid */, uint16_t /* svc_inst */) {
194             return return_value;
195           }};
operatorGATTS_DeleteService196   bool operator()(tGATT_IF gatt_if, Uuid* p_svc_uuid, uint16_t svc_inst) {
197     return body(gatt_if, p_svc_uuid, svc_inst);
198   }
199 };
200 extern struct GATTS_DeleteService GATTS_DeleteService;
201 
202 // Name: GATTS_HandleValueIndication
203 // Params: uint16_t conn_id, uint16_t attr_handle, uint16_t val_len, uint8_t*
204 // p_val Return: tGATT_STATUS
205 struct GATTS_HandleValueIndication {
206   static tGATT_STATUS return_value;
207   std::function<tGATT_STATUS(uint16_t conn_id, uint16_t attr_handle, uint16_t val_len,
208                              uint8_t* p_val)>
209           body{[](uint16_t /* conn_id */, uint16_t /* attr_handle */, uint16_t /* val_len */,
210                   uint8_t* /* p_val */) { return return_value; }};
operatorGATTS_HandleValueIndication211   tGATT_STATUS operator()(uint16_t conn_id, uint16_t attr_handle, uint16_t val_len,
212                           uint8_t* p_val) {
213     return body(conn_id, attr_handle, val_len, p_val);
214   }
215 };
216 extern struct GATTS_HandleValueIndication GATTS_HandleValueIndication;
217 
218 // Name: GATTS_HandleValueNotification
219 // Params: uint16_t conn_id, uint16_t attr_handle, uint16_t val_len, uint8_t*
220 // p_val Return: tGATT_STATUS
221 struct GATTS_HandleValueNotification {
222   static tGATT_STATUS return_value;
223   std::function<tGATT_STATUS(uint16_t conn_id, uint16_t attr_handle, uint16_t val_len,
224                              uint8_t* p_val)>
225           body{[](uint16_t /* conn_id */, uint16_t /* attr_handle */, uint16_t /* val_len */,
226                   uint8_t* /* p_val */) { return return_value; }};
operatorGATTS_HandleValueNotification227   tGATT_STATUS operator()(uint16_t conn_id, uint16_t attr_handle, uint16_t val_len,
228                           uint8_t* p_val) {
229     return body(conn_id, attr_handle, val_len, p_val);
230   }
231 };
232 extern struct GATTS_HandleValueNotification GATTS_HandleValueNotification;
233 
234 // Name: GATTS_NVRegister
235 // Params: tGATT_APPL_INFO* p_cb_info
236 // Return: bool
237 struct GATTS_NVRegister {
238   static bool return_value;
239   std::function<bool(tGATT_APPL_INFO* p_cb_info)> body{
240           [](tGATT_APPL_INFO* /* p_cb_info */) { return return_value; }};
operatorGATTS_NVRegister241   bool operator()(tGATT_APPL_INFO* p_cb_info) { return body(p_cb_info); }
242 };
243 extern struct GATTS_NVRegister GATTS_NVRegister;
244 
245 // Name: GATTS_SendRsp
246 // Params: uint16_t conn_id, uint32_t trans_id, tGATT_STATUS status, tGATTS_RSP*
247 // p_msg Return: tGATT_STATUS
248 struct GATTS_SendRsp {
249   static tGATT_STATUS return_value;
250   std::function<tGATT_STATUS(uint16_t conn_id, uint32_t trans_id, tGATT_STATUS status,
251                              tGATTS_RSP* p_msg)>
252           body{[](uint16_t /* conn_id */, uint32_t /* trans_id */, tGATT_STATUS /* status */,
253                   tGATTS_RSP* /* p_msg */) { return return_value; }};
operatorGATTS_SendRsp254   tGATT_STATUS operator()(uint16_t conn_id, uint32_t trans_id, tGATT_STATUS status,
255                           tGATTS_RSP* p_msg) {
256     return body(conn_id, trans_id, status, p_msg);
257   }
258 };
259 extern struct GATTS_SendRsp GATTS_SendRsp;
260 
261 // Name: GATTS_StopService
262 // Params: uint16_t service_handle
263 // Return: void
264 struct GATTS_StopService {
265   std::function<void(uint16_t service_handle)> body{[](uint16_t /* service_handle */) {}};
operatorGATTS_StopService266   void operator()(uint16_t service_handle) { body(service_handle); }
267 };
268 extern struct GATTS_StopService GATTS_StopService;
269 
270 // Name: GATT_CancelConnect
271 // Params: tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct
272 // Return: bool
273 struct GATT_CancelConnect {
274   static bool return_value;
275   std::function<bool(tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct)> body{
276           [](tGATT_IF /* gatt_if */, const RawAddress& /* bd_addr */, bool /* is_direct */) {
277             return return_value;
278           }};
operatorGATT_CancelConnect279   bool operator()(tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct) {
280     return body(gatt_if, bd_addr, is_direct);
281   }
282 };
283 extern struct GATT_CancelConnect GATT_CancelConnect;
284 
285 // Name: GATT_Connect
286 // Params: tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct,
287 // tBT_TRANSPORT transport, bool opportunistic, uint8_t initiating_phys, uint16_t preferred_mtu
288 // Return: bool
289 struct GATT_Connect {
290   static bool return_value;
291   std::function<bool(tGATT_IF gatt_if, const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
292                      bool is_direct, tBT_TRANSPORT transport, bool opportunistic,
293                      uint8_t initiating_phys, uint16_t preferred_mtu)>
294           body{[](tGATT_IF /* gatt_if */, const RawAddress& /* bd_addr */,
295                   tBLE_ADDR_TYPE /* addr_type */, bool /* is_direct */,
296                   tBT_TRANSPORT /* transport */, bool /* opportunistic */,
297                   uint8_t /* initiating_phys */,
298                   uint16_t /* preferred_mtu */) { return return_value; }};
operatorGATT_Connect299   bool operator()(tGATT_IF gatt_if, const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
300                   bool is_direct, tBT_TRANSPORT transport, bool opportunistic,
301                   uint8_t initiating_phys, uint16_t preferred_mtu) {
302     return body(gatt_if, bd_addr, addr_type, is_direct, transport, opportunistic, initiating_phys,
303                 preferred_mtu);
304   }
305 };
306 extern struct GATT_Connect GATT_Connect;
307 
308 // Name: GATT_Deregister
309 // Params: tGATT_IF gatt_if
310 // Return: void
311 struct GATT_Deregister {
312   std::function<void(tGATT_IF gatt_if)> body{[](tGATT_IF /* gatt_if */) {}};
operatorGATT_Deregister313   void operator()(tGATT_IF gatt_if) { body(gatt_if); }
314 };
315 extern struct GATT_Deregister GATT_Deregister;
316 
317 // Name: GATT_Disconnect
318 // Params: uint16_t conn_id
319 // Return: tGATT_STATUS
320 struct GATT_Disconnect {
321   static tGATT_STATUS return_value;
322   std::function<tGATT_STATUS(uint16_t conn_id)> body{
323           [](uint16_t /* conn_id */) { return return_value; }};
operatorGATT_Disconnect324   tGATT_STATUS operator()(uint16_t conn_id) { return body(conn_id); }
325 };
326 extern struct GATT_Disconnect GATT_Disconnect;
327 
328 // Name: GATT_GetConnIdIfConnected
329 // Params: tGATT_IF gatt_if, const RawAddress& bd_addr, uint16_t* p_conn_id,
330 // tBT_TRANSPORT transport Return: bool
331 struct GATT_GetConnIdIfConnected {
332   static bool return_value;
333   std::function<bool(tGATT_IF gatt_if, const RawAddress& bd_addr, uint16_t* p_conn_id,
334                      tBT_TRANSPORT transport)>
335           body{[](tGATT_IF /* gatt_if */, const RawAddress& /* bd_addr */,
336                   uint16_t* /* p_conn_id */,
337                   tBT_TRANSPORT /* transport */) { return return_value; }};
operatorGATT_GetConnIdIfConnected338   bool operator()(tGATT_IF gatt_if, const RawAddress& bd_addr, uint16_t* p_conn_id,
339                   tBT_TRANSPORT transport) {
340     return body(gatt_if, bd_addr, p_conn_id, transport);
341   }
342 };
343 extern struct GATT_GetConnIdIfConnected GATT_GetConnIdIfConnected;
344 
345 // Name: GATT_GetConnectionInfor
346 // Params: uint16_t conn_id, tGATT_IF* p_gatt_if, RawAddress& bd_addr,
347 // tBT_TRANSPORT* p_transport Return: bool
348 struct GATT_GetConnectionInfor {
349   static bool return_value;
350   std::function<bool(uint16_t conn_id, tGATT_IF* p_gatt_if, RawAddress& bd_addr,
351                      tBT_TRANSPORT* p_transport)>
352           body{[](uint16_t /* conn_id */, tGATT_IF* /* p_gatt_if */, RawAddress& /* bd_addr */,
353                   tBT_TRANSPORT* /* p_transport */) { return return_value; }};
operatorGATT_GetConnectionInfor354   bool operator()(uint16_t conn_id, tGATT_IF* p_gatt_if, RawAddress& bd_addr,
355                   tBT_TRANSPORT* p_transport) {
356     return body(conn_id, p_gatt_if, bd_addr, p_transport);
357   }
358 };
359 extern struct GATT_GetConnectionInfor GATT_GetConnectionInfor;
360 
361 // Name: GATT_Register
362 // Params: const Uuid& app_uuid128, std::string name, tGATT_CBACK* p_cb_info,
363 // bool eatt_support Return: tGATT_IF
364 struct GATT_Register {
365   static tGATT_IF return_value;
366   std::function<tGATT_IF(const Uuid& app_uuid128, const std::string& name, tGATT_CBACK* p_cb_info,
367                          bool eatt_support)>
368           body{[](const Uuid& /* app_uuid128 */, const std::string& /* name */,
369                   tGATT_CBACK* /* p_cb_info */, bool /* eatt_support */) { return return_value; }};
operatorGATT_Register370   tGATT_IF operator()(const Uuid& app_uuid128, const std::string& name, tGATT_CBACK* p_cb_info,
371                       bool eatt_support) {
372     return body(app_uuid128, name, p_cb_info, eatt_support);
373   }
374 };
375 extern struct GATT_Register GATT_Register;
376 
377 // Name: GATT_SetIdleTimeout
378 // Params: const RawAddress& bd_addr, uint16_t idle_tout, tBT_TRANSPORT
379 // transport Return: void
380 struct GATT_SetIdleTimeout {
381   std::function<void(const RawAddress& bd_addr, uint16_t idle_tout, tBT_TRANSPORT transport,
382                      bool is_active)>
383           body{[](const RawAddress& /* bd_addr */, uint16_t /* idle_tout */,
384                   tBT_TRANSPORT /* transport */, bool /* is_active */) {}};
operatorGATT_SetIdleTimeout385   void operator()(const RawAddress& bd_addr, uint16_t idle_tout, tBT_TRANSPORT transport,
386                   bool is_active) {
387     body(bd_addr, idle_tout, transport, is_active);
388   }
389 };
390 extern struct GATT_SetIdleTimeout GATT_SetIdleTimeout;
391 
392 // Name: GATT_StartIf
393 // Params: tGATT_IF gatt_if
394 // Return: void
395 struct GATT_StartIf {
396   std::function<void(tGATT_IF gatt_if)> body{[](tGATT_IF /* gatt_if */) {}};
operatorGATT_StartIf397   void operator()(tGATT_IF gatt_if) { body(gatt_if); }
398 };
399 extern struct GATT_StartIf GATT_StartIf;
400 
401 }  // namespace stack_gatt_api
402 }  // namespace mock
403 }  // namespace test
404 
405 // END mockcify generation
406