summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/btif/src/btif_ble_advertiser.cc2
-rw-r--r--system/btif/src/btif_ble_scanner.cc199
-rw-r--r--system/btif/src/btif_gatt_client.cc1
-rw-r--r--system/btif/src/btif_gatt_server.cc2
-rw-r--r--system/service/gatt_server_old.cc7
-rw-r--r--system/service/hal/bluetooth_gatt_interface.cc6
-rw-r--r--system/service/test/low_energy_scanner_unittest.cc35
-rw-r--r--system/stack/btm/btm_ble_gap.cc32
-rw-r--r--system/stack/include/btm_ble_api.h27
9 files changed, 88 insertions, 223 deletions
diff --git a/system/btif/src/btif_ble_advertiser.cc b/system/btif/src/btif_ble_advertiser.cc
index 63af8592bf..f30192e30b 100644
--- a/system/btif/src/btif_ble_advertiser.cc
+++ b/system/btif/src/btif_ble_advertiser.cc
@@ -32,8 +32,6 @@ using base::Bind;
using base::Owned;
using std::vector;
-extern bt_status_t do_in_jni_thread(const base::Closure& task);
-
namespace {
template <typename T>
diff --git a/system/btif/src/btif_ble_scanner.cc b/system/btif/src/btif_ble_scanner.cc
index 72d1392c72..4fb351780c 100644
--- a/system/btif/src/btif_ble_scanner.cc
+++ b/system/btif/src/btif_ble_scanner.cc
@@ -50,7 +50,6 @@ using base::Owned;
using std::vector;
using RegisterCallback = BleScannerInterface::RegisterCallback;
-extern bt_status_t do_in_jni_thread(const base::Closure& task);
extern const btgatt_callbacks_t* bt_gatt_callbacks;
#define SCAN_CBACK_IN_JNI(P_CBACK, ...) \
@@ -99,60 +98,6 @@ bool btif_gattc_find_bdaddr(BD_ADDR p_bda) {
void btif_gattc_init_dev_cb(void) { p_dev_cb.clear(); }
-btgattc_error_t btif_gattc_translate_btm_status(tBTM_STATUS status) {
- switch (status) {
- case BTM_SUCCESS:
- case BTM_SUCCESS_NO_SECURITY:
- return BT_GATTC_COMMAND_SUCCESS;
-
- case BTM_CMD_STARTED:
- return BT_GATTC_COMMAND_STARTED;
-
- case BTM_BUSY:
- return BT_GATTC_COMMAND_BUSY;
-
- case BTM_CMD_STORED:
- return BT_GATTC_COMMAND_STORED;
-
- case BTM_NO_RESOURCES:
- return BT_GATTC_NO_RESOURCES;
-
- case BTM_MODE_UNSUPPORTED:
- case BTM_WRONG_MODE:
- case BTM_MODE4_LEVEL4_NOT_SUPPORTED:
- return BT_GATTC_MODE_UNSUPPORTED;
-
- case BTM_ILLEGAL_VALUE:
- case BTM_SCO_BAD_LENGTH:
- return BT_GATTC_ILLEGAL_VALUE;
-
- case BTM_UNKNOWN_ADDR:
- return BT_GATTC_UNKNOWN_ADDR;
-
- case BTM_DEVICE_TIMEOUT:
- return BT_GATTC_DEVICE_TIMEOUT;
-
- case BTM_FAILED_ON_SECURITY:
- case BTM_REPEATED_ATTEMPTS:
- case BTM_NOT_AUTHORIZED:
- return BT_GATTC_SECURITY_ERROR;
-
- case BTM_DEV_RESET:
- case BTM_ILLEGAL_ACTION:
- return BT_GATTC_INCORRECT_STATE;
-
- case BTM_BAD_VALUE_RET:
- return BT_GATTC_INVALID_CONTROLLER_OUTPUT;
-
- case BTM_DELAY_CHECK:
- return BT_GATTC_DELAYED_ENCRYPTION_CHECK;
-
- case BTM_ERR_PROCESSING:
- default:
- return BT_GATTC_ERR_PROCESSING;
- }
-}
-
void btif_gatts_upstreams_evt(uint16_t event, char* p_param) {
LOG_VERBOSE(LOG_TAG, "%s: Event %d", __func__, event);
@@ -180,30 +125,6 @@ void bta_gatts_cback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data) {
ASSERTC(status == BT_STATUS_SUCCESS, "Context transfer failed!", status);
}
-void bta_scan_param_setup_cb(tGATT_IF client_if, tBTM_STATUS status) {
- SCAN_CBACK_IN_JNI(scan_parameter_setup_completed_cb, client_if,
- btif_gattc_translate_btm_status(status));
-}
-
-void bta_scan_filt_cfg_cb(uint8_t filt_type, uint8_t client_if,
- tBTM_BLE_PF_AVBL_SPACE avbl_space,
- tBTM_BLE_PF_ACTION action, tBTA_STATUS status) {
- SCAN_CBACK_IN_JNI(scan_filter_cfg_cb, action, client_if, status, filt_type,
- avbl_space);
-}
-
-void bta_scan_filt_param_setup_cb(tBTM_BLE_REF_VALUE ref_value,
- tBTM_BLE_PF_AVBL_SPACE avbl_space,
- uint8_t action_type, tBTA_STATUS status) {
- SCAN_CBACK_IN_JNI(scan_filter_param_cb, action_type, ref_value, status,
- avbl_space);
-}
-
-void bta_scan_filt_status_cb(tBTM_BLE_REF_VALUE ref_value, uint8_t action,
- tBTA_STATUS status) {
- SCAN_CBACK_IN_JNI(scan_filter_status_cb, action, ref_value, status);
-}
-
void bta_batch_scan_threshold_cb(tBTM_BLE_REF_VALUE ref_value) {
SCAN_CBACK_IN_JNI(batchscan_threshold_cb, ref_value);
}
@@ -310,20 +231,14 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
~BleScannerInterfaceImpl(){};
void RegisterScanner(RegisterCallback cb) override {
- do_in_bta_thread(
- FROM_HERE,
- Bind(
- [](RegisterCallback cb) {
- BTA_GATTC_AppRegister(
- bta_gatts_cback,
- base::Bind(
- [](RegisterCallback cb, uint8_t client_id,
- uint8_t status) {
- do_in_jni_thread(base::Bind(cb, client_id, status));
- },
- std::move(cb)));
- },
- std::move(cb)));
+ do_in_bta_thread(FROM_HERE,
+ Bind(
+ [](RegisterCallback cb) {
+ BTA_GATTC_AppRegister(
+ bta_gatts_cback,
+ jni_thread_wrapper(FROM_HERE, std::move(cb)));
+ },
+ std::move(cb)));
}
void Unregister(int scanner_id) override {
@@ -344,7 +259,8 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
void ScanFilterParamSetup(
uint8_t client_if, uint8_t action, uint8_t filt_index,
- std::unique_ptr<btgatt_filt_param_setup_t> filt_param) override {
+ std::unique_ptr<btgatt_filt_param_setup_t> filt_param,
+ FilterParamSetupCallback cb) override {
BTIF_TRACE_DEBUG("%s", __func__);
if (filt_param && filt_param->dely_mode == 1) {
@@ -353,20 +269,19 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
client_if));
}
- do_in_bta_thread(
- FROM_HERE,
- base::Bind(&BTM_BleAdvFilterParamSetup, action, filt_index,
- base::Passed(&filt_param),
- base::Bind(&bta_scan_filt_param_setup_cb, client_if)));
+ do_in_bta_thread(FROM_HERE,
+ base::Bind(&BTM_BleAdvFilterParamSetup, action, filt_index,
+ base::Passed(&filt_param),
+ jni_thread_wrapper(FROM_HERE, std::move(cb))));
}
- void ScanFilterAddRemove(int client_if, int action, int filt_type,
- int filt_index, int company_id, int company_id_mask,
+ void ScanFilterAddRemove(int action, int filt_type, int filt_index,
+ int company_id, int company_id_mask,
const bt_uuid_t* p_uuid,
const bt_uuid_t* p_uuid_mask,
const bt_bdaddr_t* bd_addr, char addr_type,
- vector<uint8_t> data,
- vector<uint8_t> mask) override {
+ vector<uint8_t> data, vector<uint8_t> mask,
+ FilterConfigCallback cb) override {
BTIF_TRACE_DEBUG("%s, %d, %d", __func__, action, filt_type);
/* If data is passed, both mask and data have to be the same length */
@@ -383,7 +298,7 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
FROM_HERE,
base::Bind(&BTM_LE_PF_addr_filter, action, filt_index,
std::move(target_addr),
- Bind(&bta_scan_filt_cfg_cb, filt_type, client_if)));
+ jni_thread_wrapper(FROM_HERE, Bind(cb, filt_type))));
return;
}
@@ -402,7 +317,7 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
FROM_HERE,
base::Bind(&BTM_LE_PF_uuid_filter, action, filt_index, filt_type,
bt_uuid, BTM_BLE_PF_LOGIC_AND, nullptr,
- Bind(&bta_scan_filt_cfg_cb, filt_type, client_if)));
+ jni_thread_wrapper(FROM_HERE, Bind(cb, filt_type))));
return;
}
@@ -412,15 +327,16 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
FROM_HERE,
base::Bind(&BTM_LE_PF_uuid_filter, action, filt_index, filt_type,
bt_uuid, BTM_BLE_PF_LOGIC_AND, base::Owned(mask),
- Bind(&bta_scan_filt_cfg_cb, filt_type, client_if)));
+ jni_thread_wrapper(FROM_HERE, Bind(cb, filt_type))));
return;
}
case BTM_BLE_PF_LOCAL_NAME: {
do_in_bta_thread(
- FROM_HERE, base::Bind(&BTM_LE_PF_local_name, action, filt_index,
- std::move(data), Bind(&bta_scan_filt_cfg_cb,
- filt_type, client_if)));
+ FROM_HERE,
+ base::Bind(&BTM_LE_PF_local_name, action, filt_index,
+ std::move(data),
+ jni_thread_wrapper(FROM_HERE, Bind(cb, filt_type))));
return;
}
@@ -429,7 +345,7 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
FROM_HERE,
base::Bind(&BTM_LE_PF_manu_data, action, filt_index, company_id,
company_id_mask, std::move(data), std::move(mask),
- Bind(&bta_scan_filt_cfg_cb, filt_type, client_if)));
+ jni_thread_wrapper(FROM_HERE, Bind(cb, filt_type))));
return;
}
@@ -438,7 +354,7 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
FROM_HERE,
base::Bind(&BTM_LE_PF_srvc_data_pattern, action, filt_index,
std::move(data), std::move(mask),
- Bind(&bta_scan_filt_cfg_cb, filt_type, client_if)));
+ jni_thread_wrapper(FROM_HERE, Bind(cb, filt_type))));
return;
}
@@ -448,70 +364,55 @@ class BleScannerInterfaceImpl : public BleScannerInterface {
}
}
- void ScanFilterClear(int client_if, int filter_index) override {
+ void ScanFilterClear(int filter_index, FilterConfigCallback cb) override {
BTIF_TRACE_DEBUG("%s: filter_index: %d", __func__, filter_index);
do_in_bta_thread(FROM_HERE,
base::Bind(&BTM_LE_PF_clear, filter_index,
- Bind(&bta_scan_filt_cfg_cb, BTM_BLE_PF_TYPE_ALL,
- client_if)));
+ jni_thread_wrapper(
+ FROM_HERE, Bind(cb, BTM_BLE_PF_TYPE_ALL))));
}
- void ScanFilterEnable(int client_if, bool enable) override {
+ void ScanFilterEnable(bool enable, EnableCallback cb) override {
BTIF_TRACE_DEBUG("%s: enable: %d", __func__, enable);
uint8_t action = enable ? 1 : 0;
- do_in_bta_thread(
- FROM_HERE, base::Bind(&BTM_BleEnableDisableFilterFeature, action,
- base::Bind(&bta_scan_filt_status_cb, client_if)));
+ do_in_bta_thread(FROM_HERE,
+ base::Bind(&BTM_BleEnableDisableFilterFeature, action,
+ jni_thread_wrapper(FROM_HERE, std::move(cb))));
}
- void SetScanParameters(int client_if, int scan_interval,
- int scan_window) override {
+ void SetScanParameters(int scan_interval, int scan_window,
+ Callback cb) override {
do_in_bta_thread(
- FROM_HERE,
- base::Bind(&BTM_BleSetScanParams, client_if, scan_interval, scan_window,
- BTM_BLE_SCAN_MODE_ACTI, bta_scan_param_setup_cb));
+ FROM_HERE, base::Bind(&BTM_BleSetScanParams, scan_interval, scan_window,
+ BTM_BLE_SCAN_MODE_ACTI,
+ jni_thread_wrapper(FROM_HERE, std::move(cb))));
}
void BatchscanConfigStorage(int client_if, int batch_scan_full_max,
int batch_scan_trunc_max,
- int batch_scan_notify_threshold) override {
- base::Callback<void(uint8_t /* status */)> cb = base::Bind(
- [](int client_if, uint8_t status) {
- SCAN_CBACK_IN_JNI(batchscan_cfg_storage_cb, client_if, status);
- },
- client_if);
-
+ int batch_scan_notify_threshold,
+ Callback cb) override {
do_in_bta_thread(
FROM_HERE,
base::Bind(&BTM_BleSetStorageConfig, (uint8_t)batch_scan_full_max,
(uint8_t)batch_scan_trunc_max,
- (uint8_t)batch_scan_notify_threshold, cb,
+ (uint8_t)batch_scan_notify_threshold,
+ jni_thread_wrapper(FROM_HERE, cb),
bta_batch_scan_threshold_cb, (tBTM_BLE_REF_VALUE)client_if));
}
- void BatchscanEnable(int client_if, int scan_mode, int scan_interval,
- int scan_window, int addr_type,
- int discard_rule) override {
- auto cb = base::Bind(
- [](int client_if, uint8_t status) {
- SCAN_CBACK_IN_JNI(batchscan_enb_disable_cb, 1, client_if, status);
- },
- client_if);
-
+ void BatchscanEnable(int scan_mode, int scan_interval, int scan_window,
+ int addr_type, int discard_rule, Callback cb) override {
do_in_bta_thread(
FROM_HERE, base::Bind(&BTM_BleEnableBatchScan, scan_mode, scan_interval,
- scan_window, discard_rule, addr_type, cb));
+ scan_window, discard_rule, addr_type,
+ jni_thread_wrapper(FROM_HERE, cb)));
}
- void BatchscanDisable(int client_if) override {
- auto cb = base::Bind(
- [](int client_if, uint8_t status) {
- SCAN_CBACK_IN_JNI(batchscan_enb_disable_cb, 1, client_if, status);
- },
- client_if);
-
- do_in_bta_thread(FROM_HERE, base::Bind(&BTM_BleDisableBatchScan, cb));
+ void BatchscanDisable(Callback cb) override {
+ do_in_bta_thread(FROM_HERE, base::Bind(&BTM_BleDisableBatchScan,
+ jni_thread_wrapper(FROM_HERE, cb)));
}
void BatchscanReadReports(int client_if, int scan_mode) override {
diff --git a/system/btif/src/btif_gatt_client.cc b/system/btif/src/btif_gatt_client.cc
index 153f954e31..31a8bb0a23 100644
--- a/system/btif/src/btif_gatt_client.cc
+++ b/system/btif/src/btif_gatt_client.cc
@@ -55,7 +55,6 @@ using base::Bind;
using base::Owned;
using std::vector;
-extern bt_status_t do_in_jni_thread(const base::Closure& task);
extern bt_status_t btif_gattc_test_command_impl(int command,
btgatt_test_params_t* params);
extern const btgatt_callbacks_t* bt_gatt_callbacks;
diff --git a/system/btif/src/btif_gatt_server.cc b/system/btif/src/btif_gatt_server.cc
index 2bd06bbe2a..0583235af0 100644
--- a/system/btif/src/btif_gatt_server.cc
+++ b/system/btif/src/btif_gatt_server.cc
@@ -52,8 +52,6 @@ using base::Bind;
using base::Owned;
using std::vector;
-extern bt_status_t do_in_jni_thread(const base::Closure& task);
-
/*******************************************************************************
* Constants & Macros
******************************************************************************/
diff --git a/system/service/gatt_server_old.cc b/system/service/gatt_server_old.cc
index 7dfd2b164a..7860745dab 100644
--- a/system/service/gatt_server_old.cc
+++ b/system/service/gatt_server_old.cc
@@ -444,16 +444,9 @@ const btgatt_client_callbacks_t gatt_client_callbacks = {
const btgatt_scanner_callbacks_t gatt_scanner_callbacks = {
ScanResultCallback,
- nullptr, /* batchscan_cfg_storage_cb; */
- nullptr, /* batchscan_enb_disable_cb; */
nullptr, /* batchscan_reports_cb; */
nullptr, /* batchscan_threshold_cb; */
nullptr, /* track_adv_event_cb; */
- nullptr, /* scan_parameter_setup_completed_cb; */
- nullptr, /* scan_filter_cfg_cb; */
- nullptr, /* scan_filter_param_cb; */
- nullptr, /* scan_filter_status_cb; */
-
};
const btgatt_callbacks_t gatt_callbacks = {
diff --git a/system/service/hal/bluetooth_gatt_interface.cc b/system/service/hal/bluetooth_gatt_interface.cc
index ea72e7b54a..3830d4ee18 100644
--- a/system/service/hal/bluetooth_gatt_interface.cc
+++ b/system/service/hal/bluetooth_gatt_interface.cc
@@ -380,15 +380,9 @@ void MtuChangedCallback(int conn_id, int mtu) {
const btgatt_scanner_callbacks_t gatt_scanner_callbacks = {
ScanResultCallback,
- nullptr, // batchscan_cfg_storage_cb
- nullptr, // batchscan_enb_disable_cb
nullptr, // batchscan_reports_cb
nullptr, // batchscan_threshold_cb
nullptr, // track_adv_event_cb
- nullptr, // scan_parameter_setup_completed_cb
- nullptr, // scan_filter_cfg_cb
- nullptr, // scan_filter_param_cb
- nullptr, // scan_filter_status_cb
};
const btgatt_client_callbacks_t gatt_client_callbacks = {
diff --git a/system/service/test/low_energy_scanner_unittest.cc b/system/service/test/low_energy_scanner_unittest.cc
index 48762d6698..a53d2c4733 100644
--- a/system/service/test/low_energy_scanner_unittest.cc
+++ b/system/service/test/low_energy_scanner_unittest.cc
@@ -45,38 +45,43 @@ class MockScannerHandler : public BleScannerInterface {
MOCK_METHOD1(Unregister, void(int));
MOCK_METHOD1(Scan, void(bool));
- MOCK_METHOD4(ScanFilterParamSetupImpl,
+ MOCK_METHOD5(ScanFilterParamSetupImpl,
void(uint8_t client_if, uint8_t action, uint8_t filt_index,
- btgatt_filt_param_setup_t* filt_param));
- MOCK_METHOD2(ScanFilterClear, void(int client_if, int filt_index));
- MOCK_METHOD2(ScanFilterEnable, void(int client_if, bool enable));
+ btgatt_filt_param_setup_t* filt_param,
+ FilterParamSetupCallback cb));
+ MOCK_METHOD2(ScanFilterClear, void(int filt_index, FilterConfigCallback cb));
+ MOCK_METHOD2(ScanFilterEnable, void(bool enable, EnableCallback cb));
MOCK_METHOD3(SetScanParameters,
- void(int client_if, int scan_interval, int scan_window));
+ void(int scan_interval, int scan_window, Callback cb));
- MOCK_METHOD4(BatchscanConfigStorage,
+ MOCK_METHOD5(BatchscanConfigStorage,
void(int client_if, int batch_scan_full_max,
- int batch_scan_trunc_max, int batch_scan_notify_threshold));
+ int batch_scan_trunc_max, int batch_scan_notify_threshold,
+ Callback cb));
MOCK_METHOD6(BatchscanEnable,
- void(int client_if, int scan_mode, int scan_interval,
- int scan_window, int addr_type, int discard_rule));
+ void(int scan_mode, int scan_interval, int scan_window,
+ int addr_type, int discard_rule, Callback cb));
- MOCK_METHOD1(BatchscanDisable, void(int client_if));
+ MOCK_METHOD1(BatchscanDisable, void(Callback cb));
MOCK_METHOD2(BatchscanReadReports, void(int client_if, int scan_mode));
- void ScanFilterAddRemove(int client_if, int action, int filt_type,
- int filt_index, int company_id, int company_id_mask,
+ void ScanFilterAddRemove(int action, int filt_type, int filt_index,
+ int company_id, int company_id_mask,
const bt_uuid_t* p_uuid,
const bt_uuid_t* p_uuid_mask,
const bt_bdaddr_t* bd_addr, char addr_type,
std::vector<uint8_t> data,
- std::vector<uint8_t> p_mask){};
+ std::vector<uint8_t> p_mask,
+ FilterConfigCallback cb){};
void ScanFilterParamSetup(
uint8_t client_if, uint8_t action, uint8_t filt_index,
- std::unique_ptr<btgatt_filt_param_setup_t> filt_param) {
- ScanFilterParamSetupImpl(client_if, action, filt_index, filt_param.get());
+ std::unique_ptr<btgatt_filt_param_setup_t> filt_param,
+ FilterParamSetupCallback cb) {
+ ScanFilterParamSetupImpl(client_if, action, filt_index, filt_param.get(),
+ std::move(cb));
}
};
diff --git a/system/stack/btm/btm_ble_gap.cc b/system/stack/btm/btm_ble_gap.cc
index 05389f1986..5a55c922aa 100644
--- a/system/stack/btm/btm_ble_gap.cc
+++ b/system/stack/btm/btm_ble_gap.cc
@@ -24,6 +24,7 @@
#define LOG_TAG "bt_btm_ble"
+#include <base/callback.h>
#include <base/strings/string_number_conversions.h>
#include <stddef.h>
#include <stdio.h>
@@ -1017,24 +1018,13 @@ tBTM_STATUS BTM_BleSetAdvParams(uint16_t adv_int_min, uint16_t adv_int_max,
return status;
}
-/*******************************************************************************
- *
- * Function BTM_BleSetScanParams
- *
- * Description This function is called to set scan parameters.
- *
- * Parameters client_if - Client IF
- * scan_interval - Scan interval
- * scan_window - Scan window
- * scan_mode - Scan mode
- * scan_setup_status_cback - Scan param setup status callback
- *
- * Returns void
- *
- ******************************************************************************/
-void BTM_BleSetScanParams(tGATT_IF client_if, uint32_t scan_interval,
- uint32_t scan_window, tBLE_SCAN_MODE scan_mode,
- tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback) {
+/**
+ * This function is called to set scan parameters. |cb| is called with operation
+ * status
+ **/
+void BTM_BleSetScanParams(uint32_t scan_interval, uint32_t scan_window,
+ tBLE_SCAN_MODE scan_mode,
+ base::Callback<void(uint8_t)> cb) {
tBTM_BLE_INQ_CB* p_cb = &btm_cb.ble_ctr_cb.inq_var;
uint32_t max_scan_interval;
uint32_t max_scan_window;
@@ -1064,11 +1054,9 @@ void BTM_BleSetScanParams(tGATT_IF client_if, uint32_t scan_interval,
p_cb->scan_interval = scan_interval;
p_cb->scan_window = scan_window;
- if (scan_setup_status_cback != NULL)
- scan_setup_status_cback(client_if, BTM_SUCCESS);
+ cb.Run(BTM_SUCCESS);
} else {
- if (scan_setup_status_cback != NULL)
- scan_setup_status_cback(client_if, BTM_ILLEGAL_VALUE);
+ cb.Run(BTM_ILLEGAL_VALUE);
BTM_TRACE_ERROR("Illegal params: scan_interval = %d scan_window = %d",
scan_interval, scan_window);
diff --git a/system/stack/include/btm_ble_api.h b/system/stack/include/btm_ble_api.h
index 73f8c6988b..bb8c6ff8d0 100644
--- a/system/stack/include/btm_ble_api.h
+++ b/system/stack/include/btm_ble_api.h
@@ -25,6 +25,7 @@
#ifndef BTM_BLE_API_H
#define BTM_BLE_API_H
+#include <base/callback_forward.h>
#include <hardware/bt_common_types.h>
#include <memory>
#include "bt_common.h"
@@ -102,25 +103,13 @@ extern tBTM_STATUS BTM_BleSetAdvParams(uint16_t adv_int_min,
******************************************************************************/
extern void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb);
-/*******************************************************************************
- *
- * Function BTM_BleSetScanParams
- *
- * Description This function is called to set Scan parameters.
- *
- * Parameters client_if - Client IF value
- * scan_interval - Scan interval
- * scan_window - Scan window
- * scan_type - Scan type
- * scan_setup_status_cback - Scan setup status callback
- *
- * Returns void
- *
- ******************************************************************************/
-extern void BTM_BleSetScanParams(
- tGATT_IF client_if, uint32_t scan_interval, uint32_t scan_window,
- tBLE_SCAN_MODE scan_type,
- tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback);
+/**
+ * This function is called to set scan parameters. |cb| is called with operation
+ * status
+ **/
+extern void BTM_BleSetScanParams(uint32_t scan_interval, uint32_t scan_window,
+ tBLE_SCAN_MODE scan_type,
+ base::Callback<void(uint8_t)> cb);
/*******************************************************************************
*