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

Commit 47c9e6d0 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Shim GATT: Use Fixed channel manager to connect

Legacy GATT uses its own connection manager to connect, but in GD it
should be managed by HCI module. Redirect connection request to L2CAP
module (which will be handled by HCI-ACL module).

Also use no-op for existing LE L2CAP public API used by GATT for now.

Tag: #gd-refactor
Bug: 158861440
Test: nRF
Change-Id: Idcdcba6d3aec774fe4df8edab5396728d36acf6b
parent 7c315583
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -27,8 +27,10 @@
#include <set>

#include "internal_include/bt_trace.h"
#include "main/shim/shim.h"
#include "osi/include/alarm.h"
#include "stack/btm/btm_ble_bgconn.h"
#include "stack/include/l2c_api.h"

#define DIRECT_CONNECT_TIMEOUT (30 * 1000) /* 30 seconds */

@@ -89,6 +91,10 @@ std::set<tAPP_ID> get_apps_connecting_to(const RawAddress& address) {
/** Add a device from the background connection list.  Returns true if device
 * added to the list, or already in list, false otherwise */
bool background_connect_add(uint8_t app_id, const RawAddress& address) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return L2CA_ConnectFixedChnl(L2CAP_ATT_CID, address);
  }

  auto it = bgconn_dev.find(address);
  bool in_white_list = false;
  if (it != bgconn_dev.end()) {
@@ -193,6 +199,9 @@ void wl_direct_connect_timeout_cb(uint8_t app_id, const RawAddress& address) {
/** Add a device to the direcgt connection list.  Returns true if device
 * added to the list, false otherwise */
bool direct_connect_add(uint8_t app_id, const RawAddress& address) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return L2CA_ConnectFixedChnl(L2CAP_ATT_CID, address);
  }
  auto it = bgconn_dev.find(address);
  bool in_white_list = false;

+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include "l2c_int.h"
#include "l2cdefs.h"
#include "log/log.h"
#include "main/shim/shim.h"
#include "osi/include/osi.h"
#include "stack/gatt/connection_manager.h"
#include "stack_config.h"
@@ -147,6 +148,11 @@ bool L2CA_UpdateBleConnParams(const RawAddress& rem_bda, uint16_t min_int,
 *
 ******************************************************************************/
bool L2CA_EnableUpdateBleConnParams(const RawAddress& rem_bda, bool enable) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    LOG(ERROR) << "NOT IMPLEMENTED";
    return true;
  }

  if (stack_config_get_interface()->get_pts_conn_updates_disabled())
    return false;

+10 −0
Original line number Diff line number Diff line
@@ -59,6 +59,16 @@ void BTM_SetLeConnectionModeToSlow() {
  localWhiteListMock->SetLeConnectionModeToSlow();
}

namespace bluetooth {
namespace shim {
bool is_gd_shim_enabled() { return false; }
}  // namespace shim
}  // namespace bluetooth

bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& bd_addr) {
  return false;
}

namespace connection_manager {
class BleConnectionManager : public testing::Test {
  void SetUp() override {