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

Commit 7e3a55dd authored by Zach Johnson's avatar Zach Johnson
Browse files

flatten send_bta_sys_hw_event(BTA_SYS_API_ENABLE_EVT)

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I74bd01384659826d8e30f0fef1d594538187ae6c
parent 4695c722
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -173,9 +173,19 @@ enum {
};
typedef uint8_t tBTA_SYS_HW_EVT;

/* SYS HW state */
enum {
  BTA_SYS_HW_OFF,
  BTA_SYS_HW_STARTING,
  BTA_SYS_HW_ON,
  BTA_SYS_HW_STOPPING
};
typedef uint8_t tBTA_SYS_HW_STATE;

/*****************************************************************************
 *  Function declarations
 ****************************************************************************/
void bta_sys_set_state(tBTA_SYS_HW_STATE value);

extern void bta_sys_init(void);
extern void bta_sys_free(void);
+0 −9
Original line number Diff line number Diff line
@@ -32,15 +32,6 @@
 *  state table
 ****************************************************************************/

/* SYS HW state */
enum {
  BTA_SYS_HW_OFF,
  BTA_SYS_HW_STARTING,
  BTA_SYS_HW_ON,
  BTA_SYS_HW_STOPPING
};
typedef uint8_t tBTA_SYS_HW_STATE;

/* Collision callback */
#define MAX_COLLISION_REG 5

+0 −10
Original line number Diff line number Diff line
@@ -88,10 +88,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_API_ENABLE_EVT:
          bta_sys_set_state(BTA_SYS_HW_STARTING);
          bta_sys_hw_api_enable();
          break;
        case BTA_SYS_EVT_STACK_ENABLED_EVT:
          bta_sys_set_state(BTA_SYS_HW_ON);
          break;
@@ -121,9 +117,6 @@ static void bta_sys_sm_execute(tBTA_SYS_HW_EVT event) {
      break;
    case BTA_SYS_HW_ON:
      switch (event) {
        case BTA_SYS_API_ENABLE_EVT:
          bta_sys_hw_api_enable();
          break;
        case BTA_SYS_API_DISABLE_EVT:
          bta_sys_hw_api_disable();
          break;
@@ -136,9 +129,6 @@ static void bta_sys_sm_execute(tBTA_SYS_HW_EVT event) {
      break;
    case BTA_SYS_HW_STOPPING:
      switch (event) {
        case BTA_SYS_API_ENABLE_EVT:
          bta_sys_set_state(BTA_SYS_HW_STARTING);
          break;
        case BTA_SYS_EVT_STACK_ENABLED_EVT:
          BTA_dm_on_hw_on();
          bta_sys_hw_api_disable();
+3 −1
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@
#if (defined BTA_AR_INCLUDED) && (BTA_AR_INCLUDED == TRUE)
#include "bta_ar_api.h"
#endif
#include "bta/sys/bta_sys_int.h"
#include "bta_dm_int.h"

using bluetooth::common::MessageLoopThread;
@@ -225,7 +226,8 @@ static void event_start_up_stack(UNUSED_ATTR void* context) {
  BTA_dm_init();
  bta_dm_enable(bte_dm_evt);

  send_bta_sys_hw_event(BTA_SYS_API_ENABLE_EVT);
  bta_sys_set_state(BTA_SYS_HW_STARTING);
  bta_sys_hw_api_enable();

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