summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Pawlowski <jpawlowski@google.com>2016-01-21 23:40:51 -0800
committerJakub Pawlowski <jpawlowski@google.com>2016-01-29 20:13:15 +0000
commitf2e1352d6c31c19fda3ffb2f61795fb506bc76fb (patch)
tree381a1b7a7ef4cbc3a9e908bcd5fc853b1e9d8ee3
parentf704e8a939a4bfb85127b31e7226589e9e31b98d (diff)
downloadlibhardware-f2e1352d6c31c19fda3ffb2f61795fb506bc76fb.tar.gz
Add get_gatt_db to Bluetooth HAL
This patch adds new method, get_gatt_db to bluetooth HAL. It can be used to grab whole GATT database in one request. It will trigger get_gatt_db_callback, which is also part of this patch. Change-Id: I1a931f126db56e7a29537f3bca9cddff3dd27dc6
-rw-r--r--include/hardware/bt_common_types.h31
-rw-r--r--include/hardware/bt_gatt_client.h7
2 files changed, 38 insertions, 0 deletions
diff --git a/include/hardware/bt_common_types.h b/include/hardware/bt_common_types.h
index e30ac24e..77c845ba 100644
--- a/include/hardware/bt_common_types.h
+++ b/include/hardware/bt_common_types.h
@@ -41,4 +41,35 @@ typedef struct
uint8_t *p_scan_rsp_data;
} btgatt_track_adv_info_t;
+typedef enum
+{
+ BTGATT_DB_PRIMARY_SERVICE,
+ BTGATT_DB_SECONDARY_SERVICE,
+ BTGATT_DB_INCLUDED_SERVICE,
+ BTGATT_DB_CHARACTERISTIC,
+ BTGATT_DB_DESCRIPTOR,
+} bt_gatt_db_attribute_type_t;
+
+typedef struct
+{
+ uint8_t id;
+ bt_uuid_t uuid;
+ bt_gatt_db_attribute_type_t type;
+ uint16_t attribute_handle;
+
+ /*
+ * If |type| is |BTGATT_DB_PRIMARY_SERVICE|, or
+ * |BTGATT_DB_SECONDARY_SERVICE|, this contains the start and end attribute
+ * handles.
+ */
+ uint16_t start_handle;
+ uint16_t end_handle;
+
+ /*
+ * If |type| is |BTGATT_DB_CHARACTERISTIC|, this contains the properties of
+ * the characteristic.
+ */
+ uint8_t properties;
+} btgatt_db_element_t;
+
#endif /* ANDROID_INCLUDE_BT_COMMON_TYPES_H */
diff --git a/include/hardware/bt_gatt_client.h b/include/hardware/bt_gatt_client.h
index e7e8e82b..45e8b268 100644
--- a/include/hardware/bt_gatt_client.h
+++ b/include/hardware/bt_gatt_client.h
@@ -245,6 +245,9 @@ typedef void (*track_adv_event_callback)(btgatt_track_adv_info_t *p_track_adv_in
typedef void (*scan_parameter_setup_completed_callback)(int client_if,
btgattc_error_t status);
+/** GATT get database callback */
+typedef void (*get_gatt_db_callback)(int conn_id, btgatt_db_element_t *db, int count);
+
typedef struct {
register_client_callback register_client_cb;
scan_result_callback scan_result_cb;
@@ -279,6 +282,7 @@ typedef struct {
batchscan_threshold_callback batchscan_threshold_cb;
track_adv_event_callback track_adv_event_cb;
scan_parameter_setup_completed_callback scan_parameter_setup_completed_cb;
+ get_gatt_db_callback get_gatt_db_cb;
} btgatt_client_callbacks_t;
/** Represents the standard BT-GATT client interface. */
@@ -448,6 +452,9 @@ typedef struct {
/** Test mode interface */
bt_status_t (*test_command)( int command, btgatt_test_params_t* params);
+ /** Get gatt db content */
+ bt_status_t (*get_gatt_db)( int conn_id);
+
} btgatt_client_interface_t;
__END_DECLS