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

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

Merge changes from topic "gd: Pass address of scan result by value"

* changes:
  gd: Pass address of scan result by value
  gd: Implement Advertising Packet Content Filter
parents 03df10a7 53b3601c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -91,6 +91,10 @@ class LeScanningManagerFacadeService : public LeScanningManagerFacade::Service,
  void OnTrackAdvFoundLost(){};
  void OnBatchScanReports(int client_if, int status, int report_format, int num_records, std::vector<uint8_t> data){};
  void OnTimeout(){};
  void OnFilterEnable(Enable enable, uint8_t status){};
  void OnFilterParamSetup(uint8_t available_spaces, ApcfAction action, uint8_t status){};
  void OnFilterConfigCallback(
      ApcfFilterType filter_type, uint8_t available_spaces, ApcfAction action, uint8_t status){};

  LeScanningManager* le_scanning_manager_;
  os::Handler* facade_handler_;
+144 −0
Original line number Diff line number Diff line
@@ -3987,6 +3987,7 @@ enum ApcfOpcode : 8 {
  SERVICE_DATA = 0x07,
}

// https://source.android.com/devices/bluetooth/hci_requirements#advertising-packet-content-filter
packet LeAdvFilter : LeScanningCommand (op_code = LE_ADV_FILTER) {
  apcf_opcode : ApcfOpcode,
  _body_,
@@ -3995,8 +3996,151 @@ packet LeAdvFilter : LeScanningCommand (op_code = LE_ADV_FILTER) {
packet LeAdvFilterComplete : CommandComplete (command_op_code = LE_ADV_FILTER) {
  status : ErrorCode,
  apcf_opcode : ApcfOpcode,
  _body_,
}

packet LeAdvFilterEnable : LeAdvFilter (apcf_opcode = ENABLE) {
  apcf_enable : Enable,
}

packet LeAdvFilterEnableComplete : LeAdvFilterComplete (apcf_opcode = ENABLE) {
  apcf_enable : Enable,
}

enum ApcfAction : 8 {
  ADD = 0x00,
  DELETE = 0x01,
  CLEAR = 0x02,
}

enum DeliveryMode : 8 {
  IMMEDIATE = 0x00,
  ONFOUND = 0x01,
  BATCHED = 0x02,
}

// Bit masks for the selected features
enum ApcfFilterType : 8 {
  BROADCASTER_ADDRESS = 0x00,
  SERVICE_DATA_CHANGE = 0x01,
  SERVICE_UUID = 0x02,
  SERVICE_SOLICITATION_UUID = 0x03,
  LOCAL_NAME = 0x04,
  MANUFACTURER_DATA = 0x05,
  SERVICE_DATA = 0x06,
}

packet LeAdvFilterSetFilteringParameters : LeAdvFilter (apcf_opcode = SET_FILTERING_PARAMETERS) {
  apcf_action : ApcfAction,
  _body_,
}

packet LeAdvFilterAddFilteringParameters : LeAdvFilterSetFilteringParameters (apcf_action = ADD) {
  apcf_filter_index : 8,
  apcf_feature_selection : 16,
  apcf_list_logic_type : 16,
  apcf_filter_logic_type : 8,
  rssi_high_thresh : 8,
  delivery_mode : DeliveryMode,
  onfound_timeout : 16,
  onfound_timeout_cnt : 8,
  rssi_low_thresh : 8,
  onlost_timeout : 16,
  num_of_tracking_entries : 16,
}

packet LeAdvFilterDeleteFilteringParameters : LeAdvFilterSetFilteringParameters (apcf_action = DELETE) {
  apcf_filter_index : 8,
}

packet LeAdvFilterClearFilteringParameters : LeAdvFilterSetFilteringParameters (apcf_action = CLEAR) {
}

packet LeAdvFilterSetFilteringParametersComplete : LeAdvFilterComplete (apcf_opcode = SET_FILTERING_PARAMETERS) {
  apcf_action : ApcfAction,
  apcf_available_spaces : 8,
}

enum ApcfApplicationAddressType : 8 {
  PUBLIC = 0x00,
  RANDOM = 0x01,
  NOT_APPLICABLE = 0x02,
}

packet LeAdvFilterBroadcasterAddress : LeAdvFilter (apcf_opcode = BROADCASTER_ADDRESS) {
  apcf_action : ApcfAction,
  apcf_filter_index : 8,
  apcf_broadcaster_address : Address,
  apcf_application_address_type : ApcfApplicationAddressType,
}

packet LeAdvFilterClearBroadcasterAddress : LeAdvFilter (apcf_opcode = BROADCASTER_ADDRESS) {
  _fixed_ = 0x02 : 8,
  apcf_filter_index : 8,
}

packet LeAdvFilterBroadcasterAddressComplete : LeAdvFilterComplete (apcf_opcode = BROADCASTER_ADDRESS) {
  apcf_action : ApcfAction,
  apcf_available_spaces : 8,
}


packet LeAdvFilterServiceUuid : LeAdvFilter (apcf_opcode = SERVICE_UUID) {
  apcf_action : ApcfAction,
  apcf_filter_index : 8,
  acpf_uuid_data : 8[],
}

packet LeAdvFilterServiceUuidComplete : LeAdvFilterComplete (apcf_opcode = SERVICE_UUID) {
  apcf_action : ApcfAction,
  apcf_available_spaces : 8,
}

packet LeAdvFilterSolicitationUuid : LeAdvFilter (apcf_opcode = SERVICE_SOLICITATION_UUID) {
  apcf_action : ApcfAction,
  apcf_filter_index : 8,
  acpf_uuid_data : 8[],
}

packet LeAdvFilterSolicitationUuidComplete : LeAdvFilterComplete (apcf_opcode = SERVICE_SOLICITATION_UUID) {
  apcf_action : ApcfAction,
  apcf_available_spaces : 8,
}

packet LeAdvFilterLocalName : LeAdvFilter (apcf_opcode = LOCAL_NAME) {
  apcf_action : ApcfAction,
  apcf_filter_index : 8,
  apcf_local_name : 8[],
}

packet LeAdvFilterLocalNameComplete : LeAdvFilterComplete (apcf_opcode = LOCAL_NAME) {
  apcf_action : ApcfAction,
  apcf_available_spaces : 8,
}

packet LeAdvFilterManufacturerData : LeAdvFilter (apcf_opcode = MANUFACTURER_DATA) {
  apcf_action : ApcfAction,
  apcf_filter_index : 8,
  apcf_manufacturer_data : 8[],
}

packet LeAdvFilterManufacturerDataComplete : LeAdvFilterComplete (apcf_opcode = MANUFACTURER_DATA) {
  apcf_action : ApcfAction,
  apcf_available_spaces : 8,
}

packet LeAdvFilterServiceData : LeAdvFilter (apcf_opcode = SERVICE_DATA) {
  apcf_action : ApcfAction,
  apcf_filter_index : 8,
  apcf_service_data : 8[],
}

packet LeAdvFilterServiceDataComplete : LeAdvFilterComplete (apcf_opcode = SERVICE_DATA) {
  apcf_action : ApcfAction,
  apcf_available_spaces : 8,
}


packet LeTrackAdv : VendorCommand (op_code = LE_TRACK_ADV) {
  _payload_,  // placeholder (unimplemented)
}
+321 −0
Original line number Diff line number Diff line
@@ -158,6 +158,7 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback
    } else {
      api_type_ = ScanApiType::LEGACY;
    }
    is_filter_support_ = controller_->IsSupported(OpCode::LE_ADV_FILTER);
    scanners_ = std::vector<Scanner>(kMaxAppNum + 1);
    for (size_t i = 0; i < scanners_.size(); i++) {
      scanners_[i].app_uuid = Uuid::kEmpty;
@@ -528,10 +529,315 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback
    window_ms_ = scan_window;
  }

  void scan_filter_enable(bool enable) {
    if (!is_filter_support_) {
      LOG_WARN("Advertising filter is not supported");
      return;
    }

    Enable apcf_enable = enable ? Enable::ENABLED : Enable::DISABLED;
    le_scanning_interface_->EnqueueCommand(
        LeAdvFilterEnableBuilder::Create(apcf_enable),
        module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete));
  }

  void scan_filter_parameter_setup(
      ApcfAction action, uint8_t filter_index, AdvertisingFilterParameter advertising_filter_parameter) {
    if (!is_filter_support_) {
      LOG_WARN("Advertising filter is not supported");
      return;
    }

    switch (action) {
      case ApcfAction::ADD:
        le_scanning_interface_->EnqueueCommand(
            LeAdvFilterAddFilteringParametersBuilder::Create(
                filter_index,
                advertising_filter_parameter.feature_selection,
                advertising_filter_parameter.list_logic_type,
                advertising_filter_parameter.filter_logic_type,
                advertising_filter_parameter.rssi_high_thresh,
                advertising_filter_parameter.delivery_mode,
                advertising_filter_parameter.onfound_timeout,
                advertising_filter_parameter.onfound_timeout_cnt,
                advertising_filter_parameter.rssi_low_thres,
                advertising_filter_parameter.onlost_timeout,
                advertising_filter_parameter.num_of_tracking_entries),
            module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete));
        break;
      case ApcfAction::DELETE:
        le_scanning_interface_->EnqueueCommand(
            LeAdvFilterDeleteFilteringParametersBuilder::Create(filter_index),
            module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete));
        break;
      case ApcfAction::CLEAR:
        le_scanning_interface_->EnqueueCommand(
            LeAdvFilterClearFilteringParametersBuilder::Create(),
            module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete));
        break;
      default:
        LOG_ERROR("Unknown action type: %d", (uint16_t)action);
        break;
    }
  }

  void scan_filter_add(uint8_t filter_index, std::vector<AdvertisingPacketContentFilterCommand> filters) {
    if (!is_filter_support_) {
      LOG_WARN("Advertising filter is not supported");
      return;
    }

    ApcfAction apcf_action = ApcfAction::ADD;
    for (auto filter : filters) {
      /* If data is passed, both mask and data have to be the same length */
      if (filter.data.size() != filter.data_mask.size() && filter.data.size() != 0 && filter.data_mask.size() != 0) {
        LOG_ERROR("data and data_mask are of different size");
        continue;
      }

      switch (filter.filter_type) {
        case ApcfFilterType::BROADCASTER_ADDRESS: {
          update_address_filter(apcf_action, filter_index, filter.address, filter.application_address_type);
          break;
        }
        case ApcfFilterType::SERVICE_UUID:
        case ApcfFilterType::SERVICE_SOLICITATION_UUID: {
          update_uuid_filter(apcf_action, filter_index, filter.filter_type, filter.uuid, filter.uuid_mask);
          break;
        }
        case ApcfFilterType::LOCAL_NAME: {
          update_local_name_filter(apcf_action, filter_index, filter.name);
          break;
        }
        case ApcfFilterType::MANUFACTURER_DATA: {
          update_manufacturer_data_filter(
              apcf_action, filter_index, filter.company, filter.company_mask, filter.data, filter.data_mask);
          break;
        }
        case ApcfFilterType::SERVICE_DATA: {
          update_service_data_filter(apcf_action, filter_index, filter.data, filter.data_mask);
          break;
        }
        default:
          LOG_ERROR("Unknown filter type: %d", (uint16_t)filter.filter_type);
          break;
      }
    }
  }

  void update_address_filter(
      ApcfAction action, uint8_t filter_index, Address address, ApcfApplicationAddressType address_type) {
    if (action != ApcfAction::CLEAR) {
      le_scanning_interface_->EnqueueCommand(
          LeAdvFilterBroadcasterAddressBuilder::Create(action, filter_index, address, address_type),
          module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete));
    } else {
      le_scanning_interface_->EnqueueCommand(
          LeAdvFilterClearBroadcasterAddressBuilder::Create(filter_index),
          module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete));
    }
  }

  void update_uuid_filter(
      ApcfAction action, uint8_t filter_index, ApcfFilterType filter_type, Uuid uuid, Uuid uuid_mask) {
    std::vector<uint8_t> combined_data = {};
    if (action != ApcfAction::CLEAR) {
      uint8_t uuid_len = uuid.GetShortestRepresentationSize();
      if (uuid_len == Uuid::kNumBytes16) {
        uint16_t data = uuid.As16Bit();
        combined_data.push_back((uint8_t)data);
        combined_data.push_back((uint8_t)(data >> 8));
      } else if (uuid_len == Uuid::kNumBytes32) {
        uint16_t data = uuid.As32Bit();
        combined_data.push_back((uint8_t)data);
        combined_data.push_back((uint8_t)(data >> 8));
        combined_data.push_back((uint8_t)(data >> 16));
        combined_data.push_back((uint8_t)(data >> 24));
      } else if (uuid_len == Uuid::kNumBytes128) {
        auto data = uuid.To128BitLE();
        combined_data.insert(combined_data.end(), data.begin(), data.end());
      } else {
        LOG_ERROR("illegal UUID length: %d", (uint16_t)uuid_len);
        return;
      }

      if (!uuid_mask.IsEmpty()) {
        if (uuid_len == Uuid::kNumBytes16) {
          uint16_t data = uuid_mask.As16Bit();
          combined_data.push_back((uint8_t)data);
          combined_data.push_back((uint8_t)(data >> 8));
        } else if (uuid_len == Uuid::kNumBytes32) {
          uint16_t data = uuid_mask.As32Bit();
          combined_data.push_back((uint8_t)data);
          combined_data.push_back((uint8_t)(data >> 8));
          combined_data.push_back((uint8_t)(data >> 16));
          combined_data.push_back((uint8_t)(data >> 24));
        } else if (uuid_len == Uuid::kNumBytes128) {
          auto data = uuid_mask.To128BitLE();
          combined_data.insert(combined_data.end(), data.begin(), data.end());
        }
      } else {
        std::vector<uint8_t> data(uuid_len, 0xFF);
        combined_data.insert(combined_data.end(), data.begin(), data.end());
      }
    }

    if (filter_type == ApcfFilterType::SERVICE_UUID) {
      le_scanning_interface_->EnqueueCommand(
          LeAdvFilterServiceUuidBuilder::Create(action, filter_index, combined_data),
          module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete));
    } else {
      le_scanning_interface_->EnqueueCommand(
          LeAdvFilterSolicitationUuidBuilder::Create(action, filter_index, combined_data),
          module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete));
    }
  }

  void update_local_name_filter(ApcfAction action, uint8_t filter_index, std::vector<uint8_t> name) {
    le_scanning_interface_->EnqueueCommand(
        LeAdvFilterLocalNameBuilder::Create(action, filter_index, name),
        module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete));
  }

  void update_manufacturer_data_filter(
      ApcfAction action,
      uint8_t filter_index,
      uint16_t company_id,
      uint16_t company_id_mask,
      std::vector<uint8_t> data,
      std::vector<uint8_t> data_mask) {
    if (data.size() != data_mask.size()) {
      LOG_ERROR("manufacturer data mask should have the same length as manufacturer data");
      return;
    }
    std::vector<uint8_t> combined_data = {};
    if (action != ApcfAction::CLEAR) {
      combined_data.push_back((uint8_t)company_id);
      combined_data.push_back((uint8_t)(company_id >> 8));
      if (data.size() != 0) {
        combined_data.insert(combined_data.end(), data.begin(), data.end());
      }
      if (company_id_mask != 0) {
        combined_data.push_back((uint8_t)company_id_mask);
        combined_data.push_back((uint8_t)(company_id_mask >> 8));
      } else {
        combined_data.push_back(0xFF);
        combined_data.push_back(0xFF);
      }
      if (data_mask.size() != 0) {
        combined_data.insert(combined_data.end(), data_mask.begin(), data_mask.end());
      }
    }

    le_scanning_interface_->EnqueueCommand(
        LeAdvFilterManufacturerDataBuilder::Create(action, filter_index, combined_data),
        module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete));
  }

  void update_service_data_filter(
      ApcfAction action, uint8_t filter_index, std::vector<uint8_t> data, std::vector<uint8_t> data_mask) {
    if (data.size() != data_mask.size()) {
      LOG_ERROR("service data mask should have the same length as service data");
      return;
    }
    std::vector<uint8_t> combined_data = {};
    if (action != ApcfAction::CLEAR && data.size() != 0) {
      combined_data.insert(combined_data.end(), data.begin(), data.end());
      combined_data.insert(combined_data.end(), data_mask.begin(), data_mask.end());
    }

    le_scanning_interface_->EnqueueCommand(
        LeAdvFilterServiceDataBuilder::Create(action, filter_index, combined_data),
        module_handler_->BindOnceOn(this, &impl::on_advertising_filter_complete));
  }

  void register_scanning_callback(ScanningCallback* scanning_callbacks) {
    scanning_callbacks_ = scanning_callbacks;
  }

  void on_advertising_filter_complete(CommandCompleteView view) {
    ASSERT(view.IsValid());
    auto status_view = LeAdvFilterCompleteView::Create(view);
    ASSERT(status_view.IsValid());
    if (status_view.GetStatus() != ErrorCode::SUCCESS) {
      LOG_INFO(
          "Got a Command complete %s, status %s",
          OpCodeText(view.GetCommandOpCode()).c_str(),
          ErrorCodeText(status_view.GetStatus()).c_str());
    }

    ApcfOpcode apcf_opcode = status_view.GetApcfOpcode();
    switch (apcf_opcode) {
      case ApcfOpcode::ENABLE: {
        auto complete_view = LeAdvFilterEnableCompleteView::Create(status_view);
        ASSERT(complete_view.IsValid());
        scanning_callbacks_->OnFilterEnable(complete_view.GetApcfEnable(), (uint8_t)complete_view.GetStatus());
      } break;
      case ApcfOpcode::SET_FILTERING_PARAMETERS: {
        auto complete_view = LeAdvFilterSetFilteringParametersCompleteView::Create(status_view);
        ASSERT(complete_view.IsValid());
        scanning_callbacks_->OnFilterParamSetup(
            complete_view.GetApcfAvailableSpaces(), complete_view.GetApcfAction(), (uint8_t)complete_view.GetStatus());
      } break;
      case ApcfOpcode::BROADCASTER_ADDRESS: {
        auto complete_view = LeAdvFilterBroadcasterAddressCompleteView::Create(status_view);
        ASSERT(complete_view.IsValid());
        scanning_callbacks_->OnFilterConfigCallback(
            ApcfFilterType::BROADCASTER_ADDRESS,
            complete_view.GetApcfAvailableSpaces(),
            complete_view.GetApcfAction(),
            (uint8_t)complete_view.GetStatus());
      } break;
      case ApcfOpcode::SERVICE_UUID: {
        auto complete_view = LeAdvFilterServiceUuidCompleteView::Create(status_view);
        ASSERT(complete_view.IsValid());
        scanning_callbacks_->OnFilterConfigCallback(
            ApcfFilterType::SERVICE_UUID,
            complete_view.GetApcfAvailableSpaces(),
            complete_view.GetApcfAction(),
            (uint8_t)complete_view.GetStatus());
      } break;
      case ApcfOpcode::SERVICE_SOLICITATION_UUID: {
        auto complete_view = LeAdvFilterSolicitationUuidCompleteView::Create(status_view);
        ASSERT(complete_view.IsValid());
        scanning_callbacks_->OnFilterConfigCallback(
            ApcfFilterType::SERVICE_SOLICITATION_UUID,
            complete_view.GetApcfAvailableSpaces(),
            complete_view.GetApcfAction(),
            (uint8_t)complete_view.GetStatus());
      } break;
      case ApcfOpcode::LOCAL_NAME: {
        auto complete_view = LeAdvFilterLocalNameCompleteView::Create(status_view);
        ASSERT(complete_view.IsValid());
        scanning_callbacks_->OnFilterConfigCallback(
            ApcfFilterType::LOCAL_NAME,
            complete_view.GetApcfAvailableSpaces(),
            complete_view.GetApcfAction(),
            (uint8_t)complete_view.GetStatus());
      } break;
      case ApcfOpcode::MANUFACTURER_DATA: {
        auto complete_view = LeAdvFilterManufacturerDataCompleteView::Create(status_view);
        ASSERT(complete_view.IsValid());
        scanning_callbacks_->OnFilterConfigCallback(
            ApcfFilterType::MANUFACTURER_DATA,
            complete_view.GetApcfAvailableSpaces(),
            complete_view.GetApcfAction(),
            (uint8_t)complete_view.GetStatus());
      } break;
      case ApcfOpcode::SERVICE_DATA: {
        auto complete_view = LeAdvFilterServiceDataCompleteView::Create(status_view);
        ASSERT(complete_view.IsValid());
        scanning_callbacks_->OnFilterConfigCallback(
            ApcfFilterType::SERVICE_DATA,
            complete_view.GetApcfAvailableSpaces(),
            complete_view.GetApcfAction(),
            (uint8_t)complete_view.GetStatus());
      } break;
      default:
        LOG_WARN("Unexpected event type %s", OpCodeText(view.GetCommandOpCode()).c_str());
    }
  }

  void OnPause() override {
    paused_ = true;
    scan_on_resume_ = is_scanning_;
@@ -566,6 +872,7 @@ struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback
  bool scan_on_resume_ = false;
  bool paused_ = false;
  AdvertisingCache advertising_cache_;
  bool is_filter_support_ = false;

  LeScanType le_scan_type_ = LeScanType::ACTIVE;
  uint32_t interval_ms_{1000};
@@ -645,6 +952,20 @@ void LeScanningManager::SetScanParameters(LeScanType scan_type, uint16_t scan_in
  CallOn(pimpl_.get(), &impl::set_scan_parameters, scan_type, scan_interval, scan_window);
}

void LeScanningManager::ScanFilterEnable(bool enable) {
  CallOn(pimpl_.get(), &impl::scan_filter_enable, enable);
}

void LeScanningManager::ScanFilterParameterSetup(
    ApcfAction action, uint8_t filter_index, AdvertisingFilterParameter advertising_filter_parameter) {
  CallOn(pimpl_.get(), &impl::scan_filter_parameter_setup, action, filter_index, advertising_filter_parameter);
}

void LeScanningManager::ScanFilterAdd(
    uint8_t filter_index, std::vector<AdvertisingPacketContentFilterCommand> filters) {
  CallOn(pimpl_.get(), &impl::scan_filter_add, filter_index, filters);
}

void LeScanningManager::RegisterScanningCallback(ScanningCallback* scanning_callback) {
  CallOn(pimpl_.get(), &impl::register_scanning_callback, scanning_callback);
}
+41 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <memory>

#include "common/callback.h"
#include "hci/address_with_type.h"
#include "hci/hci_packets.h"
#include "hci/uuid.h"
#include "module.h"
@@ -53,6 +54,38 @@ class ScanningCallback {
  virtual void OnBatchScanReports(
      int client_if, int status, int report_format, int num_records, std::vector<uint8_t> data) = 0;
  virtual void OnTimeout() = 0;
  virtual void OnFilterEnable(Enable enable, uint8_t status) = 0;
  virtual void OnFilterParamSetup(uint8_t available_spaces, ApcfAction action, uint8_t status) = 0;
  virtual void OnFilterConfigCallback(
      ApcfFilterType filter_type, uint8_t available_spaces, ApcfAction action, uint8_t status) = 0;
};

class AdvertisingPacketContentFilterCommand {
 public:
  ApcfFilterType filter_type;
  Address address;
  ApcfApplicationAddressType application_address_type;
  Uuid uuid;
  Uuid uuid_mask;
  std::vector<uint8_t> name;
  uint16_t company;
  uint16_t company_mask;
  std::vector<uint8_t> data;
  std::vector<uint8_t> data_mask;
};

class AdvertisingFilterParameter {
 public:
  uint16_t feature_selection;
  uint16_t list_logic_type;
  uint8_t filter_logic_type;
  uint8_t rssi_high_thresh;
  DeliveryMode delivery_mode;
  uint16_t onfound_timeout;
  uint8_t onfound_timeout_cnt;
  uint8_t rssi_low_thres;
  uint16_t onlost_timeout;
  uint16_t num_of_tracking_entries;
};

class LeScanningManager : public bluetooth::Module {
@@ -71,6 +104,14 @@ class LeScanningManager : public bluetooth::Module {

  void SetScanParameters(LeScanType scan_type, uint16_t scan_interval, uint16_t scan_window);

  /* Scan filter */
  void ScanFilterEnable(bool enable);

  void ScanFilterParameterSetup(
      ApcfAction action, uint8_t filter_index, AdvertisingFilterParameter advertising_filter_parameter);

  void ScanFilterAdd(uint8_t filter_index, std::vector<AdvertisingPacketContentFilterCommand> filters);

  void RegisterScanningCallback(ScanningCallback* scanning_callback);

  static const ModuleFactory Factory;
+61 −0

File changed.

Preview size limit exceeded, changes collapsed.

Loading