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

Commit 9936aeb4 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Use Bind in BTA_JvSetPmProfile

Bug: 68359837
Test: compilation test
Change-Id: I6ac2f5ab8061d7d7c65554172d7c0fc3cb703cc6
parent 3560e0ee
Loading
Loading
Loading
Loading
+8 −17
Original line number Diff line number Diff line
@@ -1780,26 +1780,18 @@ void bta_jv_rfcomm_write(uint32_t handle, uint32_t req_id, tBTA_JV_RFC_CB* p_cb,
  p_cb->p_cback(BTA_JV_RFCOMM_WRITE_EVT, &bta_jv, p_pcb->rfcomm_slot_id);
}

/*******************************************************************************
 *
 * Function     bta_jv_set_pm_profile
 *
 * Description  Set or free power mode profile for a JV application
 *
 * Returns      void
 *
 ******************************************************************************/
void bta_jv_set_pm_profile(tBTA_JV_MSG* p_data) {
/* Set or free power mode profile for a JV application */
void bta_jv_set_pm_profile(uint32_t handle, tBTA_JV_PM_ID app_id,
                           tBTA_JV_CONN_STATE init_st) {
  tBTA_JV_STATUS status;
  tBTA_JV_PM_CB* p_cb;

  APPL_TRACE_API("bta_jv_set_pm_profile(handle: 0x%x, app_id: %d, init_st: %d)",
                 p_data->set_pm.handle, p_data->set_pm.app_id,
                 p_data->set_pm.init_st);
                 handle, app_id, init_st);

  /* clear PM control block */
  if (p_data->set_pm.app_id == BTA_JV_PM_ID_CLEAR) {
    status = bta_jv_free_set_pm_profile_cb(p_data->set_pm.handle);
  if (app_id == BTA_JV_PM_ID_CLEAR) {
    status = bta_jv_free_set_pm_profile_cb(handle);

    if (status != BTA_JV_SUCCESS) {
      APPL_TRACE_WARNING("bta_jv_set_pm_profile() free pm cb failed: reason %d",
@@ -1807,11 +1799,10 @@ void bta_jv_set_pm_profile(tBTA_JV_MSG* p_data) {
    }
  } else /* set PM control block */
  {
    p_cb = bta_jv_alloc_set_pm_profile_cb(p_data->set_pm.handle,
                                          p_data->set_pm.app_id);
    p_cb = bta_jv_alloc_set_pm_profile_cb(handle, app_id);

    if (NULL != p_cb)
      bta_jv_pm_state_change(p_cb, p_data->set_pm.init_st);
      bta_jv_pm_state_change(p_cb, init_st);
    else
      APPL_TRACE_WARNING("bta_jv_alloc_set_pm_profile_cb() failed");
  }
+2 −10
Original line number Diff line number Diff line
@@ -762,17 +762,9 @@ tBTA_JV_STATUS BTA_JvRfcommWrite(uint32_t handle, uint32_t req_id) {
 ******************************************************************************/
tBTA_JV_STATUS BTA_JvSetPmProfile(uint32_t handle, tBTA_JV_PM_ID app_id,
                                  tBTA_JV_CONN_STATE init_st) {
  tBTA_JV_API_SET_PM_PROFILE* p_msg = (tBTA_JV_API_SET_PM_PROFILE*)osi_malloc(
      sizeof(tBTA_JV_API_SET_PM_PROFILE));

  APPL_TRACE_API("%s handle:0x%x, app_id:%d", __func__, handle, app_id);

  p_msg->hdr.event = BTA_JV_API_SET_PM_PROFILE_EVT;
  p_msg->handle = handle;
  p_msg->app_id = app_id;
  p_msg->init_st = init_st;

  bta_sys_sendmsg(p_msg);

  do_in_bta_thread(FROM_HERE,
                   Bind(&bta_jv_set_pm_profile, handle, app_id, init_st));
  return BTA_JV_SUCCESS;
}
+2 −11
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
enum {
  /* these events are handled by the state machine */
  BTA_JV_API_START_DISCOVERY_EVT = BTA_SYS_EVT_START(BTA_ID_JV),
  BTA_JV_API_SET_PM_PROFILE_EVT,
  BTA_JV_API_PM_STATE_CHANGE_EVT,
  BTA_JV_MAX_INT_EVT
};
@@ -136,14 +135,6 @@ typedef struct {
  uint32_t l2cap_socket_id;
} tBTA_JV_API_L2CAP_READ;

/* data type for BTA_JV_API_SET_PM_PROFILE_EVT */
typedef struct {
  BT_HDR hdr;
  uint32_t handle;
  tBTA_JV_PM_ID app_id;
  tBTA_JV_CONN_STATE init_st;
} tBTA_JV_API_SET_PM_PROFILE;

/* data type for BTA_JV_API_PM_STATE_CHANGE_EVT */
typedef struct {
  BT_HDR hdr;
@@ -157,7 +148,6 @@ typedef union {
  BT_HDR hdr;
  tBTA_JV_API_START_DISCOVERY start_discovery;
  tBTA_JV_API_L2CAP_READ l2cap_read;
  tBTA_JV_API_SET_PM_PROFILE set_pm;
  tBTA_JV_API_PM_STATE_CHANGE change_pm_state;
} tBTA_JV_MSG;

@@ -237,7 +227,8 @@ extern void bta_jv_rfcomm_start_server(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
extern void bta_jv_rfcomm_stop_server(uint32_t handle, uint32_t rfcomm_slot_id);
extern void bta_jv_rfcomm_write(uint32_t handle, uint32_t req_id,
                                tBTA_JV_RFC_CB* p_cb, tBTA_JV_PCB* p_pcb);
extern void bta_jv_set_pm_profile(tBTA_JV_MSG* p_data);
extern void bta_jv_set_pm_profile(uint32_t handle, tBTA_JV_PM_ID app_id,
                                  tBTA_JV_CONN_STATE init_st);
extern void bta_jv_change_pm_state(tBTA_JV_MSG* p_data);
extern void bta_jv_l2cap_connect_le(uint16_t remote_chan,
                                    const RawAddress& peer_bd_addr,
+0 −1
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ typedef void (*tBTA_JV_ACTION)(tBTA_JV_MSG* p_data);
/* action function list */
const tBTA_JV_ACTION bta_jv_action[] = {
    bta_jv_start_discovery,       /* BTA_JV_API_START_DISCOVERY_EVT */
    bta_jv_set_pm_profile,        /* BTA_JV_API_SET_PM_PROFILE_EVT */
    bta_jv_change_pm_state,       /* BTA_JV_API_PM_STATE_CHANGE_EVT */
};