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

Commit 475b4ce7 authored by Zach Johnson's avatar Zach Johnson
Browse files

Flatten BTA_SYS_EVT_STACK_ENABLED_EVT out of the state matchine

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I5ca6caee20cfbdebef129502fd014fe68d25655d
parent 524c8562
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@
#include "utl.h"


void BTA_dm_on_hw_on();
void BTA_dm_on_hw_error();
void BTA_dm_on_hw_off();

@@ -88,9 +87,6 @@ static void bta_sys_sm_execute(tBTA_SYS_HW_EVT event) {
  switch (bta_sys_cb.state) {
    case BTA_SYS_HW_OFF:
      switch (event) {
        case BTA_SYS_EVT_STACK_ENABLED_EVT:
          bta_sys_set_state(BTA_SYS_HW_ON);
          break;
        case BTA_SYS_API_DISABLE_EVT:
          BTA_dm_on_hw_off();
          break;
@@ -100,10 +96,6 @@ static void bta_sys_sm_execute(tBTA_SYS_HW_EVT event) {
      break;
    case BTA_SYS_HW_STARTING:
      switch (event) {
        case BTA_SYS_EVT_STACK_ENABLED_EVT:
          bta_sys_set_state(BTA_SYS_HW_ON);
          BTA_dm_on_hw_on();
          break;
        case BTA_SYS_API_DISABLE_EVT:
          bta_sys_set_state(BTA_SYS_HW_STOPPING);
          break;
@@ -129,10 +121,6 @@ static void bta_sys_sm_execute(tBTA_SYS_HW_EVT event) {
      break;
    case BTA_SYS_HW_STOPPING:
      switch (event) {
        case BTA_SYS_EVT_STACK_ENABLED_EVT:
          BTA_dm_on_hw_on();
          bta_sys_hw_api_disable();
          break;
        case BTA_SYS_ERROR_EVT:
          bta_sys_hw_api_disable();
          break;
+4 −1
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@
#include "bta_dm_int.h"
#include "main/shim/controller.h"

void BTA_dm_on_hw_on();

using bluetooth::common::MessageLoopThread;

static MessageLoopThread management_thread("bt_stack_manager_thread");
@@ -237,7 +239,8 @@ static void event_start_up_stack(UNUSED_ATTR void* context) {
  }
  BTM_reset_complete();

  send_bta_sys_hw_event(BTA_SYS_EVT_STACK_ENABLED_EVT);
  bta_sys_set_state(BTA_SYS_HW_ON);
  BTA_dm_on_hw_on();

  if (future_await(local_hack_future) != FUTURE_SUCCESS) {
    LOG_ERROR("%s failed to start up the stack", __func__);