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

Commit 1f73782a authored by Chris Manton's avatar Chris Manton
Browse files

Add gd/l2cap::OnReadRemoteVersionInformationComplete

Provide ability to handle at higher layer

Bug: 166280067
Tag: #refactor
Test: gd/cert/run --host
Change-Id: I717b273623df4a3e21bf07e62b034cd7ad790cd3
parent 95d43bc5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -119,6 +119,10 @@ class AclConnectionTracker : public ConnectionManagementCallbacks {
  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

  void on_role_discovery_complete(CommandCompleteView view) {
+6 −0
Original line number Diff line number Diff line
@@ -451,6 +451,12 @@ struct classic_impl : public DisconnectorForLe, public security::ISecurityManage
  void on_read_remote_version_information_complete(EventPacketView packet) {
    auto view = ReadRemoteVersionInformationCompleteView::Create(packet);
    ASSERT_LOG(view.IsValid(), "Read remote version information packet invalid");
    if (view.GetStatus() != ErrorCode::SUCCESS) {
      auto status = view.GetStatus();
      std::string error_code = ErrorCodeText(status);
      LOG_ERROR("Received on_read_remote_version_information_complete with error code %s", error_code.c_str());
      return;
    }
    LOG_INFO("UNIMPLEMENTED called");
  }

+3 −0
Original line number Diff line number Diff line
@@ -76,6 +76,9 @@ class ConnectionManagementCallbacks {
  virtual void OnRoleChange(Role new_role) = 0;
  // Invoked when controller sends DisconnectComplete
  virtual void OnDisconnection(ErrorCode reason) = 0;
  // 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;
};

}  // namespace acl_manager
+3 −0
Original line number Diff line number Diff line
@@ -499,6 +499,9 @@ class AclManagerWithConnectionTest : public AclManagerTest {
    MOCK_METHOD1(OnMasterLinkKeyComplete, void(KeyFlag flag));
    MOCK_METHOD1(OnRoleChange, void(Role new_role));
    MOCK_METHOD1(OnDisconnection, void(ErrorCode reason));
    MOCK_METHOD3(
        OnReadRemoteVersionInformationComplete,
        void(uint8_t lmp_version, uint16_t manufacturer_name, uint16_t sub_version));
  } mock_connection_management_callbacks_;
};

+9 −0
Original line number Diff line number Diff line
@@ -494,6 +494,15 @@ class AclManagerFacadeService : public AclManagerFacade::Service, public Connect
      disconnection.set_event(builder_to_string(std::move(builder)));
      event_stream_->OnIncomingEvent(disconnection);
    }
    void OnReadRemoteVersionInformationComplete(
        uint8_t lmp_version, uint16_t manufacturer_name, uint16_t sub_version) override {
      LOG_DEBUG(
          "OnReadRemoteVersionInformationComplete lmp_version:%hhu manufacturer_name:%hu sub_version:%hu",
          lmp_version,
          manufacturer_name,
          sub_version);
    }

    uint16_t handle_;
    std::shared_ptr<ClassicAclConnection> connection_;
    std::shared_ptr<::bluetooth::grpc::GrpcEventQueue<ConnectionEvent>> event_stream_;
Loading