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

Commit 2b44cdc9 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

sock->fixed_chane is always false, and remove unused code

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I4e7f5c4a61072535affb5f448fb98096dd1ffa4b
parent 698ca849
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -552,23 +552,6 @@ void BTA_JvL2capStartServer(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role,
                            tBTA_JV_L2CAP_CBACK* p_cback,
                            uint32_t l2cap_socket_id);

/*******************************************************************************
 *
 * Function         BTA_JvL2capStartServerLE
 *
 * Description      This function starts an LE L2CAP server and listens for an
 *                  L2CAP connection from a remote Bluetooth device on a fixed
 *                  channel over an LE link.  When the server
 *                  is started successfully, tBTA_JV_L2CAP_CBACK is called with
 *                  BTA_JV_L2CAP_START_EVT.  When the connection is established,
 *                  tBTA_JV_L2CAP_CBACK is called with BTA_JV_L2CAP_OPEN_EVT.
 *
 * Returns          void
 *
 ******************************************************************************/
void BTA_JvL2capStartServerLE(uint16_t local_chan, tBTA_JV_L2CAP_CBACK* p_cback,
                              uint32_t l2cap_socket_id);

/*******************************************************************************
 *
 * Function         BTA_JvL2capStopServerLE
+0 −25
Original line number Diff line number Diff line
@@ -2131,31 +2131,6 @@ void bta_jv_l2cap_stop_server_le(uint16_t local_chan) {
  }
}

/** starts an LE L2CAP server */
void bta_jv_l2cap_start_server_le(uint16_t local_chan,
                                  tBTA_JV_L2CAP_CBACK* p_cback,
                                  uint32_t l2cap_socket_id) {
  tBTA_JV_L2CAP_START evt_data;
  evt_data.handle = GAP_INVALID_HANDLE;
  evt_data.status = BTA_JV_FAILURE;

  struct fc_client* t = fcclient_alloc(local_chan, true, NULL);
  if (!t) goto out;

  t->p_cback = p_cback;
  t->l2cap_socket_id = l2cap_socket_id;

  // if we got here, we're registered...
  evt_data.status = BTA_JV_SUCCESS;
  evt_data.handle = t->id;
  evt_data.sec_id = t->sec_id;

out:
  tBTA_JV bta_jv;
  bta_jv.l2c_start = evt_data;
  p_cback(BTA_JV_L2CAP_START_EVT, &bta_jv, l2cap_socket_id);
}

/* close a fixed channel connection. calls no callbacks. idempotent */
extern void bta_jv_l2cap_close_fixed(uint32_t handle) {
  struct fc_client* t = fcclient_find_by_id(handle);
+0 −22
Original line number Diff line number Diff line
@@ -305,28 +305,6 @@ void BTA_JvL2capStartServer(int conn_type, tBTA_SEC sec_mask, tBTA_JV_ROLE role,
                         base::Passed(&ertm_info), p_cback, l2cap_socket_id));
}

/*******************************************************************************
 *
 * Function         BTA_JvL2capStartServerLE
 *
 * Description      This function starts an LE L2CAP server and listens for an
 *                  L2CAP connection from a remote Bluetooth device.  When the
 *                  server is started successfully, tBTA_JV_L2CAP_CBACK is
 *                  called with BTA_JV_L2CAP_START_EVT.  When the connection is
 *                  established, tBTA_JV_L2CAP_CBACK is called with
 *                  BTA_JV_L2CAP_OPEN_EVT.
 *
 * Returns          void
 *
 ******************************************************************************/
void BTA_JvL2capStartServerLE(uint16_t local_chan, tBTA_JV_L2CAP_CBACK* p_cback,
                              uint32_t l2cap_socket_id) {
  VLOG(2) << __func__;
  CHECK(p_cback);
  do_in_main_thread(FROM_HERE, Bind(&bta_jv_l2cap_start_server_le, local_chan,
                                    p_cback, l2cap_socket_id));
}

/*******************************************************************************
 *
 * Function         BTA_JvL2capStopServer
+0 −3
Original line number Diff line number Diff line
@@ -184,9 +184,6 @@ extern void bta_jv_rfcomm_write(uint32_t handle, uint32_t req_id,
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_l2cap_start_server_le(uint16_t local_chan,
                                         tBTA_JV_L2CAP_CBACK* p_cback,
                                         uint32_t l2cap_socket_id);
extern void bta_jv_l2cap_stop_server_le(uint16_t local_chan);
extern void bta_jv_l2cap_write_fixed(uint16_t channel, const RawAddress& addr,
                                     uint32_t req_id, BT_HDR* msg,
+0 −5
Original line number Diff line number Diff line
@@ -837,11 +837,6 @@ static void btsock_l2cap_server_listen(l2cap_socket* sock) {
           << ", channel: " << sock->channel
           << ", is_le_coc: " << sock->is_le_coc;

  if (sock->fixed_chan) {
    BTA_JvL2capStartServerLE(sock->channel, btsock_l2cap_cbk, sock->id);
    return;
  }

  int connection_type =
      sock->is_le_coc ? BTA_JV_CONN_TYPE_L2CAP_LE : BTA_JV_CONN_TYPE_L2CAP;