bta_gattc_int.h revision e9e58ced195ec2c983c7723c9cbdabd45eb0f2fd
1/****************************************************************************** 2 * 3 * Copyright (C) 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 "bt_target.h" 28 29#include "osi/include/fixed_queue.h" 30#include "bta_sys.h" 31#include "bta_gatt_api.h" 32 33#include "bt_common.h" 34 35#ifdef __cplusplus 36extern "C" { 37#endif 38 39/***************************************************************************** 40** Constants and data types 41*****************************************************************************/ 42enum 43{ 44 BTA_GATTC_API_OPEN_EVT = BTA_SYS_EVT_START(BTA_ID_GATTC), 45 BTA_GATTC_INT_OPEN_FAIL_EVT, 46 BTA_GATTC_API_CANCEL_OPEN_EVT, 47 BTA_GATTC_INT_CANCEL_OPEN_OK_EVT, 48 49 BTA_GATTC_API_READ_EVT, 50 BTA_GATTC_API_WRITE_EVT, 51 BTA_GATTC_API_EXEC_EVT, 52 BTA_GATTC_API_CFG_MTU_EVT, 53 54 BTA_GATTC_API_CLOSE_EVT, 55 56 BTA_GATTC_API_SEARCH_EVT, 57 BTA_GATTC_API_CONFIRM_EVT, 58 BTA_GATTC_API_READ_MULTI_EVT, 59 BTA_GATTC_API_REFRESH_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 BTA_GATTC_INT_START_IF_EVT, 68 BTA_GATTC_API_REG_EVT, 69 BTA_GATTC_API_DEREG_EVT, 70 BTA_GATTC_API_LISTEN_EVT, 71 BTA_GATTC_API_BROADCAST_EVT, 72 BTA_GATTC_API_DISABLE_EVT, 73 BTA_GATTC_ENC_CMPL_EVT 74}; 75typedef uint16_t tBTA_GATTC_INT_EVT; 76 77#define BTA_GATTC_SERVICE_CHANGED_LEN 4 78 79/* max client application GATTC can support */ 80#ifndef BTA_GATTC_CL_MAX 81#define BTA_GATTC_CL_MAX 32 82#endif 83 84/* max known devices GATTC can support */ 85#ifndef BTA_GATTC_KNOWN_SR_MAX 86#define BTA_GATTC_KNOWN_SR_MAX 10 87#endif 88 89#define BTA_GATTC_CONN_MAX GATT_MAX_PHY_CHANNEL 90 91#ifndef BTA_GATTC_CLCB_MAX 92 #define BTA_GATTC_CLCB_MAX GATT_CL_MAX_LCB 93#endif 94 95#define BTA_GATTC_WRITE_PREPARE GATT_WRITE_PREPARE 96 97 98/* internal strucutre for GATTC register API */ 99typedef struct 100{ 101 BT_HDR hdr; 102 tBT_UUID app_uuid; 103 tBTA_GATTC_CBACK *p_cback; 104}tBTA_GATTC_API_REG; 105 106typedef struct 107{ 108 BT_HDR hdr; 109 tBTA_GATTC_IF client_if; 110}tBTA_GATTC_INT_START_IF; 111 112typedef tBTA_GATTC_INT_START_IF tBTA_GATTC_API_DEREG; 113typedef tBTA_GATTC_INT_START_IF tBTA_GATTC_INT_DEREG; 114 115typedef struct 116{ 117 BT_HDR hdr; 118 BD_ADDR remote_bda; 119 tBTA_GATTC_IF client_if; 120 bool is_direct; 121 tBTA_TRANSPORT transport; 122} tBTA_GATTC_API_OPEN; 123 124typedef tBTA_GATTC_API_OPEN tBTA_GATTC_API_CANCEL_OPEN; 125 126typedef struct 127{ 128 BT_HDR hdr; 129 tBTA_GATT_AUTH_REQ auth_req; 130 uint16_t handle; 131 tBTA_GATTC_EVT cmpl_evt; 132} tBTA_GATTC_API_READ; 133 134typedef struct 135{ 136 BT_HDR hdr; 137 tBTA_GATT_AUTH_REQ auth_req; 138 uint16_t handle; 139 tBTA_GATTC_EVT cmpl_evt; 140 tBTA_GATTC_WRITE_TYPE write_type; 141 uint16_t offset; 142 uint16_t len; 143 uint8_t *p_value; 144}tBTA_GATTC_API_WRITE; 145 146typedef struct 147{ 148 BT_HDR hdr; 149 bool is_execute; 150}tBTA_GATTC_API_EXEC; 151 152typedef struct 153{ 154 BT_HDR hdr; 155 uint16_t handle; 156} tBTA_GATTC_API_CONFIRM; 157 158typedef tGATT_CL_COMPLETE tBTA_GATTC_CMPL; 159 160typedef struct 161{ 162 BT_HDR hdr; 163 uint8_t op_code; 164 tGATT_STATUS status; 165 tBTA_GATTC_CMPL *p_cmpl; 166}tBTA_GATTC_OP_CMPL; 167 168typedef struct 169{ 170 BT_HDR hdr; 171 tBT_UUID *p_srvc_uuid; 172}tBTA_GATTC_API_SEARCH; 173 174typedef struct 175{ 176 BT_HDR hdr; 177 tBTA_GATT_AUTH_REQ auth_req; 178 uint8_t num_attr; 179 uint16_t handles[GATT_MAX_READ_MULTI_HANDLES]; 180}tBTA_GATTC_API_READ_MULTI; 181 182typedef struct 183{ 184 BT_HDR hdr; 185 BD_ADDR_PTR remote_bda; 186 tBTA_GATTC_IF client_if; 187 bool start; 188} tBTA_GATTC_API_LISTEN; 189 190 191typedef struct 192{ 193 BT_HDR hdr; 194 uint16_t mtu; 195}tBTA_GATTC_API_CFG_MTU; 196 197typedef struct 198{ 199 BT_HDR hdr; 200 BD_ADDR remote_bda; 201 tBTA_GATTC_IF client_if; 202 uint8_t role; 203 tBT_TRANSPORT transport; 204 tGATT_DISCONN_REASON reason; 205}tBTA_GATTC_INT_CONN; 206 207typedef struct 208{ 209 BT_HDR hdr; 210 BD_ADDR remote_bda; 211 tBTA_GATTC_IF client_if; 212}tBTA_GATTC_ENC_CMPL; 213 214typedef union 215{ 216 BT_HDR hdr; 217 tBTA_GATTC_API_REG api_reg; 218 tBTA_GATTC_API_DEREG api_dereg; 219 tBTA_GATTC_API_OPEN api_conn; 220 tBTA_GATTC_API_CANCEL_OPEN api_cancel_conn; 221 tBTA_GATTC_API_READ api_read; 222 tBTA_GATTC_API_SEARCH api_search; 223 tBTA_GATTC_API_WRITE api_write; 224 tBTA_GATTC_API_CONFIRM api_confirm; 225 tBTA_GATTC_API_EXEC api_exec; 226 tBTA_GATTC_API_READ_MULTI api_read_multi; 227 tBTA_GATTC_API_CFG_MTU api_mtu; 228 tBTA_GATTC_OP_CMPL op_cmpl; 229 tBTA_GATTC_INT_CONN int_conn; 230 tBTA_GATTC_ENC_CMPL enc_cmpl; 231 232 tBTA_GATTC_INT_START_IF int_start_if; 233 tBTA_GATTC_INT_DEREG int_dereg; 234 /* if peripheral role is supported */ 235 tBTA_GATTC_API_LISTEN api_listen; 236 237} tBTA_GATTC_DATA; 238 239 240/* GATT server cache on the client */ 241 242typedef struct 243{ 244 tBT_UUID uuid; 245 uint16_t s_handle; 246 uint16_t e_handle; 247 // this field is set only for characteristic 248 uint16_t char_decl_handle; 249 bool is_primary; 250 tBTA_GATT_CHAR_PROP property; 251}tBTA_GATTC_ATTR_REC; 252 253 254#define BTA_GATTC_MAX_CACHE_CHAR 40 255#define BTA_GATTC_ATTR_LIST_SIZE (BTA_GATTC_MAX_CACHE_CHAR * sizeof(tBTA_GATTC_ATTR_REC)) 256 257#ifndef BTA_GATTC_CACHE_SRVR_SIZE 258 #define BTA_GATTC_CACHE_SRVR_SIZE 600 259#endif 260 261enum 262{ 263 BTA_GATTC_IDLE_ST = 0, /* Idle */ 264 BTA_GATTC_W4_CONN_ST, /* Wait for connection - (optional) */ 265 BTA_GATTC_CONN_ST, /* connected state */ 266 BTA_GATTC_DISCOVER_ST /* discover is in progress */ 267}; 268typedef uint8_t tBTA_GATTC_STATE; 269 270typedef struct 271{ 272 bool in_use; 273 BD_ADDR server_bda; 274 bool connected; 275 276#define BTA_GATTC_SERV_IDLE 0 277#define BTA_GATTC_SERV_LOAD 1 278#define BTA_GATTC_SERV_SAVE 2 279#define BTA_GATTC_SERV_DISC 3 280#define BTA_GATTC_SERV_DISC_ACT 4 281 282 uint8_t state; 283 284 list_t *p_srvc_cache; /* list of tBTA_GATTC_SERVICE */ 285 uint8_t update_count; /* indication received */ 286 uint8_t num_clcb; /* number of associated CLCB */ 287 288 289 tBTA_GATTC_ATTR_REC *p_srvc_list; 290 uint8_t cur_srvc_idx; 291 uint8_t cur_char_idx; 292 uint8_t next_avail_idx; 293 uint8_t total_srvc; 294 uint8_t total_char; 295 296 uint8_t srvc_hdl_chg; /* service handle change indication pending */ 297 uint16_t attr_index; /* cahce NV saving/loading attribute index */ 298 299 uint16_t mtu; 300} tBTA_GATTC_SERV; 301 302#ifndef BTA_GATTC_NOTIF_REG_MAX 303#define BTA_GATTC_NOTIF_REG_MAX 15 304#endif 305 306typedef struct 307{ 308 bool in_use; 309 BD_ADDR remote_bda; 310 uint16_t handle; 311}tBTA_GATTC_NOTIF_REG; 312 313typedef struct 314{ 315 tBTA_GATTC_CBACK *p_cback; 316 bool in_use; 317 tBTA_GATTC_IF client_if; /* client interface with BTE stack for this application */ 318 uint8_t num_clcb; /* number of associated CLCB */ 319 bool dereg_pending; 320 tBT_UUID app_uuid; 321 tBTA_GATTC_NOTIF_REG notif_reg[BTA_GATTC_NOTIF_REG_MAX]; 322}tBTA_GATTC_RCB; 323 324/* client channel is a mapping between a BTA client(cl_id) and a remote BD address */ 325typedef struct 326{ 327 uint16_t bta_conn_id; /* client channel ID, unique for clcb */ 328 BD_ADDR bda; 329 tBTA_TRANSPORT transport; /* channel transport */ 330 tBTA_GATTC_RCB *p_rcb; /* pointer to the registration CB */ 331 tBTA_GATTC_SERV *p_srcb; /* server cache CB */ 332 tBTA_GATTC_DATA *p_q_cmd; /* command in queue waiting for execution */ 333 334#define BTA_GATTC_NO_SCHEDULE 0 335#define BTA_GATTC_DISC_WAITING 0x01 336#define BTA_GATTC_REQ_WAITING 0x10 337 338 uint8_t auto_update; /* auto update is waiting */ 339 bool disc_active; 340 bool in_use; 341 tBTA_GATTC_STATE state; 342 tBTA_GATT_STATUS status; 343 uint16_t reason; 344} tBTA_GATTC_CLCB; 345 346/* back ground connection tracking information */ 347#if GATT_MAX_APPS <= 8 348typedef uint8_t tBTA_GATTC_CIF_MASK ; 349#elif GATT_MAX_APPS <= 16 350typedef uint16_t tBTA_GATTC_CIF_MASK; 351#elif GATT_MAX_APPS <= 32 352typedef uint32_t tBTA_GATTC_CIF_MASK; 353#endif 354 355typedef struct 356{ 357 bool in_use; 358 BD_ADDR remote_bda; 359 tBTA_GATTC_CIF_MASK cif_mask; 360 tBTA_GATTC_CIF_MASK cif_adv_mask; 361 362}tBTA_GATTC_BG_TCK; 363 364typedef struct 365{ 366 bool in_use; 367 BD_ADDR remote_bda; 368}tBTA_GATTC_CONN; 369 370enum 371{ 372 BTA_GATTC_STATE_DISABLED, 373 BTA_GATTC_STATE_ENABLING, 374 BTA_GATTC_STATE_ENABLED, 375 BTA_GATTC_STATE_DISABLING 376}; 377 378typedef struct 379{ 380 uint8_t state; 381 382 tBTA_GATTC_CONN conn_track[BTA_GATTC_CONN_MAX]; 383 tBTA_GATTC_BG_TCK bg_track[BTA_GATTC_KNOWN_SR_MAX]; 384 tBTA_GATTC_RCB cl_rcb[BTA_GATTC_CL_MAX]; 385 386 tBTA_GATTC_CLCB clcb[BTA_GATTC_CLCB_MAX]; 387 tBTA_GATTC_SERV known_server[BTA_GATTC_KNOWN_SR_MAX]; 388}tBTA_GATTC_CB; 389 390/***************************************************************************** 391** Global data 392*****************************************************************************/ 393 394/* GATTC control block */ 395#if (BTA_DYNAMIC_MEMORY == FALSE) 396extern tBTA_GATTC_CB bta_gattc_cb; 397#else 398extern tBTA_GATTC_CB *bta_gattc_cb_ptr; 399#define bta_gattc_cb (*bta_gattc_cb_ptr) 400#endif 401 402/***************************************************************************** 403** Function prototypes 404*****************************************************************************/ 405extern bool bta_gattc_hdl_event(BT_HDR *p_msg); 406extern bool bta_gattc_sm_execute(tBTA_GATTC_CLCB *p_clcb, uint16_t event, tBTA_GATTC_DATA *p_data); 407 408/* function processed outside SM */ 409extern void bta_gattc_disable(tBTA_GATTC_CB *p_cb); 410extern void bta_gattc_register(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_data); 411extern void bta_gattc_start_if(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_data); 412extern void bta_gattc_process_api_open (tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA * p_msg); 413extern void bta_gattc_process_api_open_cancel (tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA * p_msg); 414extern void bta_gattc_deregister(tBTA_GATTC_CB *p_cb, tBTA_GATTC_RCB *p_clreg); 415extern void bta_gattc_process_enc_cmpl(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg); 416 417/* function within state machine */ 418extern void bta_gattc_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 419extern void bta_gattc_open_fail(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 420extern void bta_gattc_open_error(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 421 422extern void bta_gattc_cancel_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 423extern void bta_gattc_cancel_open_ok(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 424extern void bta_gattc_cancel_open_error(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 425 426extern void bta_gattc_conn(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 427 428extern void bta_gattc_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 429extern void bta_gattc_close_fail(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 430extern void bta_gattc_disc_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 431 432extern void bta_gattc_start_discover(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 433extern void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 434extern void bta_gattc_read(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 435extern void bta_gattc_write(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 436extern void bta_gattc_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 437extern void bta_gattc_q_cmd(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 438extern void bta_gattc_search(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 439extern void bta_gattc_fail(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 440extern void bta_gattc_confirm(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 441extern void bta_gattc_execute(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 442extern void bta_gattc_read_multi(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 443extern void bta_gattc_ci_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 444extern void bta_gattc_ci_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 445extern void bta_gattc_ignore_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 446extern void bta_gattc_restart_discover(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA * p_msg); 447extern void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *p_clreg); 448extern void bta_gattc_cancel_bk_conn(tBTA_GATTC_API_CANCEL_OPEN *p_data); 449extern void bta_gattc_send_open_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status, 450 BD_ADDR remote_bda, uint16_t conn_id, tBTA_TRANSPORT transport, uint16_t mtu); 451extern void bta_gattc_process_api_refresh(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA * p_msg); 452extern void bta_gattc_cfg_mtu(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 453#if (BLE_INCLUDED == TRUE) 454extern void bta_gattc_listen(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA * p_msg); 455extern void bta_gattc_broadcast(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA * p_msg); 456#endif 457/* utility functions */ 458extern tBTA_GATTC_CLCB * bta_gattc_find_clcb_by_cif (uint8_t client_if, BD_ADDR remote_bda, tBTA_TRANSPORT transport); 459extern tBTA_GATTC_CLCB * bta_gattc_find_clcb_by_conn_id (uint16_t conn_id); 460extern tBTA_GATTC_CLCB * bta_gattc_clcb_alloc(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_TRANSPORT transport); 461extern void bta_gattc_clcb_dealloc(tBTA_GATTC_CLCB *p_clcb); 462extern tBTA_GATTC_CLCB * bta_gattc_find_alloc_clcb(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_TRANSPORT transport); 463extern tBTA_GATTC_RCB * bta_gattc_cl_get_regcb(uint8_t client_if); 464extern tBTA_GATTC_SERV * bta_gattc_find_srcb(BD_ADDR bda); 465extern tBTA_GATTC_SERV * bta_gattc_srcb_alloc(BD_ADDR bda); 466extern tBTA_GATTC_SERV * bta_gattc_find_scb_by_cid (uint16_t conn_id); 467extern tBTA_GATTC_CLCB * bta_gattc_find_int_conn_clcb(tBTA_GATTC_DATA *p_msg); 468extern tBTA_GATTC_CLCB * bta_gattc_find_int_disconn_clcb(tBTA_GATTC_DATA *p_msg); 469 470extern bool bta_gattc_enqueue(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data); 471 472extern bool bta_gattc_uuid_compare (const tBT_UUID *p_src, const tBT_UUID *p_tar, bool is_precise); 473extern bool bta_gattc_check_notif_registry(tBTA_GATTC_RCB *p_clreg, tBTA_GATTC_SERV *p_srcb, tBTA_GATTC_NOTIFY *p_notify); 474extern bool bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR remote_bda, bool add, bool is_listen); 475extern bool bta_gattc_check_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR remote_bda, uint8_t role); 476extern uint8_t bta_gattc_num_reg_app(void); 477extern void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, uint16_t conn_id, uint16_t start_handle, uint16_t end_handle); 478extern tBTA_GATTC_SERV * bta_gattc_find_srvr_cache(BD_ADDR bda); 479 480/* discovery functions */ 481extern void bta_gattc_disc_res_cback (uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_DISC_RES *p_data); 482extern void bta_gattc_disc_cmpl_cback (uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_STATUS status); 483extern tBTA_GATT_STATUS bta_gattc_discover_procedure(uint16_t conn_id, tBTA_GATTC_SERV *p_server_cb, uint8_t disc_type); 484extern tBTA_GATT_STATUS bta_gattc_discover_pri_service(uint16_t conn_id, tBTA_GATTC_SERV *p_server_cb, uint8_t disc_type); 485extern void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid); 486extern const list_t* bta_gattc_get_services(uint16_t conn_id); 487extern const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(uint16_t conn_id, uint16_t handle); 488tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, uint16_t handle); 489extern tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(uint16_t conn_id, uint16_t handle); 490extern tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(uint16_t conn_id, uint16_t handle); 491extern void bta_gattc_get_gatt_db(uint16_t conn_id, uint16_t start_handle, uint16_t end_handle, btgatt_db_element_t **db, int *count); 492extern tBTA_GATT_STATUS bta_gattc_init_cache(tBTA_GATTC_SERV *p_srvc_cb); 493extern void bta_gattc_rebuild_cache(tBTA_GATTC_SERV *p_srcv, uint16_t num_attr, tBTA_GATTC_NV_ATTR *attr); 494extern void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, uint16_t conn_id); 495extern void bta_gattc_reset_discover_st(tBTA_GATTC_SERV *p_srcb, tBTA_GATT_STATUS status); 496 497extern tBTA_GATTC_CONN * bta_gattc_conn_alloc(BD_ADDR remote_bda); 498extern tBTA_GATTC_CONN * bta_gattc_conn_find(BD_ADDR remote_bda); 499extern tBTA_GATTC_CONN * bta_gattc_conn_find_alloc(BD_ADDR remote_bda); 500extern bool bta_gattc_conn_dealloc(BD_ADDR remote_bda); 501 502extern bool bta_gattc_cache_load(tBTA_GATTC_CLCB *p_clcb); 503extern void bta_gattc_cache_reset(BD_ADDR server_bda); 504 505#ifdef __cplusplus 506} 507#endif 508 509#endif /* BTA_GATTC_INT_H */ 510