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
diff --git a/include/hardware/bt_common_types.h b/include/hardware/bt_common_types.h
index e30ac24..77c845b 100644
--- a/include/hardware/bt_common_types.h
+++ b/include/hardware/bt_common_types.h
@@ -41,4 +41,35 @@
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 e7e8e82..45e8b26 100644
--- a/include/hardware/bt_gatt_client.h
+++ b/include/hardware/bt_gatt_client.h
@@ -245,6 +245,9 @@
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 @@
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 @@
/** 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