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

Commit e600ebb0 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Relanding SCO: Clean up unused code

BTM_ESCO_CHG_EVT is never used.  Get rid of this.

Test: cert/run
Bug: 195344796
Tag: #refactor
Change-Id: I8faeeef24865c8f3ce881a789f1b42992bb53824
parent 3cf72dcf
Loading
Loading
Loading
Loading
+0 −41
Original line number Diff line number Diff line
@@ -1196,47 +1196,6 @@ void BTM_EScoConnRsp(uint16_t sco_inx, uint8_t hci_status,
  }
}

/*******************************************************************************
 *
 * Function         btm_esco_proc_conn_chg
 *
 * Description      This function is called by BTIF when an SCO connection
 *                  is changed.
 *
 * Returns          void
 *
 ******************************************************************************/
void btm_esco_proc_conn_chg(uint8_t status, uint16_t handle,
                            uint8_t tx_interval, uint8_t retrans_window,
                            uint16_t rx_pkt_len, uint16_t tx_pkt_len) {
  tSCO_CONN* p = &btm_cb.sco_cb.sco_db[0];
  tBTM_CHG_ESCO_EVT_DATA data;
  uint16_t xx;

  BTM_TRACE_EVENT("btm_esco_proc_conn_chg -> handle 0x%04x, status 0x%02x",
                  handle, status);

  for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) {
    if (p->state == SCO_ST_CONNECTED && handle == p->hci_handle) {
      /* If upper layer wants notification */
      if (p->esco.p_esco_cback) {
        data.bd_addr = p->esco.data.bd_addr;
        data.hci_status = status;
        data.sco_inx = xx;
        data.rx_pkt_len = p->esco.data.rx_pkt_len = rx_pkt_len;
        data.tx_pkt_len = p->esco.data.tx_pkt_len = tx_pkt_len;
        data.tx_interval = p->esco.data.tx_interval = tx_interval;
        data.retrans_window = p->esco.data.retrans_window = retrans_window;

        tBTM_ESCO_EVT_DATA btm_esco_evt_data;
        btm_esco_evt_data.chg_evt = data;
        (*p->esco.p_esco_cback)(BTM_ESCO_CHG_EVT, &btm_esco_evt_data);
      }
      return;
    }
  }
}

/*******************************************************************************
 *
 * Function         btm_is_sco_active
+5 −11
Original line number Diff line number Diff line
@@ -1190,11 +1190,11 @@ static void btu_hcif_esco_connection_comp_evt(uint8_t* p) {
  STREAM_TO_BDADDR(bda, p);

  STREAM_TO_UINT8(data.link_type, p);
  STREAM_TO_UINT8(data.tx_interval, p);
  STREAM_TO_UINT8(data.retrans_window, p);
  STREAM_TO_UINT16(data.rx_pkt_len, p);
  STREAM_TO_UINT16(data.tx_pkt_len, p);
  STREAM_TO_UINT8(data.air_mode, p);
  STREAM_SKIP_UINT8(p);   // tx_interval
  STREAM_SKIP_UINT8(p);   // retrans_window
  STREAM_SKIP_UINT16(p);  // rx_pkt_len
  STREAM_SKIP_UINT16(p);  // tx_pkt_len
  STREAM_SKIP_UINT8(p);   // air_mode

  handle = HCID_GET_HANDLE(handle);

@@ -1228,9 +1228,6 @@ static void btu_hcif_esco_connection_chg_evt(uint8_t* p) {
  STREAM_TO_UINT16(tx_pkt_len, p);

  handle = HCID_GET_HANDLE(handle);

  btm_esco_proc_conn_chg(status, handle, tx_interval, retrans_window,
                         rx_pkt_len, tx_pkt_len);
}

/*******************************************************************************
@@ -1456,9 +1453,6 @@ static void btu_hcif_hdl_command_status(uint16_t opcode, uint8_t status,
      if (status != HCI_SUCCESS) {
        STREAM_TO_UINT16(handle, p_cmd);
        // Determine if initial connection failed or is a change of setup
        if (btm_is_sco_active(handle)) {
          btm_esco_proc_conn_chg(status, handle, 0, 0, 0, 0);
        }
      }
      break;

+0 −17
Original line number Diff line number Diff line
@@ -387,7 +387,6 @@ typedef void(tBTM_SCO_CB)(uint16_t sco_inx);
 *  eSCO Types
 ***************/
/* tBTM_ESCO_CBACK event types */
#define BTM_ESCO_CHG_EVT 1
#define BTM_ESCO_CONN_REQ_EVT 2
typedef uint8_t tBTM_ESCO_EVT;

@@ -402,25 +401,10 @@ typedef struct {

/* Returned by BTM_ReadEScoLinkParms() */
struct tBTM_ESCO_DATA {
  uint16_t rx_pkt_len;
  uint16_t tx_pkt_len;
  RawAddress bd_addr;
  uint8_t link_type; /* BTM_LINK_TYPE_SCO or BTM_LINK_TYPE_ESCO */
  uint8_t tx_interval;
  uint8_t retrans_window;
  uint8_t air_mode;
};

typedef struct {
  uint16_t sco_inx;
  uint16_t rx_pkt_len;
  uint16_t tx_pkt_len;
  RawAddress bd_addr;
  uint8_t hci_status;
  uint8_t tx_interval;
  uint8_t retrans_window;
} tBTM_CHG_ESCO_EVT_DATA;

typedef struct {
  uint16_t sco_inx;
  RawAddress bd_addr;
@@ -429,7 +413,6 @@ typedef struct {
} tBTM_ESCO_CONN_REQ_EVT_DATA;

typedef union {
  tBTM_CHG_ESCO_EVT_DATA chg_evt;
  tBTM_ESCO_CONN_REQ_EVT_DATA conn_evt;
} tBTM_ESCO_EVT_DATA;

+0 −3
Original line number Diff line number Diff line
@@ -25,9 +25,6 @@

struct tBTM_ESCO_DATA;

extern void btm_esco_proc_conn_chg(uint8_t status, uint16_t handle,
                                   uint8_t tx_interval, uint8_t retrans_window,
                                   uint16_t rx_pkt_len, uint16_t tx_pkt_len);
extern bool btm_is_sco_active(uint16_t handle);
extern void btm_sco_chk_pend_unpark(tHCI_STATUS hci_status,
                                    uint16_t hci_handle);
+0 −5
Original line number Diff line number Diff line
@@ -81,11 +81,6 @@ void BTM_EScoConnRsp(uint16_t sco_inx, uint8_t hci_status,
void BTM_RemoveSco(const RawAddress& bda) {
  mock_function_count_map[__func__]++;
}
void btm_esco_proc_conn_chg(uint8_t status, uint16_t handle,
                            uint8_t tx_interval, uint8_t retrans_window,
                            uint16_t rx_pkt_len, uint16_t tx_pkt_len) {
  mock_function_count_map[__func__]++;
}
void btm_route_sco_data(BT_HDR* p_msg) { mock_function_count_map[__func__]++; }
void btm_sco_acl_removed(const RawAddress* bda) {
  mock_function_count_map[__func__]++;