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

Commit 94e692e6 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Support BTM_SetBleDataLength when L2cap shim is on

Test: cert/run
Tag: #gd-refactor
Bug: 141555841
Change-Id: I672786a2414f34666f2734f9aa8c8e200a052466
parent 213633c9
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -1037,12 +1037,6 @@ bool bluetooth::shim::BTM_UseLeLink(const RawAddress& raw_address) {
  return Stack::GetInstance()->GetBtm()->UseLeLink(raw_address);
}

tBTM_STATUS bluetooth::shim::BTM_SetBleDataLength(const RawAddress& bd_addr,
                                                  uint16_t tx_pdu_length) {
  LOG_INFO("UNIMPLEMENTED %s", __func__);
  return BTM_NO_RESOURCES;
}

void bluetooth::shim::BTM_BleReadPhy(
    const RawAddress& bd_addr,
    base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb) {
+0 −12
Original line number Diff line number Diff line
@@ -635,18 +635,6 @@ void BTM_BleTestEnd(tBTM_CMPL_CB* p_cmd_cmpl_cback);
 ******************************************************************************/
bool BTM_UseLeLink(const RawAddress& bd_addr);

/*******************************************************************************
 *
 * Function         BTM_SetBleDataLength
 *
 * Description      Set the maximum BLE transmission packet size
 *
 * Returns          BTM_SUCCESS if success; otherwise failed.
 *
 ******************************************************************************/
tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr,
                                 uint16_t tx_pdu_length);

/*******************************************************************************
 *
 * Function         BTM_BleReadPhy
+7 −4
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@

#include "device/include/controller.h"
#include "main/shim/btm_api.h"
#include "main/shim/l2c_api.h"
#include "main/shim/shim.h"
#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_int_types.h"
@@ -665,16 +666,18 @@ tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr,
      HCI_PROTO_VERSION_5_0)
    tx_time = BTM_BLE_DATA_TX_TIME_MAX;

  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::BTM_SetBleDataLength(bd_addr, tx_pdu_length);
  }

  if (!BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) {
    LOG_INFO(
        "Unable to set data length because no le acl link connected to device");
    return BTM_WRONG_MODE;
  }

  if (bluetooth::shim::is_gd_l2cap_enabled()) {
    uint16_t handle = bluetooth::shim::L2CA_GetLeHandle(L2CAP_ATT_CID, bd_addr);
    btsnd_hcic_ble_set_data_length(handle, tx_pdu_length, tx_time);
    return BTM_SUCCESS;
  }

  uint16_t hci_handle = acl_get_hci_handle_for_hcif(bd_addr, BT_TRANSPORT_LE);

  if (!acl_peer_supports_ble_packet_extension(hci_handle)) {