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