Use handles to identify GATT attributes (2/4)

Bug: 27778668
Change-Id: Iff64153c2b783705fb4408f9911b13fa44af4f84
This commit is contained in:
Jakub Pawlowski 2016-03-17 15:57:03 -07:00 committed by Andre Eisenbach
parent 98aa0ddd6c
commit 8d7a02d607

View file

@ -40,9 +40,7 @@ typedef struct
/** Parameters for GATT read operations */ /** Parameters for GATT read operations */
typedef struct typedef struct
{ {
btgatt_srvc_id_t srvc_id; uint16_t handle;
btgatt_gatt_id_t char_id;
btgatt_gatt_id_t descr_id;
btgatt_unformatted_value_t value; btgatt_unformatted_value_t value;
uint16_t value_type; uint16_t value_type;
uint8_t status; uint8_t status;
@ -62,8 +60,7 @@ typedef struct
{ {
uint8_t value[BTGATT_MAX_ATTR_LEN]; uint8_t value[BTGATT_MAX_ATTR_LEN];
bt_bdaddr_t bda; bt_bdaddr_t bda;
btgatt_srvc_id_t srvc_id; uint16_t handle;
btgatt_gatt_id_t char_id;
uint16_t len; uint16_t len;
uint8_t is_notify; uint8_t is_notify;
} btgatt_notify_params_t; } btgatt_notify_params_t;
@ -139,8 +136,7 @@ typedef void (*search_complete_callback)(int conn_id, int status);
/** Callback invoked in response to [de]register_for_notification */ /** Callback invoked in response to [de]register_for_notification */
typedef void (*register_for_notification_callback)(int conn_id, typedef void (*register_for_notification_callback)(int conn_id,
int registered, int status, btgatt_srvc_id_t *srvc_id, int registered, int status, uint16_t handle);
btgatt_gatt_id_t *char_id);
/** /**
* Remote device notification callback, invoked when a remote device sends * Remote device notification callback, invoked when a remote device sends
@ -153,8 +149,7 @@ typedef void (*read_characteristic_callback)(int conn_id, int status,
btgatt_read_params_t *p_data); btgatt_read_params_t *p_data);
/** GATT write characteristic operation callback */ /** GATT write characteristic operation callback */
typedef void (*write_characteristic_callback)(int conn_id, int status, typedef void (*write_characteristic_callback)(int conn_id, int status, uint16_t handle);
btgatt_write_params_t *p_data);
/** GATT execute prepared write callback */ /** GATT execute prepared write callback */
typedef void (*execute_write_callback)(int conn_id, int status); typedef void (*execute_write_callback)(int conn_id, int status);
@ -164,8 +159,7 @@ typedef void (*read_descriptor_callback)(int conn_id, int status,
btgatt_read_params_t *p_data); btgatt_read_params_t *p_data);
/** Callback invoked in response to write_descriptor */ /** Callback invoked in response to write_descriptor */
typedef void (*write_descriptor_callback)(int conn_id, int status, typedef void (*write_descriptor_callback)(int conn_id, int status, uint16_t handle);
btgatt_write_params_t *p_data);
/** Callback triggered in response to read_remote_rssi */ /** Callback triggered in response to read_remote_rssi */
typedef void (*read_remote_rssi_callback)(int client_if, bt_bdaddr_t* bda, typedef void (*read_remote_rssi_callback)(int client_if, bt_bdaddr_t* bda,
@ -305,25 +299,20 @@ typedef struct {
bt_status_t (*search_service)(int conn_id, bt_uuid_t *filter_uuid ); bt_status_t (*search_service)(int conn_id, bt_uuid_t *filter_uuid );
/** Read a characteristic on a remote device */ /** Read a characteristic on a remote device */
bt_status_t (*read_characteristic)( int conn_id, bt_status_t (*read_characteristic)( int conn_id, uint16_t handle,
btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
int auth_req ); int auth_req );
/** Write a remote characteristic */ /** Write a remote characteristic */
bt_status_t (*write_characteristic)(int conn_id, bt_status_t (*write_characteristic)(int conn_id, uint16_t handle,
btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
int write_type, int len, int auth_req, int write_type, int len, int auth_req,
char* p_value); char* p_value);
/** Read the descriptor for a given characteristic */ /** Read the descriptor for a given characteristic */
bt_status_t (*read_descriptor)(int conn_id, bt_status_t (*read_descriptor)(int conn_id, uint16_t handle, int auth_req);
btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
btgatt_gatt_id_t *descr_id, int auth_req);
/** Write a remote descriptor for a given characteristic */ /** Write a remote descriptor for a given characteristic */
bt_status_t (*write_descriptor)( int conn_id, bt_status_t (*write_descriptor)( int conn_id, uint16_t handle,
btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, int write_type, int len,
btgatt_gatt_id_t *descr_id, int write_type, int len,
int auth_req, char* p_value); int auth_req, char* p_value);
/** Execute a prepared write operation */ /** Execute a prepared write operation */
@ -334,13 +323,11 @@ typedef struct {
* characteristic * characteristic
*/ */
bt_status_t (*register_for_notification)( int client_if, bt_status_t (*register_for_notification)( int client_if,
const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id, const bt_bdaddr_t *bd_addr, uint16_t handle);
btgatt_gatt_id_t *char_id);
/** Deregister a previous request for notifications/indications */ /** Deregister a previous request for notifications/indications */
bt_status_t (*deregister_for_notification)( int client_if, bt_status_t (*deregister_for_notification)( int client_if,
const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id, const bt_bdaddr_t *bd_addr, uint16_t handle);
btgatt_gatt_id_t *char_id);
/** Request RSSI for a given remote device */ /** Request RSSI for a given remote device */
bt_status_t (*read_remote_rssi)( int client_if, const bt_bdaddr_t *bd_addr); bt_status_t (*read_remote_rssi)( int client_if, const bt_bdaddr_t *bd_addr);