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

Commit 341aafbe authored by Myles Watson's avatar Myles Watson Committed by android-build-merger
Browse files

Merge "RootCanal: Add ReadLocalSupportedFeatures"

am: b7d50057

Change-Id: I2f28d7e5775bfa363b75858b0d80856626e9c656
parents fd61539e b7d50057
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -150,6 +150,8 @@ DualModeController::DualModeController(const std::string& properties_filename, u
  SET_HANDLER(OpCode::READ_LOCAL_VERSION_INFORMATION, HciReadLocalVersionInformation);
  SET_HANDLER(OpCode::READ_BD_ADDR, HciReadBdAddr);
  SET_HANDLER(OpCode::READ_LOCAL_SUPPORTED_COMMANDS, HciReadLocalSupportedCommands);
  SET_HANDLER(OpCode::READ_LOCAL_SUPPORTED_FEATURES,
              HciReadLocalSupportedFeatures);
  SET_HANDLER(OpCode::READ_LOCAL_SUPPORTED_CODECS, HciReadLocalSupportedCodecs);
  SET_HANDLER(OpCode::READ_LOCAL_EXTENDED_FEATURES, HciReadLocalExtendedFeatures);
  SET_HANDLER(OpCode::READ_REMOTE_EXTENDED_FEATURES, HciReadRemoteExtendedFeatures);
@@ -367,6 +369,15 @@ void DualModeController::HciReadLocalSupportedCommands(packets::PacketView<true>
  send_event_(command_complete->ToVector());
}

void DualModeController::HciReadLocalSupportedFeatures(
    packets::PacketView<true> args) {
  CHECK(args.size() == 0) << __func__ << " size=" << args.size();
  std::shared_ptr<packets::EventPacketBuilder> command_complete = packets::
      EventPacketBuilder::CreateCommandCompleteReadLocalSupportedFeatures(
          hci::Status::SUCCESS, properties_.GetSupportedFeatures());
  send_event_(command_complete->ToVector());
}

void DualModeController::HciReadLocalSupportedCodecs(packets::PacketView<true> args) {
  CHECK(args.size() == 0) << __func__ << " size=" << args.size();
  std::shared_ptr<packets::EventPacketBuilder> command_complete =
+3 −0
Original line number Diff line number Diff line
@@ -265,6 +265,9 @@ class DualModeController : public Device {
  // 7.4.2
  void HciReadLocalSupportedCommands(packets::PacketView<true> args);

  // 7.4.3
  void HciReadLocalSupportedFeatures(packets::PacketView<true> args);

  // 7.4.4
  void HciReadLocalExtendedFeatures(packets::PacketView<true> args);

+13 −0
Original line number Diff line number Diff line
@@ -205,6 +205,19 @@ std::unique_ptr<EventPacketBuilder> EventPacketBuilder::CreateCommandCompleteRea
  return evt_ptr;
}

// Bluetooth Core Specification Version 4.2, Volume 2, Part E, Section 7.4.3
std::unique_ptr<EventPacketBuilder>
EventPacketBuilder::CreateCommandCompleteReadLocalSupportedFeatures(
    hci::Status status, uint64_t supported_features) {
  std::unique_ptr<EventPacketBuilder> evt_ptr =
      EventPacketBuilder::CreateCommandCompleteOnlyStatusEvent(
          OpCode::READ_LOCAL_SUPPORTED_FEATURES, status);

  CHECK(evt_ptr->AddPayloadOctets8(supported_features));

  return evt_ptr;
}

// Bluetooth Core Specification Version 4.2, Volume 2, Part E, Section 7.4.4
std::unique_ptr<EventPacketBuilder> EventPacketBuilder::CreateCommandCompleteReadLocalExtendedFeatures(
    hci::Status status, uint8_t page_number, uint8_t maximum_page_number, uint64_t extended_lmp_features) {
+5 −0
Original line number Diff line number Diff line
@@ -107,6 +107,11 @@ class EventPacketBuilder : public HciPacketBuilder {
  static std::unique_ptr<EventPacketBuilder> CreateCommandCompleteReadLocalSupportedCommands(
      hci::Status status, const std::vector<uint8_t>& supported_commands);

  // Bluetooth Core Specification Version 4.2, Volume 2, Part E, Section 7.4.3
  static std::unique_ptr<EventPacketBuilder>
  CreateCommandCompleteReadLocalSupportedFeatures(hci::Status status,
                                                  uint64_t supported_features);

  // Bluetooth Core Specification Version 4.2, Volume 2, Part E, Section 7.4.4
  static std::unique_ptr<EventPacketBuilder> CreateCommandCompleteReadLocalExtendedFeatures(
      hci::Status status, uint8_t page_number, uint8_t maximum_page_number, uint64_t extended_lmp_features);