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

Commit 3175c506 authored by Chris Manton's avatar Chris Manton
Browse files

gd_acl: Use address_with_type within API

Also: Remove extraneous add device to connect list

Bug: 171568335
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: Ifbb3d64c1091d9a6611807b3ec177fcacc6a23df
parent 857704e4
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -477,7 +477,6 @@ void bluetooth::shim::legacy::Acl::CreateClassicConnection(

void bluetooth::shim::legacy::Acl::CreateLeConnection(
    const bluetooth::hci::AddressWithType& address_with_type) {
  GetAclManager()->AddDeviceToConnectList(address_with_type);
  GetAclManager()->CreateLeConnection(address_with_type);
  LOG_DEBUG("Started Le device to connection %s",
            address_with_type.ToString().c_str());
+8 −6
Original line number Diff line number Diff line
@@ -28,14 +28,16 @@ void bluetooth::shim::ACL_CreateClassicConnection(
  Stack::GetInstance()->GetAcl()->CreateClassicConnection(address);
}

void bluetooth::shim::ACL_CreateLeConnection(const RawAddress& raw_address) {
  auto address_with_type = ToAddressWithType(raw_address, BLE_ADDR_RANDOM);
  Stack::GetInstance()->GetAcl()->CreateLeConnection(address_with_type);
void bluetooth::shim::ACL_CreateLeConnection(
    const tBLE_BD_ADDR& legacy_address_with_type) {
  Stack::GetInstance()->GetAcl()->CreateLeConnection(
      ToAddressWithTypeFromLegacy(legacy_address_with_type));
}

void bluetooth::shim::ACL_CancelLeConnection(const RawAddress& raw_address) {
  auto address_with_type = ToAddressWithType(raw_address, BLE_ADDR_RANDOM);
  Stack::GetInstance()->GetAcl()->CancelLeConnection(address_with_type);
void bluetooth::shim::ACL_CancelLeConnection(
    const tBLE_BD_ADDR& legacy_address_with_type) {
  Stack::GetInstance()->GetAcl()->CancelLeConnection(
      ToAddressWithTypeFromLegacy(legacy_address_with_type));
}

void bluetooth::shim::ACL_WriteData(uint16_t handle, const BT_HDR* p_buf) {
+2 −2
Original line number Diff line number Diff line
@@ -23,9 +23,9 @@ namespace bluetooth {
namespace shim {

void ACL_CancelClassicConnection(const RawAddress& raw_address);
void ACL_CancelLeConnection(const RawAddress& raw_address);
void ACL_CancelLeConnection(const tBLE_BD_ADDR& legacy_address_with_type);
void ACL_CreateClassicConnection(const RawAddress& raw_address);
void ACL_CreateLeConnection(const RawAddress& raw_address);
void ACL_CreateLeConnection(const tBLE_BD_ADDR& legacy_address_with_type);
void ACL_WriteData(uint16_t handle, const BT_HDR* p_buf);

}  // namespace shim
+10 −2
Original line number Diff line number Diff line
@@ -2951,7 +2951,11 @@ void acl_write_automatic_flush_timeout(const RawAddress& bd_addr,

bool acl_create_le_connection_with_id(uint8_t id, const RawAddress& bd_addr) {
  if (bluetooth::shim::is_gd_acl_enabled()) {
    bluetooth::shim::ACL_CreateLeConnection(bd_addr);
    tBLE_BD_ADDR address_with_type{
        .bda = bd_addr,
        .type = BLE_ADDR_RANDOM,
    };
    bluetooth::shim::ACL_CreateLeConnection(address_with_type);
    return true;
  }
  return connection_manager::direct_connect_add(id, bd_addr);
@@ -2963,7 +2967,11 @@ bool acl_create_le_connection(const RawAddress& bd_addr) {

void acl_cancel_le_connection(const RawAddress& bd_addr) {
  if (bluetooth::shim::is_gd_acl_enabled()) {
    return bluetooth::shim::ACL_CancelLeConnection(bd_addr);
    tBLE_BD_ADDR address_with_type{
        .bda = bd_addr,
        .type = BLE_ADDR_RANDOM,
    };
    return bluetooth::shim::ACL_CancelLeConnection(address_with_type);
  }
  connection_manager::direct_connect_remove(CONN_MGR_ID_L2CAP, bd_addr);
}