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

Commit 214bea6b authored by Zach Johnson's avatar Zach Johnson
Browse files

Remove indirection for reporting hardware events

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I954356c77d76690aeff127799257bb72f05b5eff
parent 7cab3e6f
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -86,7 +86,6 @@ typedef struct {
extern tBTA_SYS_CB bta_sys_cb;

/* functions used for BTA SYS HW state machine */
void bta_sys_hw_btm_cback(tBTM_DEV_STATUS status);
void bta_sys_hw_error();
void bta_sys_hw_api_enable();
void bta_sys_hw_api_disable();
+0 −23
Original line number Diff line number Diff line
@@ -67,9 +67,6 @@ void bta_sys_init(void) {

  appl_trace_level = APPL_INITIAL_TRACE_LEVEL;

  /* register for BTM notifications */
  BTM_RegisterForDeviceStatusNotif(&bta_sys_hw_btm_cback);

#if (defined BTA_AR_INCLUDED) && (BTA_AR_INCLUDED == TRUE)
  bta_ar_init();
#endif
@@ -183,26 +180,6 @@ void bta_sys_hw_register(tBTA_SYS_HW_CBACK* cback) {

void bta_sys_hw_unregister() { bta_sys_cb.sys_hw_cback = NULL; }

/*******************************************************************************
 *
 * Function         bta_sys_hw_btm_cback
 *
 * Description     This function is registered by BTA SYS to BTM in order to get
 *                 status notifications
 *
 *
 * Returns
 *
 ******************************************************************************/
void bta_sys_hw_btm_cback(tBTM_DEV_STATUS status) {
  APPL_TRACE_DEBUG("%s was called with parameter: %i", __func__, status);
  if (status == BTM_DEV_STATUS_UP) {
    send_bta_sys_hw_event(BTA_SYS_EVT_STACK_ENABLED_EVT);
  } else if (status == BTM_DEV_STATUS_DOWN) {
    send_bta_sys_hw_event(BTA_SYS_ERROR_EVT);
  }
}

/*******************************************************************************
 *
 * Function         bta_sys_hw_error
+0 −13
Original line number Diff line number Diff line
@@ -980,19 +980,6 @@ tBTM_STATUS BTM_ReadLocalDeviceNameFromController(
 ******************************************************************************/
uint8_t* BTM_ReadDeviceClass(void);

/*******************************************************************************
 *
 * Function         BTM_RegisterForDeviceStatusNotif
 *
 * Description      This function is called to register for device status
 *                  change notifications.
 *
 * Returns          pointer to previous caller's callback function or NULL if
 *                  first registration.
 *
 ******************************************************************************/
tBTM_DEV_STATUS_CB* BTM_RegisterForDeviceStatusNotif(tBTM_DEV_STATUS_CB* p_cb);

/*******************************************************************************
 *
 * Function         BTM_RegisterForVSEvents
+2 −41
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#include "stack/gatt/connection_manager.h"
#include "stack/include/l2cap_controller_interface.h"

#include "bta/sys/bta_sys.h"
#include "main/shim/btm_api.h"
#include "main/shim/controller.h"
#include "main/shim/shim.h"
@@ -217,8 +218,7 @@ static void reset_complete(void* result) {
                 btm_cb.cfg.pin_code_len);

  decode_controller_support();

  btm_report_device_status(BTM_DEV_STATUS_UP);
  send_bta_sys_hw_event(BTA_SYS_EVT_STACK_ENABLED_EVT);
}

// TODO(zachoverflow): remove this function
@@ -521,27 +521,6 @@ uint8_t* BTM_ReadDeviceClass(void) {
  return ((uint8_t*)btm_cb.devcb.dev_class);
}

/*******************************************************************************
 *
 * Function         BTM_RegisterForDeviceStatusNotif
 *
 * Description      This function is called to register for device status
 *                  change notifications.
 *
 *                  If one registration is already there calling function should
 *                  save the pointer to the function that is return and
 *                  call it when processing of the event is complete
 *
 * Returns          status of the operation
 *
 ******************************************************************************/
tBTM_DEV_STATUS_CB* BTM_RegisterForDeviceStatusNotif(tBTM_DEV_STATUS_CB* p_cb) {
  tBTM_DEV_STATUS_CB* p_prev = btm_cb.devcb.p_dev_status_cb;

  btm_cb.devcb.p_dev_status_cb = p_cb;
  return (p_prev);
}

/*******************************************************************************
 *
 * Function         BTM_VendorSpecificCommand
@@ -809,24 +788,6 @@ void btm_delete_stored_link_key_complete(uint8_t* p) {
  }
}

/*******************************************************************************
 *
 * Function         btm_report_device_status
 *
 * Description      This function is called when there is a change in the device
 *                  status. This function will report the new device status to
 *                  the application
 *
 * Returns          void
 *
 ******************************************************************************/
void btm_report_device_status(tBTM_DEV_STATUS status) {
  tBTM_DEV_STATUS_CB* p_cb = btm_cb.devcb.p_dev_status_cb;

  /* Call the call back to pass the device status to application */
  if (p_cb) (*p_cb)(status);
}

/*******************************************************************************
 *
 * Function         BTM_BT_Quality_Report_VSE_CBack
+0 −1
Original line number Diff line number Diff line
@@ -172,7 +172,6 @@ extern void btm_vsc_complete(uint8_t* p, uint16_t cc_opcode, uint16_t evt_len,
extern void btm_inq_db_reset(void);
extern void btm_vendor_specific_evt(uint8_t* p, uint8_t evt_len);
extern void btm_delete_stored_link_key_complete(uint8_t* p);
extern void btm_report_device_status(tBTM_DEV_STATUS status);
extern tBTM_STATUS BTM_BT_Quality_Report_VSE_Register(
    bool is_register, tBTM_BT_QUALITY_REPORT_RECEIVER* p_bqr_report_receiver);

Loading