Update IDF to c4e65d6

This commit is contained in:
me-no-dev
2017-09-22 17:28:54 +08:00
parent e2bd93c092
commit d27d297195
95 changed files with 2149 additions and 930 deletions

View File

@ -58,12 +58,6 @@ enum {
BTA_GATTC_OP_CMPL_EVT,
BTA_GATTC_INT_DISCONN_EVT,
/* for cache loading/saving */
BTA_GATTC_START_CACHE_EVT,
BTA_GATTC_CI_CACHE_OPEN_EVT,
BTA_GATTC_CI_CACHE_LOAD_EVT,
BTA_GATTC_CI_CACHE_SAVE_EVT,
BTA_GATTC_INT_START_IF_EVT,
BTA_GATTC_API_REG_EVT,
BTA_GATTC_API_DEREG_EVT,
@ -74,6 +68,8 @@ enum {
};
typedef UINT16 tBTA_GATTC_INT_EVT;
#define BTA_GATTC_SERVICE_CHANGED_LEN 4
/* max client application GATTC can support */
#ifndef BTA_GATTC_CL_MAX
#define BTA_GATTC_CL_MAX 3 // 32
@ -95,7 +91,7 @@ typedef UINT16 tBTA_GATTC_INT_EVT;
#endif
#define BTA_GATTC_WRITE_PREPARE GATT_WRITE_PREPARE
#define BTA_GATTC_INVALID_HANDLE 0
/* internal strucutre for GATTC register API */
typedef struct {
@ -125,17 +121,15 @@ typedef tBTA_GATTC_API_OPEN tBTA_GATTC_API_CANCEL_OPEN;
typedef struct {
BT_HDR hdr;
tBTA_GATT_AUTH_REQ auth_req;
tBTA_GATT_SRVC_ID srvc_id;
tBTA_GATT_ID char_id;
tBTA_GATT_ID *p_descr_type;
UINT16 handle;
tBTA_GATTC_EVT cmpl_evt;
} tBTA_GATTC_API_READ;
typedef struct {
BT_HDR hdr;
tBTA_GATT_AUTH_REQ auth_req;
tBTA_GATT_SRVC_ID srvc_id;
tBTA_GATT_ID char_id;
tBTA_GATT_ID *p_descr_type;
UINT16 handle;
tBTA_GATTC_EVT cmpl_evt;
tBTA_GATTC_WRITE_TYPE write_type;
UINT16 offset;
UINT16 len;
@ -149,8 +143,7 @@ typedef struct {
typedef struct {
BT_HDR hdr;
tBTA_GATT_SRVC_ID srvc_id;
tBTA_GATT_ID char_id;
UINT16 handle;
} tBTA_GATTC_API_CONFIRM;
typedef tGATT_CL_COMPLETE tBTA_GATTC_CMPL;
@ -171,8 +164,8 @@ typedef struct {
BT_HDR hdr;
tBTA_GATT_AUTH_REQ auth_req;
UINT8 num_attr;
tBTA_GATTC_ATTR_ID *p_id_list;
} tBTA_GATTC_API_READ_MULTI;
UINT16 handles[GATT_MAX_READ_MULTI_HANDLES];
}tBTA_GATTC_API_READ_MULTI;
typedef struct {
BT_HDR hdr;
@ -215,9 +208,6 @@ typedef union {
tBTA_GATTC_API_READ_MULTI api_read_multi;
tBTA_GATTC_API_CFG_MTU api_mtu;
tBTA_GATTC_OP_CMPL op_cmpl;
tBTA_GATTC_CI_EVT ci_open;
tBTA_GATTC_CI_EVT ci_save;
tBTA_GATTC_CI_LOAD ci_load;
tBTA_GATTC_INT_CONN int_conn;
tBTA_GATTC_ENC_CMPL enc_cmpl;
@ -230,43 +220,13 @@ typedef union {
/* GATT server cache on the client */
typedef union {
UINT8 uuid128[LEN_UUID_128];
UINT16 uuid16;
} tBTA_GATTC_UUID;
typedef struct gattc_attr_cache {
tBTA_GATTC_UUID *p_uuid;
struct gattc_attr_cache *p_next;
UINT16 uuid_len;
UINT16 attr_handle;
UINT8 inst_id;
tBTA_GATT_CHAR_PROP property; /* if characteristic, it is char property;
if included service, flag primary,
if descriptor, not used */
tBTA_GATTC_ATTR_TYPE attr_type;
// btla-specific ++
} __attribute__((packed)) tBTA_GATTC_CACHE_ATTR;
// btla-specific --
typedef struct gattc_svc_cache {
tBTA_GATT_SRVC_ID service_uuid;
tBTA_GATTC_CACHE_ATTR *p_attr;
tBTA_GATTC_CACHE_ATTR *p_last_attr;
UINT16 s_handle;
UINT16 e_handle;
struct gattc_svc_cache *p_next;
tBTA_GATTC_CACHE_ATTR *p_cur_char;
// btla-specific ++
} __attribute__((packed)) tBTA_GATTC_CACHE;
// btla-specific --
typedef struct {
tBT_UUID uuid;
UINT16 s_handle;
UINT16 e_handle;
// this field is set only for characteristic
UINT16 char_decl_handle;
BOOLEAN is_primary;
UINT8 srvc_inst_id;
tBTA_GATT_CHAR_PROP property;
} tBTA_GATTC_ATTR_REC;
@ -299,11 +259,7 @@ typedef struct {
UINT8 state;
tBTA_GATTC_CACHE *p_srvc_cache;
tBTA_GATTC_CACHE *p_cur_srvc;
fixed_queue_t *cache_buffer; /* buffer queue used for storing the cache data */
UINT8 *p_free; /* starting point to next available byte */
UINT16 free_byte; /* number of available bytes in server cache buffer */
list_t *p_srvc_cache; /* list of tBTA_GATTC_SERVICE */
UINT8 update_count; /* indication received */
UINT8 num_clcb; /* number of associated CLCB */
@ -314,7 +270,7 @@ typedef struct {
UINT8 next_avail_idx;
UINT8 total_srvc;
UINT8 total_char;
UINT16 total_attr;
UINT8 srvc_hdl_chg; /* service handle change indication pending */
UINT16 attr_index; /* cahce NV saving/loading attribute index */
@ -328,8 +284,8 @@ typedef struct {
typedef struct {
BOOLEAN in_use;
BD_ADDR remote_bda;
tBTA_GATTC_CHAR_ID char_id;
} tBTA_GATTC_NOTIF_REG;
UINT16 handle;
}tBTA_GATTC_NOTIF_REG;
typedef struct {
tBTA_GATTC_CBACK *p_cback;
@ -403,11 +359,7 @@ typedef struct {
tBTA_GATTC_CLCB clcb[BTA_GATTC_CLCB_MAX];
tBTA_GATTC_SERV known_server[BTA_GATTC_KNOWN_SR_MAX];
#if (SDP_INCLUDED == TRUE)
tSDP_DISCOVERY_DB *p_sdp_db;
#endif ///SDP_INCLUDED == TRUE
UINT16 sdp_conn_id;
} tBTA_GATTC_CB;
}tBTA_GATTC_CB;
typedef enum {
SERVICE_CHANGE_CCC_WRITTEN_SUCCESS = 0,
@ -474,10 +426,7 @@ extern void bta_gattc_confirm(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_execute(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_read_multi(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_ci_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_ci_load(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_ci_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_ci_save(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_cache_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_ignore_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern void bta_gattc_restart_discover(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_msg);
extern void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *p_clreg);
@ -509,20 +458,13 @@ extern tBTA_GATTC_CLCB *bta_gattc_find_int_disconn_clcb(tBTA_GATTC_DATA *p_msg);
extern BOOLEAN bta_gattc_enqueue(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
extern UINT16 bta_gattc_id2handle(tBTA_GATTC_SERV *p_srcb, tBTA_GATT_SRVC_ID *p_service_id, tBTA_GATT_ID *p_char_id, tBTA_GATT_ID *p_descr_uuid);
extern BOOLEAN bta_gattc_handle2id(tBTA_GATTC_SERV *p_srcb, UINT16 handle, tBTA_GATT_SRVC_ID *service_id, tBTA_GATT_ID *char_id, tBTA_GATT_ID *p_type);
extern BOOLEAN bta_gattc_uuid_compare (tBT_UUID *p_src, tBT_UUID *p_tar, BOOLEAN is_precise);
extern void bta_gattc_pack_attr_uuid(tBTA_GATTC_CACHE_ATTR *p_attr, tBT_UUID *p_uuid);
extern BOOLEAN bta_gattc_uuid_compare (const tBT_UUID *p_src, const tBT_UUID *p_tar, BOOLEAN is_precise);
extern BOOLEAN bta_gattc_check_notif_registry(tBTA_GATTC_RCB *p_clreg, tBTA_GATTC_SERV *p_srcb, tBTA_GATTC_NOTIFY *p_notify);
extern tBTA_GATT_STATUS bta_gattc_pack_read_cb_data(tBTA_GATTC_SERV *p_srcb, tBT_UUID *p_descr_uuid, tGATT_VALUE *p_attr, tBTA_GATT_READ_VAL *p_value);
extern BOOLEAN bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR remote_bda, BOOLEAN add, BOOLEAN is_listen);
extern BOOLEAN bta_gattc_check_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR remote_bda, UINT8 role);
extern UINT8 bta_gattc_num_reg_app(void);
extern void bta_gattc_clear_notif_registration(UINT16 conn_id);
extern tBTA_GATTC_SERV *bta_gattc_find_srvr_cache(BD_ADDR bda);
extern BOOLEAN bta_gattc_charid_compare(tBTA_GATTC_CHAR_ID *p_src, tBTA_GATTC_CHAR_ID *p_tar);
extern BOOLEAN bta_gattc_srvcid_compare(tBTA_GATT_SRVC_ID *p_src, tBTA_GATT_SRVC_ID *p_tar);
extern void bta_gattc_cpygattid(tBTA_GATT_ID *p_des, tBTA_GATT_ID *p_src);
extern void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id, UINT16 start_handle, UINT16 end_handle);
extern tBTA_GATTC_SERV * bta_gattc_find_srvr_cache(BD_ADDR bda);
/* discovery functions */
extern void bta_gattc_disc_res_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_DISC_RES *p_data);
@ -530,17 +472,41 @@ extern void bta_gattc_disc_cmpl_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type
extern tBTA_GATT_STATUS bta_gattc_discover_procedure(UINT16 conn_id, tBTA_GATTC_SERV *p_server_cb, UINT8 disc_type);
extern tBTA_GATT_STATUS bta_gattc_discover_pri_service(UINT16 conn_id, tBTA_GATTC_SERV *p_server_cb, UINT8 disc_type);
extern void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid);
extern tBTA_GATT_STATUS bta_gattc_query_cache(UINT16 conn_id, UINT8 query_type, tBTA_GATT_SRVC_ID *p_srvc_id,
tBTA_GATT_ID *p_start_rec, tBT_UUID *p_uuid_cond,
tBTA_GATT_ID *p_output, void *p_param);
extern tBTA_GATT_STATUS bta_gattc_init_cache(tBTA_GATTC_SERV *p_srvc_cb);
extern void bta_gattc_rebuild_cache(tBTA_GATTC_SERV *p_srcv, UINT16 num_attr, tBTA_GATTC_NV_ATTR *p_attr, UINT16 attr_index);
extern BOOLEAN bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id);
extern const list_t* bta_gattc_get_services(UINT16 conn_id);
extern const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id, UINT16 handle);
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle);
extern tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle);
extern tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle);
extern void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
extern void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
extern void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
btgatt_db_element_t **svc_db,
int *count);
extern void bta_gattc_get_db_with_opration(UINT16 conn_id,
bt_gatt_get_db_op_t op,
UINT16 char_handle,
tBT_UUID *incl_uuid,
tBT_UUID *char_uuid,
tBT_UUID *descr_uuid,
UINT16 start_handle, UINT16 end_handle,
btgatt_db_element_t **char_db,
int *count);
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count);
extern tBTA_GATT_STATUS bta_gattc_init_cache(tBTA_GATTC_SERV *p_srvc_cb);
extern void bta_gattc_rebuild_cache(tBTA_GATTC_SERV *p_srcv, UINT16 num_attr, tBTA_GATTC_NV_ATTR *attr);
extern void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id);
extern void bta_gattc_reset_discover_st(tBTA_GATTC_SERV *p_srcb, tBTA_GATT_STATUS status);
extern tBTA_GATTC_CONN *bta_gattc_conn_alloc(BD_ADDR remote_bda);
extern tBTA_GATTC_CONN *bta_gattc_conn_find(BD_ADDR remote_bda);
extern tBTA_GATTC_CONN *bta_gattc_conn_find_alloc(BD_ADDR remote_bda);
extern BOOLEAN bta_gattc_conn_dealloc(BD_ADDR remote_bda);
extern bool bta_gattc_cache_load(tBTA_GATTC_CLCB *p_clcb);
extern void bta_gattc_cache_reset(BD_ADDR server_bda);
#endif /* BTA_GATTC_INT_H */