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

Commit 014c3999 authored by Grzegorz Kołodziejczyk's avatar Grzegorz Kołodziejczyk
Browse files

broadcaster: Introduce intermediate states

This change introduces intermediate states which helps to manage
controller. There is need to do some controller actions with respect
to Audio Framework session callbacks e.g. remove BIG when session is
suspended before getting BIG create event.

Bug: 358587027
Bug: 360435489
Test: atest --host bluetooth_test_broadcaster_state_machine
Flag: TEST_ONLY
Change-Id: Id8b4fbc61061b8603aae6696b486faab8deefcd2
parent a0c9568d
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -115,8 +115,10 @@ public class BassClientService extends ProfileService {
    private static final int BROADCAST_STATE_STOPPED = 0;
    private static final int BROADCAST_STATE_CONFIGURING = 1;
    private static final int BROADCAST_STATE_PAUSED = 2;
    private static final int BROADCAST_STATE_STOPPING = 3;
    private static final int BROADCAST_STATE_STREAMING = 4;
    private static final int BROADCAST_STATE_ENABLING = 3;
    private static final int BROADCAST_STATE_DISABLING = 4;
    private static final int BROADCAST_STATE_STOPPING = 5;
    private static final int BROADCAST_STATE_STREAMING = 6;

    private static final int MESSAGE_SYNC_TIMEOUT = 1;

@@ -3407,6 +3409,8 @@ public class BassClientService extends ProfileService {
                break;
            case BROADCAST_STATE_CONFIGURING:
            case BROADCAST_STATE_PAUSED:
            case BROADCAST_STATE_ENABLING:
            case BROADCAST_STATE_DISABLING:
            case BROADCAST_STATE_STOPPING:
            case BROADCAST_STATE_STREAMING:
            default:
+8 −2
Original line number Diff line number Diff line
@@ -77,8 +77,10 @@ public class LeAudioStackEvent {
    static final int BROADCAST_STATE_STOPPED = 0;
    static final int BROADCAST_STATE_CONFIGURING = 1;
    static final int BROADCAST_STATE_PAUSED = 2;
    static final int BROADCAST_STATE_STOPPING = 3;
    static final int BROADCAST_STATE_STREAMING = 4;
    static final int BROADCAST_STATE_ENABLING = 3;
    static final int BROADCAST_STATE_DISABLING = 4;
    static final int BROADCAST_STATE_STOPPING = 5;
    static final int BROADCAST_STATE_STREAMING = 6;

    // Do not modify without updating the HAL bt_le_audio.h files.
    // Match up with UnicastMonitorModeStatus enum of bt_le_audio.h
@@ -435,6 +437,10 @@ public class LeAudioStackEvent {
                return "BROADCAST_STATE_CONFIGURING";
            case BROADCAST_STATE_PAUSED:
                return "BROADCAST_STATE_PAUSED";
            case BROADCAST_STATE_ENABLING:
                return "BROADCAST_STATE_ENABLING";
            case BROADCAST_STATE_DISABLING:
                return "BROADCAST_STATE_DISABLING";
            case BROADCAST_STATE_STOPPING:
                return "BROADCAST_STATE_STOPPING";
            case BROADCAST_STATE_STREAMING:
+4 −0
Original line number Diff line number Diff line
@@ -1037,6 +1037,10 @@ private:
            instance->UpdateAudioActiveStateInPublicAnnouncement();
          }
          break;
        case BroadcastStateMachine::State::ENABLING:
          break;
        case BroadcastStateMachine::State::DISABLING:
          break;
        case BroadcastStateMachine::State::STOPPING:
          break;
        case BroadcastStateMachine::State::STREAMING:
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ std::ostream& operator<<(std::ostream& os, const BroadcastStateMachine::Message&

std::ostream& operator<<(std::ostream& os, const BroadcastStateMachine::State& state) {
  static const char* char_value_[BroadcastStateMachine::STATE_COUNT] = {
          "STOPPED", "CONFIGURING", "CONFIGURED", "STOPPING", "STREAMING"};
          "STOPPED", "CONFIGURING", "CONFIGURED", "ENABLING", "DISABLING", "STOPPING", "STREAMING"};
  os << char_value_[static_cast<uint8_t>(state)];
  return os;
}
+17 −1
Original line number Diff line number Diff line
@@ -248,6 +248,10 @@ private:
          [](const void*) { /* Do nothing */ },
          /* in CONFIGURED state */
          [this](const void*) { CreateBig(); },
          /* in ENABLING state */
          [](const void*) { /* Do nothing */ },
          /* in DISABLING state */
          [](const void*) { /* Do nothing */ },
          /* in STOPPING state */
          [](const void*) { /* Do nothing */ },
          /* in STREAMING state */
@@ -264,6 +268,10 @@ private:
            callbacks_->OnStateMachineEvent(GetBroadcastId(), GetState());
            DisableAnnouncement();
          },
          /* in ENABLING state */
          [](const void*) { /* Do nothing */ },
          /* in DISABLING state */
          [](const void*) { /* Do nothing */ },
          /* in STOPPING state */
          [](const void*) { /* Do nothing */ },
          /* in STREAMING state */
@@ -290,6 +298,10 @@ private:
              TerminateBig();
            }
          },
          /* in ENABLING state */
          [](const void*) { /* Do nothing */ },
          /* in DISABLING state */
          [](const void*) { /* Do nothing */ },
          /* in STOPPING state */
          [](const void*) { /* Do nothing */ },
          /* in STREAMING state */
@@ -307,6 +319,10 @@ private:
          [](const void*) { /* Do nothing */ },
          /* in CONFIGURED state */
          [this](const void*) { CreateBig(); },
          /* in ENABLING state */
          [](const void*) { /* Do nothing */ },
          /* in DISABLING state */
          [](const void*) { /* Do nothing */ },
          /* in STOPPING state */
          [](const void*) { /* Do nothing */ },
          /* in STREAMING state */
@@ -617,7 +633,7 @@ std::ostream& operator<<(std::ostream& os, const BroadcastStateMachine::Message&

std::ostream& operator<<(std::ostream& os, const BroadcastStateMachine::State& state) {
  static const char* char_value_[BroadcastStateMachine::STATE_COUNT] = {
          "STOPPED", "CONFIGURING", "CONFIGURED", "STOPPING", "STREAMING"};
          "STOPPED", "CONFIGURING", "CONFIGURED", "ENABLING", "DISABLING", "STOPPING", "STREAMING"};
  os << char_value_[static_cast<uint8_t>(state)];
  return os;
}
Loading