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

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

Merge "RootCanal: Implement support for LE Periodic Sync" am: c09521a6

parents 8a463499 c09521a6
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -223,13 +223,18 @@ cc_test_host {
    ],
    srcs: [
        "test/controller/le/le_add_device_to_filter_accept_list_test.cc",
        "test/controller/le/le_add_device_to_periodic_advertiser_list_test.cc",
        "test/controller/le/le_add_device_to_resolving_list_test.cc",
        "test/controller/le/le_clear_filter_accept_list_test.cc",
        "test/controller/le/le_clear_periodic_advertiser_list_test.cc",
        "test/controller/le/le_clear_resolving_list_test.cc",
        "test/controller/le/le_create_connection_cancel_test.cc",
        "test/controller/le/le_create_connection_test.cc",
        "test/controller/le/le_extended_create_connection_test.cc",
        "test/controller/le/le_periodic_advertising_create_sync_test.cc",
        "test/controller/le/le_periodic_advertising_create_sync_cancel_test.cc",
        "test/controller/le/le_remove_device_from_filter_accept_list_test.cc",
        "test/controller/le/le_remove_device_from_periodic_advertiser_list_test.cc",
        "test/controller/le/le_remove_device_from_resolving_list_test.cc",
        "test/controller/le/le_scanning_filter_duplicates_test.cc",
        "test/controller/le/le_set_address_resolution_enable_test.cc",
+3 −0
Original line number Diff line number Diff line
@@ -116,6 +116,9 @@ struct ControllerProperties {
  // at any time. This behaviour is not emulated here.
  uint8_t le_num_supported_advertising_sets{8};

  // LE Periodic Advertiser List Size (Vol 4, Part E § 7.8.73).
  uint8_t le_periodic_advertiser_list_size{8};

  // Vendor Information.
  // Provide parameters returned by vendor specific commands.
  std::vector<uint8_t> le_vendor_capabilities{};
+106 −14
Original line number Diff line number Diff line
@@ -2350,6 +2350,98 @@ void DualModeController::LeSetPeriodicAdvertisingEnable(CommandView command) {
          kNumCommandPackets, status));
}

void DualModeController::LePeriodicAdvertisingCreateSync(CommandView command) {
  auto command_view =
      bluetooth::hci::LePeriodicAdvertisingCreateSyncView::Create(
          bluetooth::hci::LeScanningCommandView::Create(command));
  ASSERT(command_view.IsValid());
  ErrorCode status = link_layer_controller_.LePeriodicAdvertisingCreateSync(
      command_view.GetOptions(), command_view.GetAdvertisingSid(),
      command_view.GetAdvertiserAddressType(),
      command_view.GetAdvertiserAddress(), command_view.GetSkip(),
      command_view.GetSyncTimeout(), command_view.GetSyncCteType());
  send_event_(
      bluetooth::hci::LePeriodicAdvertisingCreateSyncStatusBuilder::Create(
          status, kNumCommandPackets));
}

void DualModeController::LePeriodicAdvertisingCreateSyncCancel(
    CommandView command) {
  auto command_view =
      bluetooth::hci::LePeriodicAdvertisingCreateSyncCancelView::Create(
          bluetooth::hci::LeScanningCommandView::Create(command));
  ASSERT(command_view.IsValid());
  ErrorCode status =
      link_layer_controller_.LePeriodicAdvertisingCreateSyncCancel();
  send_event_(
      bluetooth::hci::LePeriodicAdvertisingCreateSyncCancelCompleteBuilder::
          Create(kNumCommandPackets, status));
}

void DualModeController::LePeriodicAdvertisingTerminateSync(
    CommandView command) {
  auto command_view =
      bluetooth::hci::LePeriodicAdvertisingTerminateSyncView::Create(
          bluetooth::hci::LeScanningCommandView::Create(command));
  ASSERT(command_view.IsValid());
  ErrorCode status = link_layer_controller_.LePeriodicAdvertisingTerminateSync(
      command_view.GetSyncHandle());
  send_event_(
      bluetooth::hci::LePeriodicAdvertisingTerminateSyncCompleteBuilder::Create(
          kNumCommandPackets, status));
}

void DualModeController::LeAddDeviceToPeriodicAdvertiserList(
    CommandView command) {
  auto command_view =
      bluetooth::hci::LeAddDeviceToPeriodicAdvertiserListView::Create(
          bluetooth::hci::LeScanningCommandView::Create(command));
  ASSERT(command_view.IsValid());
  ErrorCode status = link_layer_controller_.LeAddDeviceToPeriodicAdvertiserList(
      command_view.GetAdvertiserAddressType(),
      command_view.GetAdvertiserAddress(), command_view.GetAdvertisingSid());
  send_event_(
      bluetooth::hci::LeAddDeviceToPeriodicAdvertiserListCompleteBuilder::
          Create(kNumCommandPackets, status));
}

void DualModeController::LeRemoveDeviceFromPeriodicAdvertiserList(
    CommandView command) {
  auto command_view =
      bluetooth::hci::LeRemoveDeviceFromPeriodicAdvertiserListView::Create(
          bluetooth::hci::LeScanningCommandView::Create(command));
  ASSERT(command_view.IsValid());
  ErrorCode status =
      link_layer_controller_.LeRemoveDeviceFromPeriodicAdvertiserList(
          command_view.GetAdvertiserAddressType(),
          command_view.GetAdvertiserAddress(),
          command_view.GetAdvertisingSid());
  send_event_(
      bluetooth::hci::LeRemoveDeviceFromPeriodicAdvertiserListCompleteBuilder::
          Create(kNumCommandPackets, status));
}

void DualModeController::LeClearPeriodicAdvertiserList(CommandView command) {
  auto command_view = bluetooth::hci::LeClearPeriodicAdvertiserListView::Create(
      bluetooth::hci::LeScanningCommandView::Create(command));
  ASSERT(command_view.IsValid());
  ErrorCode status = link_layer_controller_.LeClearPeriodicAdvertiserList();
  send_event_(
      bluetooth::hci::LeClearPeriodicAdvertiserListCompleteBuilder::Create(
          kNumCommandPackets, status));
}

void DualModeController::LeReadPeriodicAdvertiserListSize(CommandView command) {
  auto command_view =
      bluetooth::hci::LeReadPeriodicAdvertiserListSizeView::Create(
          bluetooth::hci::LeScanningCommandView::Create(command));
  ASSERT(command_view.IsValid());
  send_event_(
      bluetooth::hci::LeReadPeriodicAdvertiserListSizeCompleteBuilder::Create(
          kNumCommandPackets, ErrorCode::SUCCESS,
          properties_.le_periodic_advertiser_list_size));
}

void DualModeController::LeSetExtendedScanParameters(CommandView command) {
  auto command_view = bluetooth::hci::LeSetExtendedScanParametersView::Create(
      bluetooth::hci::LeScanningCommandView::Create(command));
@@ -4014,20 +4106,20 @@ const std::unordered_map<OpCode, DualModeController::CommandHandler>
         &DualModeController::LeSetExtendedScanEnable},
        {OpCode::LE_EXTENDED_CREATE_CONNECTION,
         &DualModeController::LeExtendedCreateConnection},
        //{OpCode::LE_PERIODIC_ADVERTISING_CREATE_SYNC,
        //&DualModeController::LePeriodicAdvertisingCreateSync},
        //{OpCode::LE_PERIODIC_ADVERTISING_CREATE_SYNC_CANCEL,
        //&DualModeController::LePeriodicAdvertisingCreateSyncCancel},
        //{OpCode::LE_PERIODIC_ADVERTISING_TERMINATE_SYNC,
        //&DualModeController::LePeriodicAdvertisingTerminateSync},
        //{OpCode::LE_ADD_DEVICE_TO_PERIODIC_ADVERTISER_LIST,
        //&DualModeController::LeAddDeviceToPeriodicAdvertiserList},
        //{OpCode::LE_REMOVE_DEVICE_FROM_PERIODIC_ADVERTISER_LIST,
        //&DualModeController::LeRemoveDeviceFromPeriodicAdvertiserList},
        //{OpCode::LE_CLEAR_PERIODIC_ADVERTISER_LIST,
        //&DualModeController::LeClearPeriodicAdvertiserList},
        //{OpCode::LE_READ_PERIODIC_ADVERTISER_LIST_SIZE,
        //&DualModeController::LeReadPeriodicAdvertiserListSize},
        {OpCode::LE_PERIODIC_ADVERTISING_CREATE_SYNC,
         &DualModeController::LePeriodicAdvertisingCreateSync},
        {OpCode::LE_PERIODIC_ADVERTISING_CREATE_SYNC_CANCEL,
         &DualModeController::LePeriodicAdvertisingCreateSyncCancel},
        {OpCode::LE_PERIODIC_ADVERTISING_TERMINATE_SYNC,
         &DualModeController::LePeriodicAdvertisingTerminateSync},
        {OpCode::LE_ADD_DEVICE_TO_PERIODIC_ADVERTISER_LIST,
         &DualModeController::LeAddDeviceToPeriodicAdvertiserList},
        {OpCode::LE_REMOVE_DEVICE_FROM_PERIODIC_ADVERTISER_LIST,
         &DualModeController::LeRemoveDeviceFromPeriodicAdvertiserList},
        {OpCode::LE_CLEAR_PERIODIC_ADVERTISER_LIST,
         &DualModeController::LeClearPeriodicAdvertiserList},
        {OpCode::LE_READ_PERIODIC_ADVERTISER_LIST_SIZE,
         &DualModeController::LeReadPeriodicAdvertiserListSize},
        //{OpCode::LE_READ_TRANSMIT_POWER,
        //&DualModeController::LeReadTransmitPower},
        //{OpCode::LE_READ_RF_PATH_COMPENSATION_POWER,
+11 −0
Original line number Diff line number Diff line
@@ -563,6 +563,17 @@ class DualModeController : public Device {
  void LeSetPeriodicAdvertisingData(CommandView command);
  void LeSetPeriodicAdvertisingEnable(CommandView command);

  // 7.8.67 - 7.8.69
  void LePeriodicAdvertisingCreateSync(CommandView command);
  void LePeriodicAdvertisingCreateSyncCancel(CommandView command);
  void LePeriodicAdvertisingTerminateSync(CommandView command);

  // 7.8.70 - 7.8.73
  void LeAddDeviceToPeriodicAdvertiserList(CommandView command);
  void LeRemoveDeviceFromPeriodicAdvertiserList(CommandView command);
  void LeClearPeriodicAdvertiserList(CommandView command);
  void LeReadPeriodicAdvertiserListSize(CommandView command);

  // 7.8.64
  void LeSetExtendedScanParameters(CommandView command);

+423 −0

File changed.

Preview size limit exceeded, changes collapsed.

Loading