From 8cb1baefa184a560d4ad4ab6e3a69524019fc426 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowski Date: Wed, 26 Oct 2016 14:49:48 -0700 Subject: [PATCH] Separate LE scanner from GATT client (3/4) Right now, LE scanning functionality is combined with the GATT client. This is the source of various bugs, like scans suddenly stoppinging when a GATT client is killed. It also increases memory consumption, because we associate many structures with a GATT client, which are not necessary when just scanning. Test: sl4a BleScanApiTest ConcurrentBleScanTest Bug: 30622771 Change-Id: I5c2608b769bd6aec54900357cdccfa22987962c9 --- include/hardware/bt_gatt_client.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/hardware/bt_gatt_client.h b/include/hardware/bt_gatt_client.h index 6cd8394a..93879075 100644 --- a/include/hardware/bt_gatt_client.h +++ b/include/hardware/bt_gatt_client.h @@ -121,6 +121,10 @@ typedef enum typedef void (*register_client_callback)(int status, int client_if, bt_uuid_t *app_uuid); +/** Callback invoked in response to register_scanner */ +typedef void (*register_scanner_callback)(int status, int scanner_id, + bt_uuid_t *app_uuid); + /** Callback for scan results */ typedef void (*scan_result_callback)(bt_bdaddr_t* bda, int rssi, vector adv_data); @@ -224,6 +228,7 @@ typedef void (*services_added_callback)(int conn_id, btgatt_db_element_t *added, typedef struct { register_client_callback register_client_cb; + register_scanner_callback register_scanner_cb; scan_result_callback scan_result_cb; connect_callback open_cb; disconnect_callback close_cb; @@ -262,6 +267,12 @@ typedef struct { /** Unregister a client application from the stack */ bt_status_t (*unregister_client)(int client_if ); + /** Registers a scanner with the stack */ + bt_status_t (*register_scanner)( bt_uuid_t *uuid ); + + /** Unregister a scanner from the stack */ + bt_status_t (*unregister_scanner)(int scanner_id ); + /** Start or stop LE device scanning */ bt_status_t (*scan)( bool start );