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

Commit 213be882 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

gd: Plumb through ReadRemoteExtendedFeatures am: 66985564

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1466036

Change-Id: Ic0b00846b0488e8651907f437390b643c9d69c81
parents e34e9610 66985564
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -116,12 +116,16 @@ class AclConnectionTracker : public ConnectionManagementCallbacks {
  void OnRoleChange(Role new_role) override {
    SAVE_OR_CALL(OnRoleChange, new_role)
  }
  void OnReadRemoteVersionInformationComplete(
      uint8_t lmp_version, uint16_t manufacturer_name, uint16_t sub_version) override {
    SAVE_OR_CALL(OnReadRemoteVersionInformationComplete, lmp_version, manufacturer_name, sub_version);
  }
  void OnReadRemoteExtendedFeaturesComplete(uint8_t page_number, uint8_t max_page_number, uint64_t features) override {
    SAVE_OR_CALL(OnReadRemoteExtendedFeaturesComplete, page_number, max_page_number, features);
  }
  void OnDisconnection(ErrorCode reason) {
    SAVE_OR_CALL(OnDisconnection, reason);
  }
  void OnReadRemoteVersionInformationComplete(uint8_t lmp_version, uint16_t manufacturer_name, uint16_t sub_version) {
    SAVE_OR_CALL(OnReadRemoteVersionInformationComplete, lmp_version, manufacturer_name, sub_version);
  }

#undef SAVE_OR_CALL

@@ -253,7 +257,6 @@ class AclConnectionTracker : public ConnectionManagementCallbacks {

  void on_read_remote_version_information_status(CommandStatusView view) {
    ASSERT_LOG(view.IsValid(), "Bad status packet!");
    LOG_INFO("UNIMPLEMENTED called: %s", hci::ErrorCodeText(view.GetStatus()).c_str());
  }

  void on_read_remote_supported_features_status(CommandStatusView view) {
@@ -262,9 +265,9 @@ class AclConnectionTracker : public ConnectionManagementCallbacks {
  }

  void on_read_remote_extended_features_status(CommandStatusView view) {
    ASSERT_LOG(view.IsValid(), "Broken");
    LOG_INFO("UNIMPLEMENTED called: %s", hci::ErrorCodeText(view.GetStatus()).c_str());
    ASSERT_LOG(view.IsValid(), "Bad status packet!");
  }

  void on_read_clock_complete(CommandCompleteView view) {
    auto complete_view = ReadClockCompleteView::Create(view);
    if (!complete_view.IsValid()) {
@@ -533,11 +536,11 @@ bool ClassicAclConnection::ReadRemoteSupportedFeatures() {
  return true;
}

bool ClassicAclConnection::ReadRemoteExtendedFeatures() {
bool ClassicAclConnection::ReadRemoteExtendedFeatures(uint8_t page_number) {
  acl_connection_interface_->EnqueueCommand(
      ReadRemoteExtendedFeaturesBuilder::Create(handle_, 1),
      pimpl_->tracker.client_handler_->BindOnceOn(&pimpl_->tracker,
                                                  &AclConnectionTracker::on_read_remote_extended_features_status));
      ReadRemoteExtendedFeaturesBuilder::Create(handle_, page_number),
      pimpl_->tracker.client_handler_->BindOnceOn(
          &pimpl_->tracker, &AclConnectionTracker::on_read_remote_extended_features_status));
  return true;
}

+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ class ClassicAclConnection : public AclConnection {
  virtual bool ReadClock(WhichClock which_clock);
  virtual bool ReadRemoteVersionInformation();
  virtual bool ReadRemoteSupportedFeatures();
  virtual bool ReadRemoteExtendedFeatures();
  virtual bool ReadRemoteExtendedFeatures(uint8_t page_number);

  // Called once before passing the connection to the client
  virtual ConnectionManagementCallbacks* GetEventCallbacks();
+8 −2
Original line number Diff line number Diff line
@@ -457,7 +457,10 @@ struct classic_impl : public DisconnectorForLe, public security::ISecurityManage
      LOG_ERROR("Received on_read_remote_version_information_complete with error code %s", error_code.c_str());
      return;
    }
    LOG_INFO("UNIMPLEMENTED called");
    uint16_t handle = view.GetConnectionHandle();
    auto& acl_connection = acl_connections_.find(handle)->second;
    acl_connection.connection_management_callbacks_->OnReadRemoteVersionInformationComplete(
        view.GetVersion(), view.GetManufacturerName(), view.GetSubVersion());
  }

  void on_read_remote_supported_features_complete(EventPacketView packet) {
@@ -469,7 +472,10 @@ struct classic_impl : public DisconnectorForLe, public security::ISecurityManage
  void on_read_remote_extended_features_complete(EventPacketView packet) {
    auto view = ReadRemoteExtendedFeaturesCompleteView::Create(packet);
    ASSERT_LOG(view.IsValid(), "Read remote extended features packet invalid");
    LOG_INFO("UNIMPLEMENTED called");
    uint16_t handle = view.GetConnectionHandle();
    auto& acl_connection = acl_connections_.find(handle)->second;
    acl_connection.connection_management_callbacks_->OnReadRemoteExtendedFeaturesComplete(
        view.GetPageNumber(), view.GetMaximumPageNumber(), view.GetExtendedLmpFeatures());
  }

  void on_link_supervision_timeout_changed(EventPacketView packet) {
+3 −0
Original line number Diff line number Diff line
@@ -79,6 +79,9 @@ class ConnectionManagementCallbacks {
  // Invoked when controller sends Read Remote Version Information Complete
  virtual void OnReadRemoteVersionInformationComplete(
      uint8_t lmp_version, uint16_t manufacturer_name, uint16_t sub_version) = 0;
  // Invoked when controller sends Read Remote Extended Features Complete
  virtual void OnReadRemoteExtendedFeaturesComplete(
      uint8_t page_number, uint8_t max_page_number, uint64_t features) = 0;
};

}  // namespace acl_manager
+2 −0
Original line number Diff line number Diff line
@@ -502,6 +502,8 @@ class AclManagerWithConnectionTest : public AclManagerTest {
    MOCK_METHOD3(
        OnReadRemoteVersionInformationComplete,
        void(uint8_t lmp_version, uint16_t manufacturer_name, uint16_t sub_version));
    MOCK_METHOD3(
        OnReadRemoteExtendedFeaturesComplete, void(uint8_t page_number, uint8_t max_page_number, uint64_t features));
  } mock_connection_management_callbacks_;
};

Loading