Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f9c39df authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Use empty filter for CSIS discovery"

parents 5b570d7b 9583404f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1171,7 +1171,7 @@ class CsisClientImpl : public CsisClient {
  void CsisActiveObserverSet(bool enable) {
    LOG(INFO) << __func__ << " CSIS Discovery SET: " << enable;

    bluetooth::shim::set_ad_type_rsi_filter(enable);
    bluetooth::shim::set_empty_filter(enable);
    BTA_DmBleCsisObserve(
        enable, [](tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {
          /* If there's no instance we are most likely shutting
+19 −0
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ constexpr char kBtmLogTag[] = "SCAN";
constexpr uint16_t kAllowADTypeFilter = 0x80;
constexpr uint8_t kFilterLogicOr = 0x00;
constexpr uint8_t kLowestRssiValue = 129;
constexpr uint16_t kAllowAllFilter = 0x00;
constexpr uint16_t kListLogicOr = 0x01;

class DefaultScanningCallback : public ::ScanningCallbacks {
  void OnScannerRegistered(const bluetooth::Uuid app_uuid, uint8_t scanner_id,
@@ -749,3 +751,20 @@ void bluetooth::shim::set_ad_type_rsi_filter(bool enable) {
        bluetooth::hci::ApcfAction::ADD, 0x00, advertising_filter_parameter);
  }
}

void bluetooth::shim::set_empty_filter(bool enable) {
  bluetooth::hci::AdvertisingFilterParameter advertising_filter_parameter;
  bluetooth::shim::GetScanning()->ScanFilterParameterSetup(
      bluetooth::hci::ApcfAction::DELETE, 0x00, advertising_filter_parameter);
  if (enable) {
    /* Add an allow-all filter on index 0 */
    advertising_filter_parameter.delivery_mode =
        bluetooth::hci::DeliveryMode::IMMEDIATE;
    advertising_filter_parameter.feature_selection = kAllowAllFilter;
    advertising_filter_parameter.list_logic_type = kListLogicOr;
    advertising_filter_parameter.filter_logic_type = kFilterLogicOr;
    advertising_filter_parameter.rssi_high_thresh = kLowestRssiValue;
    bluetooth::shim::GetScanning()->ScanFilterParameterSetup(
        bluetooth::hci::ApcfAction::ADD, 0x00, advertising_filter_parameter);
  }
}
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ namespace shim {
::BleScannerInterface* get_ble_scanner_instance();
void init_scanning_manager();
void set_ad_type_rsi_filter(bool enable);
void set_empty_filter(bool enable);

}  // namespace shim
}  // namespace bluetooth
+4 −0
Original line number Diff line number Diff line
@@ -42,3 +42,7 @@ void bluetooth::shim::init_scanning_manager() {
void bluetooth::shim::set_ad_type_rsi_filter(bool enable) {
  mock_function_count_map[__func__]++;
}

void bluetooth::shim::set_empty_filter(bool enable) {
  mock_function_count_map[__func__]++;
}