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
This commit is contained in:
Andre Eisenbach 2013-07-09 00:02:48 -07:00 committed by Matthew Xie
parent 6e548cf960
commit 02223d1602
2 changed files with 23 additions and 23 deletions

View file

@ -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);

View file

@ -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;