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

Commit 0a692bfd authored by Henri Chataing's avatar Henri Chataing Committed by Automerger Merge Worker
Browse files

RootCanal: Fix formatting of LE APCF Set Filtering Parameters command am: ecb4077c

parents e2e8714b ecb4077c
Loading
Loading
Loading
Loading
+92 −17
Original line number Diff line number Diff line
@@ -2869,19 +2869,53 @@ void DualModeController::LeApcf(CommandView command) {
      DEBUG(id_, "<< LE APCF Set Filtering Parameters");
      DEBUG(id_, "   action={}", subcommand_view.GetApcfAction());

      ErrorCode status = ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
      uint8_t apcf_available_spaces = 0;
      ErrorCode status = link_layer_controller_.LeApcfSetFilteringParameters(
          subcommand_view.GetApcfAction(), subcommand_view.GetApcfFilterIndex(),
          subcommand_view.GetApcfFeatureSelection(),
          subcommand_view.GetApcfListLogicType(),
          subcommand_view.GetApcfFilterLogicType(),
          subcommand_view.GetRssiHighThresh(),
          subcommand_view.GetDeliveryMode(),
          subcommand_view.GetOnfoundTimeout(),
          subcommand_view.GetOnfoundTimeoutCnt(),
          subcommand_view.GetRssiLowThresh(),
          subcommand_view.GetOnlostTimeout(),
          subcommand_view.GetNumOfTrackingEntries(), &apcf_available_spaces);

      switch (subcommand_view.GetApcfAction()) {
        case bluetooth::hci::ApcfAction::ADD: {
          auto subsubcommand_view =
              bluetooth::hci::LeApcfAddFilteringParametersView::Create(
                  subcommand_view);
          ASSERT(subsubcommand_view.IsValid());
          status = link_layer_controller_.LeApcfAddFilteringParameters(
              subsubcommand_view.GetApcfFilterIndex(),
              subsubcommand_view.GetApcfFeatureSelection(),
              subsubcommand_view.GetApcfListLogicType(),
              subsubcommand_view.GetApcfFilterLogicType(),
              subsubcommand_view.GetRssiHighThresh(),
              subsubcommand_view.GetDeliveryMode(),
              subsubcommand_view.GetOnfoundTimeout(),
              subsubcommand_view.GetOnfoundTimeoutCnt(),
              subsubcommand_view.GetRssiLowThresh(),
              subsubcommand_view.GetOnlostTimeout(),
              subsubcommand_view.GetNumOfTrackingEntries(),
              &apcf_available_spaces);
          break;
        }
        case bluetooth::hci::ApcfAction::DELETE: {
          auto subsubcommand_view =
              bluetooth::hci::LeApcfDeleteFilteringParametersView::Create(
                  subcommand_view);
          ASSERT(subsubcommand_view.IsValid());
          status = link_layer_controller_.LeApcfDeleteFilteringParameters(
              subsubcommand_view.GetApcfFilterIndex(), &apcf_available_spaces);
          break;
        }
        case bluetooth::hci::ApcfAction::CLEAR: {
          auto subsubcommand_view =
              bluetooth::hci::LeApcfClearFilteringParametersView::Create(
                  subcommand_view);
          ASSERT(subsubcommand_view.IsValid());
          status = link_layer_controller_.LeApcfClearFilteringParameters(
              &apcf_available_spaces);
          break;
        }
        default:
          INFO(id_, "unknown apcf action {}", subcommand_view.GetApcfAction());
          break;
      }

      send_event_(
          bluetooth::hci::LeApcfSetFilteringParametersCompleteBuilder::Create(
              kNumCommandPackets, status, subcommand_view.GetApcfAction(),
@@ -2896,12 +2930,53 @@ void DualModeController::LeApcf(CommandView command) {
      DEBUG(id_, "<< LE APCF Broadcaster Address");
      DEBUG(id_, "   action={}", subcommand_view.GetApcfAction());

      ErrorCode status = ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
      uint8_t apcf_available_spaces = 0;
      ErrorCode status = link_layer_controller_.LeApcfBroadcasterAddress(
          subcommand_view.GetApcfAction(), subcommand_view.GetApcfFilterIndex(),
          subcommand_view.GetApcfBroadcasterAddress(),
          subcommand_view.GetApcfApplicationAddressType(),

      switch (subcommand_view.GetApcfAction()) {
        case bluetooth::hci::ApcfAction::ADD: {
          auto subsubcommand_view =
              bluetooth::hci::LeApcfAddBroadcasterAddressView::Create(
                  subcommand_view);
          ASSERT(subsubcommand_view.IsValid());
          status = link_layer_controller_.LeApcfBroadcasterAddress(
              bluetooth::hci::ApcfAction::ADD,
              subsubcommand_view.GetApcfFilterIndex(),
              subsubcommand_view.GetApcfBroadcasterAddress(),
              subsubcommand_view.GetApcfApplicationAddressType(),
              &apcf_available_spaces);
          break;
        }
        case bluetooth::hci::ApcfAction::DELETE: {
          auto subsubcommand_view =
              bluetooth::hci::LeApcfDeleteBroadcasterAddressView::Create(
                  subcommand_view);
          ASSERT(subsubcommand_view.IsValid());
          status = link_layer_controller_.LeApcfBroadcasterAddress(
              bluetooth::hci::ApcfAction::DELETE,
              subsubcommand_view.GetApcfFilterIndex(),
              subsubcommand_view.GetApcfBroadcasterAddress(),
              subsubcommand_view.GetApcfApplicationAddressType(),
              &apcf_available_spaces);
          break;
        }
        case bluetooth::hci::ApcfAction::CLEAR: {
          auto subsubcommand_view =
              bluetooth::hci::LeApcfClearBroadcasterAddressView::Create(
                  subcommand_view);
          ASSERT(subsubcommand_view.IsValid());
          status = link_layer_controller_.LeApcfBroadcasterAddress(
              bluetooth::hci::ApcfAction::CLEAR,
              subsubcommand_view.GetApcfFilterIndex(), Address(),
              bluetooth::hci::ApcfApplicationAddressType::NOT_APPLICABLE,
              &apcf_available_spaces);
          break;
        }
        default:
          INFO(id_, "unknown apcf action {}", subcommand_view.GetApcfAction());
          break;
      }

      send_event_(
          bluetooth::hci::LeApcfBroadcasterAddressCompleteBuilder::Create(
              kNumCommandPackets, status, subcommand_view.GetApcfAction(),
+12 −8
Original line number Diff line number Diff line
@@ -585,15 +585,19 @@ class LinkLayerController {

  ErrorCode LeApcfEnable(bool apcf_enable);

  ErrorCode LeApcfSetFilteringParameters(
      bluetooth::hci::ApcfAction apcf_action, uint8_t apcf_filter_index,
      uint16_t apcf_feature_selection, uint16_t apcf_list_logic_type,
      uint8_t apcf_filter_logic_type, uint8_t rssi_high_thresh,
      bluetooth::hci::DeliveryMode delivery_mode, uint16_t onfound_timeout,
      uint8_t onfound_timeout_cnt, uint8_t rssi_low_thresh,
      uint16_t onlost_timeout, uint16_t num_of_tracking_entries,
  ErrorCode LeApcfAddFilteringParameters(
      uint8_t apcf_filter_index, uint16_t apcf_feature_selection,
      uint16_t apcf_list_logic_type, uint8_t apcf_filter_logic_type,
      uint8_t rssi_high_thresh, bluetooth::hci::DeliveryMode delivery_mode,
      uint16_t onfound_timeout, uint8_t onfound_timeout_cnt,
      uint8_t rssi_low_thresh, uint16_t onlost_timeout,
      uint16_t num_of_tracking_entries, uint8_t* apcf_available_spaces);

  ErrorCode LeApcfDeleteFilteringParameters(uint8_t apcf_filter_index,
                                            uint8_t* apcf_available_spaces);

  ErrorCode LeApcfClearFilteringParameters(uint8_t* apcf_available_spaces);

  ErrorCode LeApcfBroadcasterAddress(
      bluetooth::hci::ApcfAction apcf_action, uint8_t apcf_filter_index,
      bluetooth::hci::Address apcf_broadcaster_address,
+29 −28
Original line number Diff line number Diff line
@@ -74,6 +74,17 @@ void ApcfScanner::ClearFilterIndex(uint8_t apcf_filter_index) {
      std::end(ad_type_filters));
}

void ApcfScanner::Clear() {
  filters.clear();
  broadcaster_address_filters.clear();
  service_uuid_filters.clear();
  service_solicitation_uuid_filters.clear();
  local_name_filters.clear();
  manufacturer_data_filters.clear();
  service_data_filters.clear();
  ad_type_filters.clear();
}

template <typename T>
ErrorCode ApcfScanner::UpdateFilterList(std::vector<T>& filter_list,
                                        size_t max_filter_list_size,
@@ -144,19 +155,16 @@ ErrorCode LinkLayerController::LeApcfEnable(bool apcf_enable) {
  return ErrorCode::SUCCESS;
}

ErrorCode LinkLayerController::LeApcfSetFilteringParameters(
    ApcfAction apcf_action, uint8_t apcf_filter_index,
    uint16_t apcf_feature_selection, uint16_t apcf_list_logic_type,
    uint8_t apcf_filter_logic_type, uint8_t rssi_high_thresh,
    bluetooth::hci::DeliveryMode delivery_mode, uint16_t onfound_timeout,
    uint8_t onfound_timeout_cnt, uint8_t rssi_low_thresh,
    uint16_t onlost_timeout, uint16_t num_of_tracking_entries,
    uint8_t* apcf_available_spaces) {
ErrorCode LinkLayerController::LeApcfAddFilteringParameters(
    uint8_t apcf_filter_index, uint16_t apcf_feature_selection,
    uint16_t apcf_list_logic_type, uint8_t apcf_filter_logic_type,
    uint8_t rssi_high_thresh, bluetooth::hci::DeliveryMode delivery_mode,
    uint16_t onfound_timeout, uint8_t onfound_timeout_cnt,
    uint8_t rssi_low_thresh, uint16_t onlost_timeout,
    uint16_t num_of_tracking_entries, uint8_t* apcf_available_spaces) {
  *apcf_available_spaces =
      properties_.le_apcf_filter_list_size - apcf_scanner_.filters.size();

  switch (apcf_action) {
    case ApcfAction::ADD: {
      if (apcf_scanner_.HasFilterIndex(apcf_filter_index)) {
        INFO(id_, "apcf filter index {} already configured", apcf_filter_index);
        return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
@@ -185,7 +193,11 @@ ErrorCode LinkLayerController::LeApcfSetFilteringParameters(
      return ErrorCode::SUCCESS;
}

    case ApcfAction::DELETE: {
ErrorCode LinkLayerController::LeApcfDeleteFilteringParameters(
    uint8_t apcf_filter_index, uint8_t* apcf_available_spaces) {
      *apcf_available_spaces =
          properties_.le_apcf_filter_list_size - apcf_scanner_.filters.size();

      if (!apcf_scanner_.HasFilterIndex(apcf_filter_index)) {
        INFO(id_, "apcf filter index {} is not configured", apcf_filter_index);
        return ErrorCode::UNKNOWN_CONNECTION;
@@ -203,24 +215,13 @@ ErrorCode LinkLayerController::LeApcfSetFilteringParameters(
      return ErrorCode::SUCCESS;
}

    case ApcfAction::CLEAR: {
      if (!apcf_scanner_.HasFilterIndex(apcf_filter_index)) {
        INFO(id_, "apcf filter index {} is not configured", apcf_filter_index);
        return ErrorCode::UNKNOWN_CONNECTION;
      }

      apcf_scanner_.ClearFilterIndex(apcf_filter_index);
ErrorCode LinkLayerController::LeApcfClearFilteringParameters(
    uint8_t* apcf_available_spaces) {
      apcf_scanner_.Clear();
      *apcf_available_spaces = properties_.le_apcf_filter_list_size;
      return ErrorCode::SUCCESS;
}

    default:
      INFO(id_, "unknown apcf action {}", apcf_action);
      break;
  }

  return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
}

ErrorCode LinkLayerController::LeApcfBroadcasterAddress(
    ApcfAction apcf_action, uint8_t apcf_filter_index,
    bluetooth::hci::Address apcf_broadcaster_address,
+3 −0
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@ struct ApcfScanner {
  // from all tables.
  void ClearFilterIndex(uint8_t apcf_filter_index);

  // Remove all entries in all tables.
  void Clear();

  // Apply the requested modification to the selected
  // filter list.
  template <typename T>
+25 −0
Original line number Diff line number Diff line
@@ -5865,6 +5865,10 @@ enum ApcfFeatureSelection : 8 {

packet LeApcfSetFilteringParameters : LeApcf (apcf_opcode = SET_FILTERING_PARAMETERS) {
  apcf_action : ApcfAction,
  _payload_,
}

packet LeApcfAddFilteringParameters : LeApcfSetFilteringParameters (apcf_action = ADD) {
  apcf_filter_index : 8,
  apcf_feature_selection : 16,
  apcf_list_logic_type : 16,
@@ -5878,6 +5882,13 @@ packet LeApcfSetFilteringParameters : LeApcf (apcf_opcode = SET_FILTERING_PARAME
  num_of_tracking_entries : 16,
}

packet LeApcfDeleteFilteringParameters : LeApcfSetFilteringParameters (apcf_action = DELETE) {
  apcf_filter_index : 8,
}

packet LeApcfClearFilteringParameters : LeApcfSetFilteringParameters (apcf_action = CLEAR) {
}

packet LeApcfSetFilteringParametersComplete : LeApcfComplete (apcf_opcode = SET_FILTERING_PARAMETERS) {
  apcf_action : ApcfAction,
  apcf_available_spaces : 8,
@@ -5891,11 +5902,25 @@ enum ApcfApplicationAddressType : 8 {

packet LeApcfBroadcasterAddress : LeApcf (apcf_opcode = BROADCASTER_ADDRESS) {
  apcf_action : ApcfAction,
  _payload_,
}

packet LeApcfAddBroadcasterAddress : LeApcfBroadcasterAddress (apcf_action = ADD) {
  apcf_filter_index : 8,
  apcf_broadcaster_address : Address,
  apcf_application_address_type : ApcfApplicationAddressType,
}

packet LeApcfDeleteBroadcasterAddress : LeApcfBroadcasterAddress (apcf_action = DELETE) {
  apcf_filter_index : 8,
  apcf_broadcaster_address : Address,
  apcf_application_address_type : ApcfApplicationAddressType,
}

packet LeApcfClearBroadcasterAddress : LeApcfBroadcasterAddress (apcf_action = CLEAR) {
  apcf_filter_index : 8,
}

packet LeApcfBroadcasterAddressComplete : LeApcfComplete (apcf_opcode = BROADCASTER_ADDRESS) {
  apcf_action : ApcfAction,
  apcf_available_spaces : 8,