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

Commit 6e1e23c3 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski
Browse files

IsoManager: Add state dump

Adds state dump in the following format:
  ----------------
   ISO Manager:
    Available credits: 16
    Controller buffer size: 960
    CISes:
    BISes:
      BIS Connection handle: 130
        BIG Handle: 0
        Used Credits: 0
        SDU Interval: 10000
        State Flags: 0x14
      BIS Connection handle: 131
        BIG Handle: 0
        Used Credits: 0
        SDU Interval: 10000
        State Flags: 0x14
  ----------------

Bug: 150670922
Tag: #feature
Test: build, flash,  run `adb shell dumpsys bluetooth_manager` and verify the output
Sponsor: jpawlowski@
Change-Id: I2a0fde14d132ec2e3db4800939e0b6aa5ecdab7e
parent 7affcb54
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3630,6 +3630,7 @@ void LeAudioClient::DebugDump(int fd) {
  LeAudioClientAudioSource::DebugDump(fd);
  LeAudioClientAudioSink::DebugDump(fd);
  le_audio::AudioSetConfigurationProvider::Get()->DebugDump(fd);
  IsoManager::GetInstance()->Dump(fd);
  dprintf(fd, "\n");
}

+2 −0
Original line number Diff line number Diff line
@@ -149,6 +149,8 @@ void IsoManager::Stop() {
  mock_pimpl_ = nullptr;
}

void IsoManager::Dump(int fd) {}

IsoManager::~IsoManager() = default;

}  // namespace hci
+8 −0
Original line number Diff line number Diff line
@@ -41,6 +41,10 @@ struct IsoManager::impl {
    iso_impl_.reset();
  }

  void Dump(int fd) {
    if (iso_impl_) iso_impl_->dump(fd);
  }

  bool IsRunning() { return iso_impl_ ? true : false; }

  const IsoManager& iso_manager_;
@@ -143,6 +147,10 @@ void IsoManager::Stop() {
    pimpl_->Stop();
}

void IsoManager::Dump(int fd) {
  if (pimpl_->IsRunning()) pimpl_->Dump(fd);
}

IsoManager::~IsoManager() = default;

}  // namespace hci
+28 −0
Original line number Diff line number Diff line
@@ -767,6 +767,34 @@ struct iso_impl {
    return (bis_it != conn_hdl_to_bis_map_.cend());
  }

  void dump(int fd) const {
    dprintf(fd, "  ----------------\n ");
    dprintf(fd, "  ISO Manager:\n");
    dprintf(fd, "    Available credits: %d\n", iso_credits_.load());
    dprintf(fd, "    Controller buffer size: %d\n", iso_buffer_size_);
    dprintf(fd, "    CISes:\n");
    for (auto const& cis_pair : conn_hdl_to_cis_map_) {
      dprintf(fd, "      CIS Connection handle: %d\n", cis_pair.first);
      dprintf(fd, "        CIG ID: %d\n", cis_pair.second->cig_id);
      dprintf(fd, "        Used Credits: %d\n",
              cis_pair.second->used_credits.load());
      dprintf(fd, "        SDU Interval: %d\n", cis_pair.second->sdu_itv);
      dprintf(fd, "        State Flags: 0x%02hx\n",
              cis_pair.second->state_flags.load());
    }
    dprintf(fd, "    BISes:\n");
    for (auto const& cis_pair : conn_hdl_to_bis_map_) {
      dprintf(fd, "      BIS Connection handle: %d\n", cis_pair.first);
      dprintf(fd, "        BIG Handle: %d\n", cis_pair.second->big_handle);
      dprintf(fd, "        Used Credits: %d\n",
              cis_pair.second->used_credits.load());
      dprintf(fd, "        SDU Interval: %d\n", cis_pair.second->sdu_itv);
      dprintf(fd, "        State Flags: 0x%02hx\n",
              cis_pair.second->state_flags.load());
    }
    dprintf(fd, "  ----------------\n ");
  }

  std::map<uint16_t, std::unique_ptr<iso_cis>> conn_hdl_to_cis_map_;
  std::map<uint16_t, std::unique_ptr<iso_bis>> conn_hdl_to_bis_map_;

+5 −0
Original line number Diff line number Diff line
@@ -233,6 +233,11 @@ class IsoManager {
   */
  void Stop();

  /**
   * Dumps the IsoManager module state
   */
  void Dump(int fd);

 private:
  struct impl;
  std::unique_ptr<impl> pimpl_;
Loading