From 02223d1602c1728b3c94f68059d1b2e76d35dbd3 Mon Sep 17 00:00:00 2001 From: Andre Eisenbach Date: Tue, 9 Jul 2013 00:02:48 -0700 Subject: [PATCH] LE: Add instance ID to descriptors (3/4) If a remote devices offers multiple descriptors with the same UUID, the instance ID is used to differentiate between them. Change-Id: Ia5ab989f222a5cf1b7cb66966ad4f91f2b660708 --- include/hardware/bt_gatt_client.h | 40 +++++++++++++++++++-------------------- include/hardware/bt_gatt_types.h | 6 +++--- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/hardware/bt_gatt_client.h b/include/hardware/bt_gatt_client.h index 8b49f59..c03e774 100644 --- a/include/hardware/bt_gatt_client.h +++ b/include/hardware/bt_gatt_client.h @@ -40,8 +40,8 @@ typedef struct typedef struct { btgatt_srvc_id_t srvc_id; - btgatt_char_id_t char_id; - bt_uuid_t descr_id; + btgatt_gatt_id_t char_id; + btgatt_gatt_id_t descr_id; btgatt_unformatted_value_t value; uint16_t value_type; uint8_t status; @@ -51,8 +51,8 @@ typedef struct typedef struct { btgatt_srvc_id_t srvc_id; - btgatt_char_id_t char_id; - bt_uuid_t descr_id; + btgatt_gatt_id_t char_id; + btgatt_gatt_id_t descr_id; uint8_t status; } btgatt_write_params_t; @@ -62,7 +62,7 @@ typedef struct uint8_t value[BTGATT_MAX_ATTR_LEN]; bt_bdaddr_t bda; btgatt_srvc_id_t srvc_id; - btgatt_char_id_t char_id; + btgatt_gatt_id_t char_id; uint16_t len; uint8_t is_notify; } btgatt_notify_params_t; @@ -105,13 +105,13 @@ typedef void (*search_result_callback)( int conn_id, btgatt_srvc_id_t *srvc_id); /** GATT characteristic enumeration result callback */ typedef void (*get_characteristic_callback)(int conn_id, int status, - btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id, + btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, int char_prop); /** GATT descriptor enumeration result callback */ typedef void (*get_descriptor_callback)(int conn_id, int status, - btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id, - bt_uuid_t *descr_id); + btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, + btgatt_gatt_id_t *descr_id); /** GATT included service enumeration result callback */ typedef void (*get_included_service_callback)(int conn_id, int status, @@ -120,7 +120,7 @@ typedef void (*get_included_service_callback)(int conn_id, int status, /** Callback invoked in response to [de]register_for_notification */ typedef void (*register_for_notification_callback)(int conn_id, int registered, int status, btgatt_srvc_id_t *srvc_id, - btgatt_char_id_t *char_id); + btgatt_gatt_id_t *char_id); /** * Remote device notification callback, invoked when a remote device sends @@ -212,36 +212,36 @@ typedef struct { * Set start_char_id to NULL to get the first characteristic. */ bt_status_t (*get_characteristic)( int conn_id, - btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *start_char_id); + btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *start_char_id); /** * Enumerate descriptors for a given characteristic. * Set start_descr_id to NULL to get the first descriptor. */ bt_status_t (*get_descriptor)( int conn_id, - btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id, - bt_uuid_t *start_descr_id); + btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, + btgatt_gatt_id_t *start_descr_id); /** Read a characteristic on a remote device */ bt_status_t (*read_characteristic)( int conn_id, - btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id, + btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, int auth_req ); /** Write a remote characteristic */ bt_status_t (*write_characteristic)(int conn_id, - btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id, + btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, int write_type, int len, int auth_req, char* p_value); /** Read the descriptor for a given characteristic */ bt_status_t (*read_descriptor)(int conn_id, - btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id, - bt_uuid_t *descr_id, 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 */ bt_status_t (*write_descriptor)( int conn_id, - btgatt_srvc_id_t *srvc_id, btgatt_char_id_t *char_id, - bt_uuid_t *descr_id, int write_type, int len, + btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id, + btgatt_gatt_id_t *descr_id, int write_type, int len, int auth_req, char* p_value); /** Execute a prepared write operation */ @@ -253,12 +253,12 @@ typedef struct { */ bt_status_t (*register_for_notification)( int client_if, const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id, - btgatt_char_id_t *char_id); + btgatt_gatt_id_t *char_id); /** Deregister a previous request for notifications/indications */ bt_status_t (*deregister_for_notification)( int client_if, const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id, - btgatt_char_id_t *char_id); + btgatt_gatt_id_t *char_id); /** Request RSSI for a given remote device */ bt_status_t (*read_remote_rssi)( int client_if, const bt_bdaddr_t *bd_addr); diff --git a/include/hardware/bt_gatt_types.h b/include/hardware/bt_gatt_types.h index fee9bb5..0ac217e 100644 --- a/include/hardware/bt_gatt_types.h +++ b/include/hardware/bt_gatt_types.h @@ -29,17 +29,17 @@ __BEGIN_DECLS #define BTGATT_SERVICE_TYPE_PRIMARY 0 #define BTGATT_SERVICE_TYPE_SECONDARY 1 -/** GATT Characteristic ID adding instance id tracking to the UUID */ +/** GATT ID adding instance id tracking to the UUID */ typedef struct { bt_uuid_t uuid; uint8_t inst_id; -} btgatt_char_id_t; +} btgatt_gatt_id_t; /** GATT Service ID also identifies the service type (primary/secondary) */ typedef struct { - btgatt_char_id_t id; + btgatt_gatt_id_t id; uint8_t is_primary; } btgatt_srvc_id_t; -- 2.11.0