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

Commit 05c4d206 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio: Start using gd log style

Minor changed needed for using new logging style

Bug: 150670922
Test: compile
Sponsor: @jpawlowski
Change-Id: Id9eb0614d91d39d86df693db77fed694bccaa27e
parent 6d7c30d6
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -36,7 +36,9 @@
#include "devices.h"
#include "embdrv/lc3/include/lc3.h"
#include "gatt/bta_gattc_int.h"
#include "gd/common/strings.h"
#include "le_audio_types.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "osi/include/properties.h"
#include "stack/btm/btm_dev.h"
@@ -46,6 +48,7 @@

using base::Closure;
using bluetooth::Uuid;
using bluetooth::common::ToString;
using bluetooth::groups::DeviceGroups;
using bluetooth::groups::DeviceGroupsCallbacks;
using bluetooth::hci::IsoManager;
@@ -598,15 +601,15 @@ class LeAudioClientImpl : public LeAudioClient {
    }

    if (group->IsInTransition()) {
      LOG(INFO) << __func__
                << ", group is in transition from: " << group->GetState()
                << ", to: " << group->GetTargetState();
      LOG_INFO(", group is in transition from: %s to: %s",
               ToString(group->GetState()).c_str(),
               ToString(group->GetTargetState()).c_str());
      return;
    }

    if (group->GetState() != AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING) {
      LOG(ERROR) << __func__
                 << ", invalid current state of group: " << group->GetState();
      LOG_ERROR(", invalid current state of group: %s",
                ToString(group->GetState()).c_str());
      return;
    }

@@ -627,8 +630,9 @@ class LeAudioClientImpl : public LeAudioClient {
    }

    if (group->GetState() == AseState::BTA_LE_AUDIO_ASE_STATE_IDLE) {
      LOG(ERROR) << __func__
                 << ", group already stopped: " << group->GetState();
      LOG_ERROR(", group already stopped: %s",
                ToString(group->GetState()).c_str());

      return;
    }

+2 −0
Original line number Diff line number Diff line
@@ -28,7 +28,9 @@
#include "btm_iso_api_types.h"
#include "client_audio.h"
#include "device/include/controller.h"
#include "gd/common/strings.h"
#include "le_audio_set_configuration_provider.h"
#include "osi/include/log.h"

using bluetooth::hci::kIsoCigFramingFramed;
using bluetooth::hci::kIsoCigFramingUnframed;
+15 −14
Original line number Diff line number Diff line
@@ -443,20 +443,8 @@ uint8_t GetMaxCodecFramesPerSduFromPac(const acs_ac_record* pac) {
  return 1;
}

}  // namespace le_audio

std::ostream& operator<<(std::ostream& os,
                         const le_audio::types::LeAudioLc3Config& config) {
  os << " LeAudioLc3Config(SamplFreq=" << loghex(*config.sampling_frequency)
     << ", FrameDur=" << loghex(*config.frame_duration)
     << ", OctetsPerFrame=" << int(*config.octets_per_codec_frame)
     << ", CodecFramesBlocksPerSDU=" << int(*config.codec_frames_blocks_per_sdu)
     << ", AudioChanLoc=" << loghex(*config.audio_channel_allocation) << ")";
  return os;
}

std::ostream& operator<<(std::ostream& os,
                         const le_audio::types::AseState& state) {
namespace types {
std::ostream& operator<<(std::ostream& os, const types::AseState& state) {
  static const char* char_value_[7] = {
      "IDLE",      "CODEC_CONFIGURED", "QOS_CONFIGURED", "ENABLING",
      "STREAMING", "DISABLING",        "RELEASING",
@@ -467,3 +455,16 @@ std::ostream& operator<<(std::ostream& os,
     << ")";
  return os;
}

std::ostream& operator<<(std::ostream& os,
                         const types::LeAudioLc3Config& config) {
  os << " LeAudioLc3Config(SamplFreq=" << loghex(*config.sampling_frequency)
     << ", FrameDur=" << loghex(*config.frame_duration)
     << ", OctetsPerFrame=" << int(*config.octets_per_codec_frame)
     << ", CodecFramesBlocksPerSDU=" << int(*config.codec_frames_blocks_per_sdu)
     << ", AudioChanLoc=" << loghex(*config.audio_channel_allocation) << ")";
  return os;
}
}  // namespace types

}  // namespace le_audio
+4 −8
Original line number Diff line number Diff line
@@ -575,6 +575,9 @@ using PublishedAudioCapabilities =
using AudioLocations = std::bitset<32>;
using AudioContexts = std::bitset<16>;

std::ostream& operator<<(std::ostream& os, const AseState& state);

std::ostream& operator<<(std::ostream& os, const LeAudioLc3Config& config);
}  // namespace types

namespace set_configurations {
@@ -687,11 +690,4 @@ void AppendMetadataLtvEntryForCcidList(std::vector<uint8_t>& metadata,
void AppendMetadataLtvEntryForStreamingContext(
    std::vector<uint8_t>& metadata, types::LeAudioContextType context_type);
uint8_t GetMaxCodecFramesPerSduFromPac(const types::acs_ac_record* pac_record);

}  // namespace le_audio
 No newline at end of file

std::ostream& operator<<(std::ostream& os,
                         const le_audio::types::LeAudioLc3Config& config);

std::ostream& operator<<(std::ostream& os,
                         const le_audio::types::AseState& state);
+30 −25
Original line number Diff line number Diff line
@@ -29,9 +29,11 @@
#include "client_parser.h"
#include "codec_manager.h"
#include "devices.h"
#include "gd/common/strings.h"
#include "hcimsgs.h"
#include "le_audio_types.h"
#include "osi/include/alarm.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "osi/include/properties.h"

@@ -86,6 +88,7 @@
 */
// clang-format on

using bluetooth::common::ToString;
using bluetooth::hci::IsoManager;
using bluetooth::le_audio::GroupStreamStatus;
using le_audio::CodecManager;
@@ -133,8 +136,8 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
     * group and just got reconnected.
     */
    if (group->GetState() != AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING) {
      LOG(ERROR) << __func__
                 << " group not in the streaming state: " << group->GetState();
      LOG_ERROR(" group not in the streaming state: %s",
                ToString(group->GetState()).c_str());
      return false;
    }

@@ -144,7 +147,7 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {

  bool StartStream(LeAudioDeviceGroup* group,
                   le_audio::types::LeAudioContextType context_type) override {
    LOG(INFO) << __func__ << " current state: " << group->GetState();
    LOG_INFO(" current state: %s", ToString(group->GetState()).c_str());

    switch (group->GetState()) {
      case AseState::BTA_LE_AUDIO_ASE_STATE_CODEC_CONFIGURED:
@@ -190,7 +193,8 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
      }

      default:
        LOG(ERROR) << "Unable to transit from " << group->GetState();
        LOG_ERROR("Unable to transit from %s",
                  ToString(group->GetState()).c_str());
        return false;
    }

@@ -239,9 +243,10 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {

    ParseAseStatusHeader(arh, len, value);

    LOG(INFO) << __func__ << " " << leAudioDevice->address_
              << ", ASE id: " << +ase->id << " state changed " << ase->state
              << " -> " << AseState(arh.state);
    LOG_INFO(" %s , ASE id: %d, state changed %s -> %s ",
             leAudioDevice->address_.ToString().c_str(), +ase->id,
             ToString(ase->state).c_str(),
             ToString(AseState(arh.state)).c_str());

    switch (static_cast<AseState>(arh.state)) {
      case AseState::BTA_LE_AUDIO_ASE_STATE_IDLE:
@@ -347,9 +352,9 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
    if (group->GetTargetState() == AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING) {
      StartConfigQoSForTheGroup(group);
    } else {
      LOG(ERROR) << __func__
                 << ", invalid state transition, from: " << group->GetState()
                 << ", to: " << group->GetTargetState();
      LOG_ERROR(", invalid state transition, from: %s , to: %s",
                ToString(group->GetState()).c_str(),
                ToString(group->GetTargetState()).c_str());
      StopStream(group);
      return;
    }
@@ -1395,9 +1400,9 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
          state_machine_callbacks_->StatusReportCb(
              group->group_id_, GroupStreamStatus::SUSPENDED);
        } else {
          LOG(ERROR) << __func__ << ", invalid state transition, from: "
                     << group->GetState()
                     << ", to: " << group->GetTargetState();
          LOG_ERROR(", invalid state transition, from: %s, to: %s",
                    ToString(group->GetState()).c_str(),
                    ToString(group->GetTargetState()).c_str());
          StopStream(group);
          return;
        }
@@ -1673,9 +1678,9 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {

          return;
        } else {
          LOG(ERROR) << __func__ << ", invalid state transition, from: "
                     << group->GetState()
                     << ", to: " << group->GetTargetState();
          LOG_ERROR(", invalid state transition, from: %s, to: %s",
                    ToString(group->GetState()).c_str(),
                    ToString(group->GetTargetState()).c_str());
          StopStream(group);
          return;
        }
@@ -1723,9 +1728,9 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {

    if (ase->direction == le_audio::types::kLeAudioDirectionSink) {
      /* Sink ASE state machine does not have Disabling state */
      LOG(ERROR) << __func__
                 << ", invalid state transition, from: " << group->GetState()
                 << ", to: " << group->GetTargetState();
      LOG_ERROR(", invalid state transition, from: %s , to: %s ",
                ToString(group->GetState()).c_str(),
                ToString(group->GetTargetState()).c_str());
      StopStream(group);
      return;
    }
@@ -1849,9 +1854,9 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
    if (group->GetTargetState() == AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING) {
      CisCreate(group);
    } else {
      LOG(ERROR) << __func__
                 << ", invalid state transition, from: " << group->GetState()
                 << ", to: " << group->GetTargetState();
      LOG_ERROR(", invalid state transition, from: %s , to: %s ",
                ToString(group->GetState()).c_str(),
                ToString(group->GetTargetState()).c_str());
      StopStream(group);
    }
  }
@@ -1880,9 +1885,9 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
        AseState::BTA_LE_AUDIO_ASE_STATE_QOS_CONFIGURED) {
      ReleaseDataPath(group);
    } else {
      LOG(ERROR) << __func__
                 << ", invalid state transition, from: " << group->GetState()
                 << ", to: " << group->GetTargetState();
      LOG_ERROR(", invalid state transition, from: %s , to: %s ",
                ToString(group->GetState()).c_str(),
                ToString(group->GetTargetState()).c_str());
      StopStream(group);
    }
  }