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

Commit 4197e150 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topic "revert-2258770-revert-2234606-EANUQCVQLE-JKTVHZZJLQ"...

Merge changes from topic "revert-2258770-revert-2234606-EANUQCVQLE-JKTVHZZJLQ" am: c5762c0c am: 268d9ede am: 2fa98616

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2239140



Change-Id: Ib0faf1f9f7e989170daf7b9a296255b3819d0c59
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 6028da2f 2fa98616
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ cc_test_host {
        "rootcanal_defaults",
    ],
    srcs: [
        "test/controller/le/le_set_random_address_test.cc",
        "test/controller/le/le_clear_filter_accept_list_test.cc",
        "test/controller/le/le_add_device_to_filter_accept_list_test.cc",
        "test/controller/le/le_remove_device_from_filter_accept_list_test.cc",
@@ -130,6 +131,16 @@ cc_test_host {
        "test/controller/le/le_clear_resolving_list_test.cc",
        "test/controller/le/le_remove_device_from_resolving_list_test.cc",
        "test/controller/le/le_set_address_resolution_enable_test.cc",
        "test/controller/le/le_set_advertising_parameters_test.cc",
        "test/controller/le/le_set_advertising_enable_test.cc",
        "test/controller/le/le_set_scan_parameters_test.cc",
        "test/controller/le/le_set_scan_enable_test.cc",
        "test/controller/le/le_set_extended_scan_parameters_test.cc",
        "test/controller/le/le_set_extended_scan_enable_test.cc",
        "test/controller/le/le_set_extended_advertising_parameters_test.cc",
        "test/controller/le/le_set_extended_advertising_data_test.cc",
        "test/controller/le/le_set_extended_scan_response_data_test.cc",
        "test/controller/le/le_set_extended_advertising_enable_test.cc",
    ],
    header_libs: [
        "libbluetooth_headers",
+7 −0
Original line number Diff line number Diff line
@@ -308,6 +308,8 @@ ControllerProperties::ControllerProperties(const std::string& file_name)
            total_num_le_acl_data_packets);
  ParseUint(root, "total_num_iso_data_packets ", total_num_iso_data_packets);
  ParseUint(root, "num_supported_iac", num_supported_iac);
  ParseUint(root, "le_advertising_physical_channel_tx_power",
            le_advertising_physical_channel_tx_power);

  ParseUintArray(root, "lmp_features", lmp_features);
  ParseUintVector(root, "supported_standard_codecs", supported_standard_codecs);
@@ -318,6 +320,11 @@ ControllerProperties::ControllerProperties(const std::string& file_name)
  ParseUint(root, "le_resolving_list_size", le_resolving_list_size);
  ParseUint(root, "le_supported_states", le_supported_states);

  ParseUint(root, "le_max_advertising_data_length",
            le_max_advertising_data_length);
  ParseUint(root, "le_num_supported_advertising_sets",
            le_num_supported_advertising_sets);

  ParseUintVector(root, "le_vendor_capabilities", le_vendor_capabilities);

  this->hci_version = static_cast<HciVersion>(hci_version);
+12 −0
Original line number Diff line number Diff line
@@ -79,6 +79,9 @@ struct ControllerProperties {
  // Number of Supported IAC (Vol 4, Part E § 7.3.43).
  uint8_t num_supported_iac{4};

  // LE Advertising Physical Channel TX Power (Vol 4, Part E § 7.8.6).
  uint8_t le_advertising_physical_channel_tx_power{static_cast<uint8_t>(-10)};

  // Supported Codecs (Vol 4, Part E § 7.4.8).
  // Implements the [v1] version only.
  std::vector<uint8_t> supported_standard_codecs{0};
@@ -93,6 +96,15 @@ struct ControllerProperties {
  // LE Supported States (Vol 4, Part E § 7.8.27).
  uint64_t le_supported_states{0x3ffffffffff};

  // LE Maximum Advertising Data Length (Vol 4, Part E § 7.8.57).
  // Note: valid range 0x001F to 0x0672.
  uint16_t le_max_advertising_data_length{512};

  // LE Number of Supported Advertising Sets (Vol 4, Part E § 7.8.58)
  // Note: the controller can change the number of advertising sets
  // at any time. This behaviour is not emulated here.
  uint8_t le_num_supported_advertising_sets{8};

  // Vendor Information.
  // Provide parameters returned by vendor specific commands.
  std::vector<uint8_t> le_vendor_capabilities{};
+81 −143
Original line number Diff line number Diff line
@@ -1992,7 +1992,8 @@ void DualModeController::RemoteNameRequest(CommandView command) {
  Address remote_addr = command_view.GetBdAddr();

  auto status = link_layer_controller_.SendCommandToRemoteByAddress(
      OpCode::REMOTE_NAME_REQUEST, command_view.GetPayload(), remote_addr);
      OpCode::REMOTE_NAME_REQUEST, command_view.GetPayload(), GetAddress(),
      remote_addr);

  send_event_(bluetooth::hci::RemoteNameRequestStatusBuilder::Create(
      status, kNumCommandPackets));
@@ -2096,22 +2097,15 @@ void DualModeController::LeSetAdvertisingParameters(CommandView command) {
  auto command_view = gd_hci::LeSetAdvertisingParametersView::Create(
      gd_hci::LeAdvertisingCommandView::Create(command));
  ASSERT(command_view.IsValid());
  auto peer_address = command_view.GetPeerAddress();
  auto type = command_view.GetAdvertisingType();
  if (type != bluetooth::hci::AdvertisingType::ADV_DIRECT_IND_HIGH &&
      type != bluetooth::hci::AdvertisingType::ADV_DIRECT_IND_LOW) {
    peer_address = Address::kEmpty;
  }
  link_layer_controller_.SetLeAdvertisingParameters(
  ErrorCode status = link_layer_controller_.LeSetAdvertisingParameters(
      command_view.GetAdvertisingIntervalMin(),
      command_view.GetAdvertisingIntervalMax(), type,
      static_cast<uint8_t>(command_view.GetOwnAddressType()),
      static_cast<uint8_t>(command_view.GetPeerAddressType()), peer_address,
      command_view.GetAdvertisingIntervalMax(),
      command_view.GetAdvertisingType(), command_view.GetOwnAddressType(),
      command_view.GetPeerAddressType(), command_view.GetPeerAddress(),
      command_view.GetAdvertisingChannelMap(),
      command_view.GetAdvertisingFilterPolicy());

  send_event_(bluetooth::hci::LeSetAdvertisingParametersCompleteBuilder::Create(
      kNumCommandPackets, ErrorCode::SUCCESS));
      kNumCommandPackets, status));
}

void DualModeController::LeReadAdvertisingPhysicalChannelTxPower(
@@ -2123,7 +2117,7 @@ void DualModeController::LeReadAdvertisingPhysicalChannelTxPower(
  send_event_(
      bluetooth::hci::LeReadAdvertisingPhysicalChannelTxPowerCompleteBuilder::
          Create(kNumCommandPackets, ErrorCode::SUCCESS,
                 link_layer_controller_.GetLeAdvertisingTxPower()));
                 properties_.le_advertising_physical_channel_tx_power));
}

void DualModeController::LeSetAdvertisingData(CommandView command) {
@@ -2132,13 +2126,14 @@ void DualModeController::LeSetAdvertisingData(CommandView command) {
  auto payload = command.GetPayload();
  auto data_size = *payload.begin();
  auto first_data = payload.begin() + 1;
  std::vector<uint8_t> payload_bytes{first_data, first_data + data_size};
  std::vector<uint8_t> advertising_data{first_data, first_data + data_size};
  ASSERT_LOG(command_view.IsValid(), "%s command.size() = %zu",
             gd_hci::OpCodeText(command.GetOpCode()).c_str(), command.size());
  ASSERT(command_view.GetPayload().size() == 32);
  link_layer_controller_.SetLeAdvertisingData(payload_bytes);
  ErrorCode status =
      link_layer_controller_.LeSetAdvertisingData(advertising_data);
  send_event_(bluetooth::hci::LeSetAdvertisingDataCompleteBuilder::Create(
      kNumCommandPackets, ErrorCode::SUCCESS));
      kNumCommandPackets, status));
}

void DualModeController::LeSetScanResponseData(CommandView command) {
@@ -2146,10 +2141,11 @@ void DualModeController::LeSetScanResponseData(CommandView command) {
      gd_hci::LeAdvertisingCommandView::Create(command));
  ASSERT(command_view.IsValid());
  ASSERT(command_view.GetPayload().size() == 32);
  link_layer_controller_.SetLeScanResponseData(std::vector<uint8_t>(
      command_view.GetPayload().begin() + 1, command_view.GetPayload().end()));
  ErrorCode status = link_layer_controller_.LeSetScanResponseData(
      std::vector<uint8_t>(command_view.GetPayload().begin() + 1,
                           command_view.GetPayload().end()));
  send_event_(bluetooth::hci::LeSetScanResponseDataCompleteBuilder::Create(
      kNumCommandPackets, ErrorCode::SUCCESS));
      kNumCommandPackets, status));
}

void DualModeController::LeSetAdvertisingEnable(CommandView command) {
@@ -2160,7 +2156,7 @@ void DualModeController::LeSetAdvertisingEnable(CommandView command) {
  LOG_INFO("%s | LeSetAdvertisingEnable (%d)", GetAddress().ToString().c_str(),
           command_view.GetAdvertisingEnable() == gd_hci::Enable::ENABLED);

  auto status = link_layer_controller_.SetLeAdvertisingEnable(
  ErrorCode status = link_layer_controller_.LeSetAdvertisingEnable(
      command_view.GetAdvertisingEnable() == gd_hci::Enable::ENABLED);
  send_event_(bluetooth::hci::LeSetAdvertisingEnableCompleteBuilder::Create(
      kNumCommandPackets, status));
@@ -2170,15 +2166,13 @@ void DualModeController::LeSetScanParameters(CommandView command) {
  auto command_view = gd_hci::LeSetScanParametersView::Create(
      gd_hci::LeScanningCommandView::Create(command));
  ASSERT(command_view.IsValid());
  link_layer_controller_.SetLeScanType(
      static_cast<uint8_t>(command_view.GetLeScanType()));
  link_layer_controller_.SetLeScanInterval(command_view.GetLeScanInterval());
  link_layer_controller_.SetLeScanWindow(command_view.GetLeScanWindow());
  link_layer_controller_.SetLeAddressType(command_view.GetOwnAddressType());
  link_layer_controller_.SetLeScanFilterPolicy(

  ErrorCode status = link_layer_controller_.LeSetScanParameters(
      command_view.GetLeScanType(), command_view.GetLeScanInterval(),
      command_view.GetLeScanWindow(), command_view.GetOwnAddressType(),
      command_view.GetScanningFilterPolicy());
  send_event_(bluetooth::hci::LeSetScanParametersCompleteBuilder::Create(
      kNumCommandPackets, ErrorCode::SUCCESS));
      kNumCommandPackets, status));
}

void DualModeController::LeSetScanEnable(CommandView command) {
@@ -2189,15 +2183,11 @@ void DualModeController::LeSetScanEnable(CommandView command) {
  LOG_INFO("%s | LeSetScanEnable (%d)", GetAddress().ToString().c_str(),
           command_view.GetLeScanEnable() == gd_hci::Enable::ENABLED);

  if (command_view.GetLeScanEnable() == gd_hci::Enable::ENABLED) {
    link_layer_controller_.SetLeScanEnable(gd_hci::OpCode::LE_SET_SCAN_ENABLE);
  } else {
    link_layer_controller_.SetLeScanEnable(gd_hci::OpCode::NONE);
  }
  link_layer_controller_.SetLeFilterDuplicates(
  ErrorCode status = link_layer_controller_.LeSetScanEnable(
      command_view.GetLeScanEnable() == gd_hci::Enable::ENABLED,
      command_view.GetFilterDuplicates() == gd_hci::Enable::ENABLED);
  send_event_(bluetooth::hci::LeSetScanEnableCompleteBuilder::Create(
      kNumCommandPackets, ErrorCode::SUCCESS));
      kNumCommandPackets, status));
}

void DualModeController::LeCreateConnection(CommandView command) {
@@ -2214,13 +2204,11 @@ void DualModeController::LeCreateConnection(CommandView command) {
  if (initiator_filter_policy ==
      bluetooth::hci::InitiatorFilterPolicy::USE_PEER_ADDRESS) {
    // Connect list not used
    uint8_t peer_address_type =
        static_cast<uint8_t>(command_view.GetPeerAddressType());
    Address peer_address = command_view.GetPeerAddress();
    link_layer_controller_.SetLePeerAddressType(peer_address_type);
    link_layer_controller_.SetLePeerAddress(peer_address);
    link_layer_controller_.SetLePeerAddress(AddressWithType{
        command_view.GetPeerAddress(), command_view.GetPeerAddressType()});
  }
  link_layer_controller_.SetLeAddressType(command_view.GetOwnAddressType());
  link_layer_controller_.SetLeConnectionOwnAddressType(
      command_view.GetOwnAddressType());
  link_layer_controller_.SetLeConnectionIntervalMin(
      command_view.GetConnIntervalMin());
  link_layer_controller_.SetLeConnectionIntervalMax(
@@ -2437,18 +2425,10 @@ void DualModeController::LeAddDeviceToResolvingList(CommandView command) {
  auto command_view = gd_hci::LeAddDeviceToResolvingListView::Create(
      gd_hci::LeSecurityCommandView::Create(command));
  ASSERT(command_view.IsValid());
  AddressType peer_identity_address_type;
  switch (command_view.GetPeerIdentityAddressType()) {
    case bluetooth::hci::PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS:
      peer_identity_address_type = AddressType::PUBLIC_DEVICE_ADDRESS;
      break;
    case bluetooth::hci::PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS:
      peer_identity_address_type = AddressType::RANDOM_DEVICE_ADDRESS;
      break;
  }
  ErrorCode status = link_layer_controller_.LeAddDeviceToResolvingList(
      peer_identity_address_type, command_view.GetPeerIdentityAddress(),
      command_view.GetPeerIrk(), command_view.GetLocalIrk());
      command_view.GetPeerIdentityAddressType(),
      command_view.GetPeerIdentityAddress(), command_view.GetPeerIrk(),
      command_view.GetLocalIrk());
  send_event_(bluetooth::hci::LeAddDeviceToResolvingListCompleteBuilder::Create(
      kNumCommandPackets, status));
}
@@ -2457,18 +2437,9 @@ void DualModeController::LeRemoveDeviceFromResolvingList(CommandView command) {
  auto command_view = gd_hci::LeRemoveDeviceFromResolvingListView::Create(
      gd_hci::LeSecurityCommandView::Create(command));
  ASSERT(command_view.IsValid());

  AddressType peer_identity_address_type;
  switch (command_view.GetPeerIdentityAddressType()) {
    case bluetooth::hci::PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS:
      peer_identity_address_type = AddressType::PUBLIC_DEVICE_ADDRESS;
      break;
    case bluetooth::hci::PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS:
      peer_identity_address_type = AddressType::RANDOM_DEVICE_ADDRESS;
      break;
  }
  ErrorCode status = link_layer_controller_.LeRemoveDeviceFromResolvingList(
      peer_identity_address_type, command_view.GetPeerIdentityAddress());
      command_view.GetPeerIdentityAddressType(),
      command_view.GetPeerIdentityAddress());
  send_event_(
      bluetooth::hci::LeRemoveDeviceFromResolvingListCompleteBuilder::Create(
          kNumCommandPackets, status));
@@ -2478,23 +2449,9 @@ void DualModeController::LeSetExtendedScanParameters(CommandView command) {
  auto command_view = gd_hci::LeSetExtendedScanParametersView::Create(
      gd_hci::LeScanningCommandView::Create(command));
  ASSERT(command_view.IsValid());
  auto parameters = command_view.GetParameters();
  // Multiple phys are not supported.
  ASSERT(command_view.GetScanningPhys() == 1);
  ASSERT(parameters.size() == 1);

  auto status = ErrorCode::SUCCESS;
  if (link_layer_controller_.GetLeScanEnable() == OpCode::NONE) {
    link_layer_controller_.SetLeScanType(
        static_cast<uint8_t>(parameters[0].le_scan_type_));
    link_layer_controller_.SetLeScanInterval(parameters[0].le_scan_interval_);
    link_layer_controller_.SetLeScanWindow(parameters[0].le_scan_window_);
    link_layer_controller_.SetLeAddressType(command_view.GetOwnAddressType());
    link_layer_controller_.SetLeScanFilterPolicy(
        command_view.GetScanningFilterPolicy());
  } else {
    status = ErrorCode::COMMAND_DISALLOWED;
  }
  ErrorCode status = link_layer_controller_.LeSetExtendedScanParameters(
      command_view.GetOwnAddressType(), command_view.GetScanningFilterPolicy(),
      command_view.GetScanningPhys(), command_view.GetParameters());
  send_event_(
      bluetooth::hci::LeSetExtendedScanParametersCompleteBuilder::Create(
          kNumCommandPackets, status));
@@ -2504,16 +2461,12 @@ void DualModeController::LeSetExtendedScanEnable(CommandView command) {
  auto command_view = gd_hci::LeSetExtendedScanEnableView::Create(
      gd_hci::LeScanningCommandView::Create(command));
  ASSERT(command_view.IsValid());
  if (command_view.GetEnable() == gd_hci::Enable::ENABLED) {
    link_layer_controller_.SetLeScanEnable(
        gd_hci::OpCode::LE_SET_EXTENDED_SCAN_ENABLE);
  } else {
    link_layer_controller_.SetLeScanEnable(gd_hci::OpCode::NONE);
  }
  link_layer_controller_.SetLeFilterDuplicates(
      command_view.GetFilterDuplicates() == gd_hci::FilterDuplicates::ENABLED);
  ErrorCode status = link_layer_controller_.LeSetExtendedScanEnable(
      command_view.GetEnable() == gd_hci::Enable::ENABLED,
      command_view.GetFilterDuplicates(), command_view.GetDuration(),
      command_view.GetPeriod());
  send_event_(bluetooth::hci::LeSetExtendedScanEnableCompleteBuilder::Create(
      kNumCommandPackets, ErrorCode::SUCCESS));
      kNumCommandPackets, status));
}

void DualModeController::LeExtendedCreateConnection(CommandView command) {
@@ -2531,11 +2484,13 @@ void DualModeController::LeExtendedCreateConnection(CommandView command) {

  if (initiator_filter_policy ==
      gd_hci::InitiatorFilterPolicy::USE_PEER_ADDRESS) {
    link_layer_controller_.SetLePeerAddressType(
        static_cast<uint8_t>(command_view.GetPeerAddressType()));
    link_layer_controller_.SetLePeerAddress(command_view.GetPeerAddress());
    link_layer_controller_.SetLePeerAddress(AddressWithType{
        command_view.GetPeerAddress(),
        command_view.GetPeerAddressType(),
    });
  }
  link_layer_controller_.SetLeAddressType(command_view.GetOwnAddressType());
  link_layer_controller_.SetLeConnectionOwnAddressType(
      command_view.GetOwnAddressType());
  link_layer_controller_.SetLeConnectionIntervalMin(
      params[0].conn_interval_min_);
  link_layer_controller_.SetLeConnectionIntervalMax(
@@ -2556,27 +2511,11 @@ void DualModeController::LeSetPrivacyMode(CommandView command) {
  auto command_view = gd_hci::LeSetPrivacyModeView::Create(
      gd_hci::LeSecurityCommandView::Create(command));
  ASSERT(command_view.IsValid());

  Address peer_identity_address = command_view.GetPeerIdentityAddress();
  uint8_t privacy_mode = static_cast<uint8_t>(command_view.GetPrivacyMode());

  AddressType peer_identity_address_type;
  switch (command_view.GetPeerIdentityAddressType()) {
    case bluetooth::hci::PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS:
      peer_identity_address_type = AddressType::PUBLIC_DEVICE_ADDRESS;
      break;
    case bluetooth::hci::PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS:
      peer_identity_address_type = AddressType::RANDOM_DEVICE_ADDRESS;
      break;
  }
  if (link_layer_controller_.LeResolvingListContainsDevice(
          peer_identity_address_type, peer_identity_address)) {
    link_layer_controller_.LeSetPrivacyMode(
        peer_identity_address_type, peer_identity_address, privacy_mode);
  }

  ErrorCode status = link_layer_controller_.LeSetPrivacyMode(
      command_view.GetPeerIdentityAddressType(),
      command_view.GetPeerIdentityAddress(), command_view.GetPrivacyMode());
  send_event_(bluetooth::hci::LeSetPrivacyModeCompleteBuilder::Create(
      kNumCommandPackets, ErrorCode::SUCCESS));
      kNumCommandPackets, status));
}

void DualModeController::LeReadIsoTxSync(CommandView command) {
@@ -2863,32 +2802,37 @@ void DualModeController::LeSetAdvertisingSetRandomAddress(CommandView command) {
  auto command_view = gd_hci::LeSetAdvertisingSetRandomAddressView::Create(
      gd_hci::LeAdvertisingCommandView::Create(command));
  ASSERT(command_view.IsValid());
  link_layer_controller_.SetLeExtendedAddress(
  ErrorCode status = link_layer_controller_.LeSetAdvertisingSetRandomAddress(
      command_view.GetAdvertisingHandle(), command_view.GetRandomAddress());
  send_event_(
      bluetooth::hci::LeSetAdvertisingSetRandomAddressCompleteBuilder::Create(
          kNumCommandPackets, ErrorCode::SUCCESS));
          kNumCommandPackets, status));
}

void DualModeController::LeSetExtendedAdvertisingParameters(
    CommandView command) {
  auto command_view =
      gd_hci::LeSetExtendedAdvertisingParametersLegacyView::Create(
  auto command_view = gd_hci::LeSetExtendedAdvertisingParametersView::Create(
      gd_hci::LeAdvertisingCommandView::Create(command));
  // TODO: Support non-legacy parameters
  ASSERT(command_view.IsValid());
  link_layer_controller_.SetLeExtendedAdvertisingParameters(
  ErrorCode status = link_layer_controller_.LeSetExtendedAdvertisingParameters(
      command_view.GetAdvertisingHandle(),
      command_view.GetAdvertisingEventProperties(),
      command_view.GetPrimaryAdvertisingIntervalMin(),
      command_view.GetPrimaryAdvertisingIntervalMax(),
      command_view.GetLegacyAdvertisingEventProperties(),
      command_view.GetPrimaryAdvertisingChannelMap(),
      command_view.GetOwnAddressType(), command_view.GetPeerAddressType(),
      command_view.GetPeerAddress(), command_view.GetAdvertisingFilterPolicy(),
      command_view.GetAdvertisingTxPower());

      command_view.GetAdvertisingTxPower(),
      command_view.GetPrimaryAdvertisingPhy(),
      command_view.GetSecondaryAdvertisingMaxSkip(),
      command_view.GetSecondaryAdvertisingPhy(),
      command_view.GetAdvertisingSid(),
      command_view.GetScanRequestNotificationEnable() == Enable::ENABLED);
  // The selected TX power is always the requested TX power
  // at the moment.
  send_event_(
      bluetooth::hci::LeSetExtendedAdvertisingParametersCompleteBuilder::Create(
          kNumCommandPackets, ErrorCode::SUCCESS, 0xa5));
          kNumCommandPackets, status, command_view.GetAdvertisingTxPower()));
}

void DualModeController::LeSetExtendedAdvertisingData(CommandView command) {
@@ -2898,43 +2842,38 @@ void DualModeController::LeSetExtendedAdvertisingData(CommandView command) {
  auto raw_command_view = gd_hci::LeSetExtendedAdvertisingDataRawView::Create(
      gd_hci::LeAdvertisingCommandView::Create(command));
  ASSERT(raw_command_view.IsValid());
  link_layer_controller_.SetLeExtendedAdvertisingData(
      command_view.GetAdvertisingHandle(),
  ErrorCode status = link_layer_controller_.LeSetExtendedAdvertisingData(
      command_view.GetAdvertisingHandle(), command_view.GetOperation(),
      command_view.GetFragmentPreference(),
      raw_command_view.GetAdvertisingData());
  send_event_(
      bluetooth::hci::LeSetExtendedAdvertisingDataCompleteBuilder::Create(
          kNumCommandPackets, ErrorCode::SUCCESS));
          kNumCommandPackets, status));
}

void DualModeController::LeSetExtendedScanResponseData(CommandView command) {
  auto command_view = gd_hci::LeSetExtendedScanResponseDataView::Create(
      gd_hci::LeAdvertisingCommandView::Create(command));
  ASSERT(command_view.IsValid());
  link_layer_controller_.SetLeScanResponseData(std::vector<uint8_t>(
      command_view.GetPayload().begin() + 1, command_view.GetPayload().end()));
  auto raw_command_view = gd_hci::LeSetExtendedScanResponseDataRawView::Create(
      gd_hci::LeAdvertisingCommandView::Create(command));
  ASSERT(raw_command_view.IsValid());
  link_layer_controller_.SetLeExtendedScanResponseData(
      command_view.GetAdvertisingHandle(),
  ErrorCode status = link_layer_controller_.LeSetExtendedScanResponseData(
      command_view.GetAdvertisingHandle(), command_view.GetOperation(),
      command_view.GetFragmentPreference(),
      raw_command_view.GetScanResponseData());
  send_event_(
      bluetooth::hci::LeSetExtendedScanResponseDataCompleteBuilder::Create(
          kNumCommandPackets, ErrorCode::SUCCESS));
          kNumCommandPackets, status));
}

void DualModeController::LeSetExtendedAdvertisingEnable(CommandView command) {
  auto command_view = gd_hci::LeSetExtendedAdvertisingEnableView::Create(
      gd_hci::LeAdvertisingCommandView::Create(command));
  ASSERT(command_view.IsValid());
  auto enabled_sets = command_view.GetEnabledSets();
  ErrorCode status = ErrorCode::SUCCESS;
  if (enabled_sets.size() == 0) {
    link_layer_controller_.LeDisableAdvertisingSets();
  } else {
    status = link_layer_controller_.SetLeExtendedAdvertisingEnable(
        command_view.GetEnable(), command_view.GetEnabledSets());
  }
  ErrorCode status = link_layer_controller_.LeSetExtendedAdvertisingEnable(
      command_view.GetEnable() == bluetooth::hci::Enable::ENABLED,
      command_view.GetEnabledSets());
  send_event_(
      bluetooth::hci::LeSetExtendedAdvertisingEnableCompleteBuilder::Create(
          kNumCommandPackets, status));
@@ -2959,9 +2898,8 @@ void DualModeController::LeReadNumberOfSupportedAdvertisingSets(
  ASSERT(command_view.IsValid());
  send_event_(
      bluetooth::hci::LeReadNumberOfSupportedAdvertisingSetsCompleteBuilder::
          Create(
              kNumCommandPackets, ErrorCode::SUCCESS,
              link_layer_controller_.LeReadNumberOfSupportedAdvertisingSets()));
          Create(kNumCommandPackets, ErrorCode::SUCCESS,
                 properties_.le_num_supported_advertising_sets));
}

void DualModeController::LeRemoveAdvertisingSet(CommandView command) {
Loading