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
This commit is contained in:
Jakub Pawlowski 2016-10-26 14:49:48 -07:00 committed by Andre Eisenbach
parent d20fe45ed5
commit 8cb1baefa1

View file

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