• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright 2003-2012 Broadcom Corporation
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 
19 /******************************************************************************
20  *
21  *  This is the private file for the file transfer client (FTC).
22  *
23  ******************************************************************************/
24 #ifndef BTA_GATTC_INT_H
25 #define BTA_GATTC_INT_H
26 
27 #include <cstdint>
28 #include <deque>
29 
30 #include "bt_target.h"  // Must be first to define build configuration
31 #include "bta/gatt/database.h"
32 #include "bta/gatt/database_builder.h"
33 #include "bta/include/bta_gatt_api.h"
34 #include "bta/sys/bta_sys.h"
35 #include "stack/include/bt_hdr.h"
36 #include "stack/include/gatt_api.h"
37 #include "types/bluetooth/uuid.h"
38 #include "types/bt_transport.h"
39 #include "types/raw_address.h"
40 
41 /*****************************************************************************
42  *  Constants and data types
43  ****************************************************************************/
44 enum {
45   BTA_GATTC_API_OPEN_EVT = BTA_SYS_EVT_START(BTA_ID_GATTC),
46   BTA_GATTC_INT_OPEN_FAIL_EVT,
47   BTA_GATTC_API_CANCEL_OPEN_EVT,
48   BTA_GATTC_INT_CANCEL_OPEN_OK_EVT,
49 
50   BTA_GATTC_API_READ_EVT,
51   BTA_GATTC_API_WRITE_EVT,
52   BTA_GATTC_API_EXEC_EVT,
53   BTA_GATTC_API_CFG_MTU_EVT,
54 
55   BTA_GATTC_API_CLOSE_EVT,
56 
57   BTA_GATTC_API_SEARCH_EVT,
58   BTA_GATTC_API_CONFIRM_EVT,
59   BTA_GATTC_API_READ_MULTI_EVT,
60 
61   BTA_GATTC_INT_CONN_EVT,
62   BTA_GATTC_INT_DISCOVER_EVT,
63   BTA_GATTC_DISCOVER_CMPL_EVT,
64   BTA_GATTC_OP_CMPL_EVT,
65   BTA_GATTC_INT_DISCONN_EVT
66 };
67 typedef uint16_t tBTA_GATTC_INT_EVT;
68 
69 #define BTA_GATTC_SERVICE_CHANGED_LEN 4
70 
71 /* max client application GATTC can support */
72 #ifndef BTA_GATTC_CL_MAX
73 #define BTA_GATTC_CL_MAX 32
74 #endif
75 
76 /* max known devices GATTC can support in Bluetooth spec */
77 #ifndef BTA_GATTC_KNOWN_SR_MAX
78 #define BTA_GATTC_KNOWN_SR_MAX 255
79 #endif
80 
81 #ifndef BTA_GATTC_CLCB_MAX
82 #define BTA_GATTC_CLCB_MAX GATT_CL_MAX_LCB
83 #endif
84 
85 #define BTA_GATTC_WRITE_PREPARE GATT_WRITE_PREPARE
86 
87 /* internal strucutre for GATTC register API  */
88 typedef struct {
89   BT_HDR_RIGID hdr;
90   RawAddress remote_bda;
91   tGATT_IF client_if;
92   tBTM_BLE_CONN_TYPE connection_type;
93   tBT_TRANSPORT transport;
94   uint8_t initiating_phys;
95   bool opportunistic;
96   tBT_DEVICE_TYPE remote_addr_type;
97 } tBTA_GATTC_API_OPEN;
98 
99 typedef struct {
100   BT_HDR_RIGID hdr;
101   RawAddress remote_bda;
102   tGATT_IF client_if;
103   bool is_direct;
104   tBT_TRANSPORT transport;
105   uint8_t initiating_phys;
106   bool opportunistic;
107 } tBTA_GATTC_API_CANCEL_OPEN;
108 
109 typedef struct {
110   BT_HDR_RIGID hdr;
111   tGATT_AUTH_REQ auth_req;
112 
113   // read by handle data
114   uint16_t handle;
115 
116   // read by UUID data
117   bluetooth::Uuid uuid;
118   uint16_t s_handle;
119   uint16_t e_handle;
120 
121   tBTA_GATTC_EVT cmpl_evt;
122   GATT_READ_OP_CB read_cb;
123   void* read_cb_data;
124 } tBTA_GATTC_API_READ;
125 
126 typedef struct {
127   BT_HDR_RIGID hdr;
128   tGATT_AUTH_REQ auth_req;
129   uint16_t handle;
130   tGATT_WRITE_TYPE write_type;
131   uint16_t offset;
132   uint16_t len;
133   uint8_t* p_value;
134   GATT_WRITE_OP_CB write_cb;
135   void* write_cb_data;
136 } tBTA_GATTC_API_WRITE;
137 
138 typedef struct {
139   BT_HDR_RIGID hdr;
140   bool is_execute;
141 } tBTA_GATTC_API_EXEC;
142 
143 typedef struct {
144   BT_HDR_RIGID hdr;
145   uint16_t cid;
146 } tBTA_GATTC_API_CONFIRM;
147 
148 typedef struct {
149   BT_HDR_RIGID hdr;
150   tGATTC_OPTYPE op_code;
151   tGATT_STATUS status;
152   tGATT_CL_COMPLETE* p_cmpl;
153 } tBTA_GATTC_OP_CMPL;
154 
155 typedef struct {
156   BT_HDR_RIGID hdr;
157   bluetooth::Uuid* p_srvc_uuid;
158 } tBTA_GATTC_API_SEARCH;
159 
160 typedef struct {
161   BT_HDR_RIGID hdr;
162   tGATT_AUTH_REQ auth_req;
163   uint8_t num_attr;
164   uint16_t handles[GATT_MAX_READ_MULTI_HANDLES];
165 } tBTA_GATTC_API_READ_MULTI;
166 
167 typedef struct {
168   BT_HDR_RIGID hdr;
169   uint16_t mtu;
170   GATT_CONFIGURE_MTU_OP_CB mtu_cb;
171   void* mtu_cb_data;
172 } tBTA_GATTC_API_CFG_MTU;
173 
174 typedef struct {
175   BT_HDR_RIGID hdr;
176   RawAddress remote_bda;
177   tGATT_IF client_if;
178   uint8_t role;
179   tBT_TRANSPORT transport;
180   tGATT_DISCONN_REASON reason;
181 } tBTA_GATTC_INT_CONN;
182 
183 typedef union {
184   BT_HDR_RIGID hdr;
185   tBTA_GATTC_API_OPEN api_conn;
186   tBTA_GATTC_API_CANCEL_OPEN api_cancel_conn;
187   tBTA_GATTC_API_READ api_read;
188   tBTA_GATTC_API_SEARCH api_search;
189   tBTA_GATTC_API_WRITE api_write;
190   tBTA_GATTC_API_CONFIRM api_confirm;
191   tBTA_GATTC_API_EXEC api_exec;
192   tBTA_GATTC_API_READ_MULTI api_read_multi;
193   tBTA_GATTC_API_CFG_MTU api_mtu;
194   tBTA_GATTC_OP_CMPL op_cmpl;
195   tBTA_GATTC_INT_CONN int_conn;
196 } tBTA_GATTC_DATA;
197 
198 enum {
199   BTA_GATTC_IDLE_ST = 0, /* Idle  */
200   BTA_GATTC_W4_CONN_ST,  /* Wait for connection -  (optional) */
201   BTA_GATTC_CONN_ST,     /* connected state */
202   BTA_GATTC_DISCOVER_ST  /* discover is in progress */
203 };
204 typedef uint8_t tBTA_GATTC_STATE;
205 
206 typedef struct {
207   bool in_use;
208   RawAddress server_bda;
209   bool connected;
210 
211 #define BTA_GATTC_SERV_IDLE 0
212 #define BTA_GATTC_SERV_LOAD 1
213 #define BTA_GATTC_SERV_SAVE 2
214 #define BTA_GATTC_SERV_DISC 3
215 #define BTA_GATTC_SERV_DISC_ACT 4
216 
217   uint8_t state;
218 
219   gatt::Database gatt_database;
220   uint8_t update_count; /* indication received */
221   uint8_t num_clcb;     /* number of associated CLCB */
222 
223   gatt::DatabaseBuilder pending_discovery;
224 
225   /* used only during service discovery, when reading Extended Characteristic
226    * Properties */
227   bool read_multiple_not_supported;
228 
229   uint8_t srvc_hdl_chg; /* service handle change indication pending */
230   bool srvc_hdl_db_hash;   /* read db hash pending */
231   uint8_t srvc_disc_count; /* current discovery retry count */
232   uint16_t attr_index;  /* cahce NV saving/loading attribute index */
233 
234   uint16_t mtu;
235 } tBTA_GATTC_SERV;
236 
237 #ifndef BTA_GATTC_NOTIF_REG_MAX
238 #define BTA_GATTC_NOTIF_REG_MAX 64
239 #endif
240 
241 typedef struct {
242   bool in_use;
243   bool app_disconnected;
244   RawAddress remote_bda;
245   uint16_t handle;
246 } tBTA_GATTC_NOTIF_REG;
247 
248 typedef struct {
249   tBTA_GATTC_CBACK* p_cback;
250   bool in_use;
251   tGATT_IF client_if; /* client interface with BTE stack for this application */
252   uint8_t num_clcb; /* number of associated CLCB */
253   bool dereg_pending;
254   bluetooth::Uuid app_uuid;
255   tBTA_GATTC_NOTIF_REG notif_reg[BTA_GATTC_NOTIF_REG_MAX];
256 } tBTA_GATTC_RCB;
257 
258 /* client channel is a mapping between a BTA client(cl_id) and a remote BD
259  * address */
260 typedef struct {
261   uint16_t bta_conn_id; /* client channel ID, unique for clcb */
262   RawAddress bda;
263   tBT_TRANSPORT transport;  /* channel transport */
264   tBTA_GATTC_RCB* p_rcb;    /* pointer to the registration CB */
265   tBTA_GATTC_SERV* p_srcb;  /* server cache CB */
266   const tBTA_GATTC_DATA* p_q_cmd; /* command in queue waiting for execution */
267   std::deque<const tBTA_GATTC_DATA*> p_q_cmd_queue;
268 
269 // request during discover state
270 #define BTA_GATTC_DISCOVER_REQ_NONE 0
271 #define BTA_GATTC_DISCOVER_REQ_READ_EXT_PROP_DESC 1
272 #define BTA_GATTC_DISCOVER_REQ_READ_DB_HASH 2
273 #define BTA_GATTC_DISCOVER_REQ_READ_DB_HASH_FOR_SVC_CHG 3
274 
275   uint8_t request_during_discovery; /* request during discover state */
276 
277 #define BTA_GATTC_NO_SCHEDULE 0
278 #define BTA_GATTC_DISC_WAITING 0x01
279 #define BTA_GATTC_REQ_WAITING 0x10
280 
281   uint8_t auto_update; /* auto update is waiting */
282   bool disc_active;
283   bool in_use;
284   tBTA_GATTC_STATE state;
285   tGATT_STATUS status;
286 } tBTA_GATTC_CLCB;
287 
288 /* back ground connection tracking information */
289 #if GATT_MAX_APPS <= 8
290 typedef uint8_t tBTA_GATTC_CIF_MASK;
291 #elif GATT_MAX_APPS <= 16
292 typedef uint16_t tBTA_GATTC_CIF_MASK;
293 #elif GATT_MAX_APPS <= 32
294 typedef uint32_t tBTA_GATTC_CIF_MASK;
295 #endif
296 
297 typedef struct {
298   bool in_use;
299   RawAddress remote_bda;
300   tBTA_GATTC_CIF_MASK cif_mask;
301 
302 } tBTA_GATTC_BG_TCK;
303 
304 typedef struct {
305   bool in_use;
306   RawAddress remote_bda;
307 } tBTA_GATTC_CONN;
308 
309 enum {
310   BTA_GATTC_STATE_DISABLED,
311   BTA_GATTC_STATE_ENABLING,
312   BTA_GATTC_STATE_ENABLED,
313   BTA_GATTC_STATE_DISABLING
314 };
315 
316 typedef struct {
317   uint8_t state;
318 
319   tBTA_GATTC_CONN conn_track[GATT_MAX_PHY_CHANNEL];
320   tBTA_GATTC_BG_TCK bg_track[BTA_GATTC_KNOWN_SR_MAX];
321   tBTA_GATTC_RCB cl_rcb[BTA_GATTC_CL_MAX];
322 
323   tBTA_GATTC_CLCB clcb[BTA_GATTC_CLCB_MAX];
324   tBTA_GATTC_SERV known_server[BTA_GATTC_KNOWN_SR_MAX];
325 } tBTA_GATTC_CB;
326 
327 /*****************************************************************************
328  *  Global data
329  ****************************************************************************/
330 
331 /* GATTC control block */
332 extern tBTA_GATTC_CB bta_gattc_cb;
333 
334 /*****************************************************************************
335  *  Function prototypes
336  ****************************************************************************/
337 bool bta_gattc_hdl_event(BT_HDR_RIGID* p_msg);
338 bool bta_gattc_sm_execute(tBTA_GATTC_CLCB* p_clcb, uint16_t event,
339                           const tBTA_GATTC_DATA* p_data);
340 
341 /* function processed outside SM */
342 void bta_gattc_disable();
343 void bta_gattc_register(const bluetooth::Uuid& app_uuid,
344                         tBTA_GATTC_CBACK* p_data, BtaAppRegisterCallback cb,
345                         bool eatt_support);
346 void bta_gattc_process_api_open(const tBTA_GATTC_DATA* p_msg);
347 void bta_gattc_process_api_open_cancel(const tBTA_GATTC_DATA* p_msg);
348 void bta_gattc_deregister(tBTA_GATTC_RCB* p_clreg);
349 
350 /* function within state machine */
351 void bta_gattc_open(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
352 void bta_gattc_open_fail(tBTA_GATTC_CLCB* p_clcb,
353                          const tBTA_GATTC_DATA* p_data);
354 void bta_gattc_open_error(tBTA_GATTC_CLCB* p_clcb,
355                           const tBTA_GATTC_DATA* p_data);
356 
357 void bta_gattc_cancel_open(tBTA_GATTC_CLCB* p_clcb,
358                            const tBTA_GATTC_DATA* p_data);
359 void bta_gattc_cancel_open_ok(tBTA_GATTC_CLCB* p_clcb,
360                               const tBTA_GATTC_DATA* p_data);
361 void bta_gattc_cancel_open_error(tBTA_GATTC_CLCB* p_clcb,
362                                  const tBTA_GATTC_DATA* p_data);
363 
364 void bta_gattc_conn(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
365 
366 void bta_gattc_close(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
367 void bta_gattc_close_fail(tBTA_GATTC_CLCB* p_clcb,
368                           const tBTA_GATTC_DATA* p_data);
369 void bta_gattc_disc_close(tBTA_GATTC_CLCB* p_clcb,
370                           const tBTA_GATTC_DATA* p_data);
371 
372 void bta_gattc_start_discover(tBTA_GATTC_CLCB* p_clcb,
373                               const tBTA_GATTC_DATA* p_data);
374 void bta_gattc_start_discover_internal(tBTA_GATTC_CLCB* p_clcb);
375 void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB* p_clcb,
376                          const tBTA_GATTC_DATA* p_data);
377 void bta_gattc_read(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
378 void bta_gattc_write(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
379 void bta_gattc_op_cmpl(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
380 void bta_gattc_q_cmd(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
381 void bta_gattc_search(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
382 void bta_gattc_fail(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
383 void bta_gattc_confirm(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
384 void bta_gattc_execute(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
385 void bta_gattc_read_multi(tBTA_GATTC_CLCB* p_clcb,
386                           const tBTA_GATTC_DATA* p_data);
387 void bta_gattc_ci_open(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
388 void bta_gattc_ci_close(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
389 void bta_gattc_op_cmpl_during_discovery(tBTA_GATTC_CLCB* p_clcb,
390                                         const tBTA_GATTC_DATA* p_data);
391 void bta_gattc_restart_discover(tBTA_GATTC_CLCB* p_clcb,
392                                 const tBTA_GATTC_DATA* p_msg);
393 void bta_gattc_cancel_bk_conn(const tBTA_GATTC_API_CANCEL_OPEN* p_data);
394 void bta_gattc_send_open_cback(tBTA_GATTC_RCB* p_clreg, tGATT_STATUS status,
395                                const RawAddress& remote_bda, uint16_t conn_id,
396                                tBT_TRANSPORT transport, uint16_t mtu);
397 void bta_gattc_process_api_refresh(const RawAddress& remote_bda);
398 void bta_gattc_cfg_mtu(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data);
399 void bta_gattc_listen(tBTA_GATTC_DATA* p_msg);
400 void bta_gattc_broadcast(tBTA_GATTC_DATA* p_msg);
401 
402 /* utility functions */
403 tBTA_GATTC_CLCB* bta_gattc_find_clcb_by_cif(uint8_t client_if,
404                                             const RawAddress& remote_bda,
405                                             tBT_TRANSPORT transport);
406 tBTA_GATTC_CLCB* bta_gattc_find_clcb_by_conn_id(uint16_t conn_id);
407 tBTA_GATTC_CLCB* bta_gattc_clcb_alloc(tGATT_IF client_if,
408                                       const RawAddress& remote_bda,
409                                       tBT_TRANSPORT transport);
410 void bta_gattc_clcb_dealloc(tBTA_GATTC_CLCB* p_clcb);
411 void bta_gattc_server_disconnected(tBTA_GATTC_SERV* p_srcb);
412 tBTA_GATTC_CLCB* bta_gattc_find_alloc_clcb(tGATT_IF client_if,
413                                            const RawAddress& remote_bda,
414                                            tBT_TRANSPORT transport);
415 tBTA_GATTC_RCB* bta_gattc_cl_get_regcb(uint8_t client_if);
416 tBTA_GATTC_SERV* bta_gattc_find_srcb(const RawAddress& bda);
417 tBTA_GATTC_SERV* bta_gattc_srcb_alloc(const RawAddress& bda);
418 tBTA_GATTC_SERV* bta_gattc_find_scb_by_cid(uint16_t conn_id);
419 tBTA_GATTC_CLCB* bta_gattc_find_int_conn_clcb(tBTA_GATTC_DATA* p_msg);
420 tBTA_GATTC_CLCB* bta_gattc_find_int_disconn_clcb(tBTA_GATTC_DATA* p_msg);
421 
422 enum BtaEnqueuedResult_t {
423   ENQUEUED_READY_TO_SEND,
424   ENQUEUED_FOR_LATER,
425 };
426 
427 BtaEnqueuedResult_t bta_gattc_enqueue(tBTA_GATTC_CLCB* p_clcb,
428                                       const tBTA_GATTC_DATA* p_data);
429 bool bta_gattc_is_data_queued(tBTA_GATTC_CLCB* p_clcb,
430                               const tBTA_GATTC_DATA* p_data);
431 void bta_gattc_continue(tBTA_GATTC_CLCB* p_clcb);
432 void bta_gattc_send_mtu_response(tBTA_GATTC_CLCB* p_clcb,
433                                  const tBTA_GATTC_DATA* p_data,
434                                  uint16_t current_mtu);
435 void bta_gattc_cmpl_sendmsg(uint16_t conn_id, tGATTC_OPTYPE op,
436                             tGATT_STATUS status, tGATT_CL_COMPLETE* p_data);
437 
438 bool bta_gattc_check_notif_registry(tBTA_GATTC_RCB* p_clreg,
439                                     tBTA_GATTC_SERV* p_srcb,
440                                     tBTA_GATTC_NOTIFY* p_notify);
441 bool bta_gattc_mark_bg_conn(tGATT_IF client_if, const RawAddress& remote_bda,
442                             bool add);
443 bool bta_gattc_check_bg_conn(tGATT_IF client_if, const RawAddress& remote_bda,
444                              uint8_t role);
445 uint8_t bta_gattc_num_reg_app(void);
446 void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV* p_srcb,
447                                         uint16_t conn_id, uint16_t start_handle,
448                                         uint16_t end_handle);
449 tBTA_GATTC_SERV* bta_gattc_find_srvr_cache(const RawAddress& bda);
450 bool bta_gattc_is_robust_caching_enabled();
451 
452 /* discovery functions */
453 void bta_gattc_disc_res_cback(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
454                               tGATT_DISC_RES* p_data);
455 void bta_gattc_disc_cmpl_cback(uint16_t conn_id, tGATT_DISC_TYPE disc_type,
456                                tGATT_STATUS status);
457 tGATT_STATUS bta_gattc_discover_pri_service(uint16_t conn_id,
458                                             tBTA_GATTC_SERV* p_server_cb,
459                                             tGATT_DISC_TYPE disc_type);
460 void bta_gattc_search_service(tBTA_GATTC_CLCB* p_clcb, bluetooth::Uuid* p_uuid);
461 const std::list<gatt::Service>* bta_gattc_get_services(uint16_t conn_id);
462 const gatt::Service* bta_gattc_get_service_for_handle(uint16_t conn_id,
463                                                       uint16_t handle);
464 const gatt::Characteristic* bta_gattc_get_characteristic_srcb(
465     tBTA_GATTC_SERV* p_srcb, uint16_t handle);
466 const gatt::Service* bta_gattc_get_service_for_handle_srcb(
467     tBTA_GATTC_SERV* p_srcb, uint16_t handle);
468 const gatt::Characteristic* bta_gattc_get_characteristic(uint16_t conn_id,
469                                                          uint16_t handle);
470 const gatt::Descriptor* bta_gattc_get_descriptor(uint16_t conn_id,
471                                                  uint16_t handle);
472 const gatt::Characteristic* bta_gattc_get_owning_characteristic(
473     uint16_t conn_id, uint16_t handle);
474 void bta_gattc_get_gatt_db(uint16_t conn_id, uint16_t start_handle,
475                            uint16_t end_handle, btgatt_db_element_t** db,
476                            int* count);
477 void bta_gattc_init_cache(tBTA_GATTC_SERV* p_srvc_cb);
478 
479 enum class RobustCachingSupport {
480   UNSUPPORTED,
481   SUPPORTED,
482   UNKNOWN,
483 };
484 RobustCachingSupport GetRobustCachingSupport(const tBTA_GATTC_CLCB* p_clcb,
485                                              const gatt::Database& db);
486 
487 void bta_gattc_reset_discover_st(tBTA_GATTC_SERV* p_srcb, tGATT_STATUS status);
488 
489 tBTA_GATTC_CONN* bta_gattc_conn_alloc(const RawAddress& remote_bda);
490 tBTA_GATTC_CONN* bta_gattc_conn_find(const RawAddress& remote_bda);
491 tBTA_GATTC_CONN* bta_gattc_conn_find_alloc(const RawAddress& remote_bda);
492 bool bta_gattc_conn_dealloc(const RawAddress& remote_bda);
493 
494 /* bta_gattc_cache */
495 bool bta_gattc_read_db_hash(tBTA_GATTC_CLCB* p_clcb, bool is_svc_chg);
496 
497 /* bta_gattc_db_storage */
498 gatt::Database bta_gattc_hash_load(const Octet16& hash);
499 bool bta_gattc_hash_write(const Octet16& hash, const gatt::Database& database);
500 gatt::Database bta_gattc_cache_load(const RawAddress& server_bda);
501 void bta_gattc_cache_write(const RawAddress& server_bda,
502                            const gatt::Database& database);
503 void bta_gattc_cache_link(const RawAddress& server_bda, const Octet16& hash);
504 void bta_gattc_cache_reset(const RawAddress& server_bda);
505 
506 #endif /* BTA_GATTC_INT_H */
507