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

Commit 560d5f37 authored by Ugo Yu's avatar Ugo Yu Committed by android-build-merger
Browse files

GATTC: Support get white list size from controller

am: 90f6d95f

Change-Id: Iaed2820cb514c7577c3ea5732d83e3381943dc34
parents a6d183ba 90f6d95f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ void bta_gattc_deregister(tBTA_GATTC_RCB* p_clreg) {
  }

  /* remove bg connection associated with this rcb */
  for (uint8_t i = 0; i < BTA_GATTC_KNOWN_SR_MAX; i++) {
  for (uint8_t i = 0; i < BTM_GetWhiteListSize(); i++) {
    if (!bta_gattc_cb.bg_track[i].in_use) continue;

    if (bta_gattc_cb.bg_track[i].cif_mask & (1 << (p_clreg->client_if - 1))) {
+2 −2
Original line number Diff line number Diff line
@@ -71,9 +71,9 @@ typedef uint16_t tBTA_GATTC_INT_EVT;
#define BTA_GATTC_CL_MAX 32
#endif

/* max known devices GATTC can support */
/* max known devices GATTC can support in Bluetooth spec */
#ifndef BTA_GATTC_KNOWN_SR_MAX
#define BTA_GATTC_KNOWN_SR_MAX 10
#define BTA_GATTC_KNOWN_SR_MAX 255
#endif

#define BTA_GATTC_CONN_MAX GATT_MAX_PHY_CHANNEL
+6 −6
Original line number Diff line number Diff line
@@ -224,7 +224,7 @@ tBTA_GATTC_SERV* bta_gattc_find_srcb(const RawAddress& bda) {
  tBTA_GATTC_SERV* p_srcb = &bta_gattc_cb.known_server[0];
  uint8_t i;

  for (i = 0; i < BTA_GATTC_KNOWN_SR_MAX; i++, p_srcb++) {
  for (i = 0; i < BTM_GetWhiteListSize(); i++, p_srcb++) {
    if (p_srcb->in_use && p_srcb->server_bda == bda) return p_srcb;
  }
  return NULL;
@@ -243,7 +243,7 @@ tBTA_GATTC_SERV* bta_gattc_find_srvr_cache(const RawAddress& bda) {
  tBTA_GATTC_SERV* p_srcb = &bta_gattc_cb.known_server[0];
  uint8_t i;

  for (i = 0; i < BTA_GATTC_KNOWN_SR_MAX; i++, p_srcb++) {
  for (i = 0; i < BTM_GetWhiteListSize(); i++, p_srcb++) {
    if (p_srcb->server_bda == bda) return p_srcb;
  }
  return NULL;
@@ -279,7 +279,7 @@ tBTA_GATTC_SERV* bta_gattc_srcb_alloc(const RawAddress& bda) {
  bool found = false;
  uint8_t i;

  for (i = 0; i < BTA_GATTC_KNOWN_SR_MAX; i++, p_tcb++) {
  for (i = 0; i < BTM_GetWhiteListSize(); i++, p_tcb++) {
    if (!p_tcb->in_use) {
      found = true;
      break;
@@ -409,7 +409,7 @@ bool bta_gattc_mark_bg_conn(tGATT_IF client_if,
  uint8_t i = 0;
  tBTA_GATTC_CIF_MASK* p_cif_mask;

  for (i = 0; i < BTA_GATTC_KNOWN_SR_MAX; i++, p_bg_tck++) {
  for (i = 0; i < BTM_GetWhiteListSize(); i++, p_bg_tck++) {
    if (p_bg_tck->in_use && ((p_bg_tck->remote_bda == remote_bda_ptr) ||
                             (p_bg_tck->remote_bda.IsEmpty()))) {
      p_cif_mask = &p_bg_tck->cif_mask;
@@ -437,7 +437,7 @@ bool bta_gattc_mark_bg_conn(tGATT_IF client_if,
  } else /* adding a new device mask */
  {
    for (i = 0, p_bg_tck = &bta_gattc_cb.bg_track[0];
         i < BTA_GATTC_KNOWN_SR_MAX; i++, p_bg_tck++) {
         i < BTM_GetWhiteListSize(); i++, p_bg_tck++) {
      if (!p_bg_tck->in_use) {
        p_bg_tck->in_use = true;
        p_bg_tck->remote_bda = remote_bda_ptr;
@@ -468,7 +468,7 @@ bool bta_gattc_check_bg_conn(tGATT_IF client_if, const RawAddress& remote_bda,
  uint8_t i = 0;
  bool is_bg_conn = false;

  for (i = 0; i < BTA_GATTC_KNOWN_SR_MAX && !is_bg_conn; i++, p_bg_tck++) {
  for (i = 0; i < BTM_GetWhiteListSize() && !is_bg_conn; i++, p_bg_tck++) {
    if (p_bg_tck->in_use && (p_bg_tck->remote_bda == remote_bda ||
                             p_bg_tck->remote_bda.IsEmpty())) {
      if (((p_bg_tck->cif_mask & (1 << (client_if - 1))) != 0) &&
+8 −0
Original line number Diff line number Diff line
@@ -314,6 +314,14 @@ void btm_ble_white_list_init(uint8_t white_list_size) {
  BTM_TRACE_DEBUG("%s white_list_size = %d", __func__, white_list_size);
}

uint8_t BTM_GetWhiteListSize() {
  const controller_t* controller = controller_get_interface();
  if (!controller->supports_ble()) {
    return 0;
  }
  return controller->get_ble_white_list_size();
}

bool BTM_SetLeConnectionModeToFast() {
  VLOG(2) << __func__;
  tBTM_BLE_CB* p_cb = &btm_cb.ble_ctr_cb;
+4 −1
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ extern bool BTM_WhiteListAdd(const RawAddress& address);
/** Removes the device from white list */
extern void BTM_WhiteListRemove(const RawAddress& address);

/** Get max white list size supports of the Bluetooth controller */
extern uint8_t BTM_GetWhiteListSize();

/** Clear the whitelist, end any pending whitelist connections */
extern void BTM_WhiteListClear();