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

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

Merge "RootCanal: Add RoleDiscovery Link Layer Command"

parents 48ab22ed 29bd5099
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -171,6 +171,7 @@ DualModeController::DualModeController(const std::string& properties_filename, u
  SET_SUPPORTED(SNIFF_MODE, SniffMode);
  SET_SUPPORTED(EXIT_SNIFF_MODE, ExitSniffMode);
  SET_SUPPORTED(QOS_SETUP, QosSetup);
  SET_SUPPORTED(ROLE_DISCOVERY, RoleDiscovery);
  SET_SUPPORTED(READ_DEFAULT_LINK_POLICY_SETTINGS,
                ReadDefaultLinkPolicySettings);
  SET_SUPPORTED(WRITE_DEFAULT_LINK_POLICY_SETTINGS,
@@ -1182,6 +1183,20 @@ void DualModeController::QosSetup(CommandView command) {
  send_event_(std::move(packet));
}

void DualModeController::RoleDiscovery(CommandView command) {
  auto command_view = gd_hci::RoleDiscoveryView::Create(
      gd_hci::ConnectionManagementCommandView::Create(
          gd_hci::AclCommandView::Create(command)));
  ASSERT(command_view.IsValid());
  uint16_t handle = command_view.GetConnectionHandle();

  auto status = link_layer_controller_.RoleDiscovery(handle);

  auto packet = bluetooth::hci::RoleDiscoveryCompleteBuilder::Create(
      kNumCommandPackets, status, handle, bluetooth::hci::Role::CENTRAL);
  send_event_(std::move(packet));
}

void DualModeController::ReadDefaultLinkPolicySettings(CommandView command) {
  auto command_view = gd_hci::ReadDefaultLinkPolicySettingsView::Create(
      gd_hci::ConnectionManagementCommandView::Create(
+3 −0
Original line number Diff line number Diff line
@@ -213,6 +213,9 @@ class DualModeController : public Device {
  // 7.2.6
  void QosSetup(CommandView args);

  // 7.2.7
  void RoleDiscovery(CommandView args);

  // 7.2.10
  void WriteLinkPolicySettings(CommandView args);

+9 −0
Original line number Diff line number Diff line
@@ -2456,6 +2456,15 @@ ErrorCode LinkLayerController::QosSetup(uint16_t handle, uint8_t service_type,
  return ErrorCode::COMMAND_DISALLOWED;
}

ErrorCode LinkLayerController::RoleDiscovery(uint16_t handle) {
  if (!connections_.HasHandle(handle)) {
    return ErrorCode::UNKNOWN_CONNECTION;
  }

  // TODO: Implement real logic
  return ErrorCode::SUCCESS;
}

ErrorCode LinkLayerController::SwitchRole(Address /* bd_addr */,
                                          uint8_t /* role */) {
  // TODO: implement real logic
+1 −0
Original line number Diff line number Diff line
@@ -322,6 +322,7 @@ class LinkLayerController {
  ErrorCode QosSetup(uint16_t handle, uint8_t service_type, uint32_t token_rate,
                     uint32_t peak_bandwidth, uint32_t latency,
                     uint32_t delay_variation);
  ErrorCode RoleDiscovery(uint16_t handle);
  ErrorCode SwitchRole(Address bd_addr, uint8_t role);
  ErrorCode WriteLinkPolicySettings(uint16_t handle, uint16_t settings);
  ErrorCode FlowSpecification(uint16_t handle, uint8_t flow_direction,