OSDN Git Service

Remove advertise whitelist functionality
authorJakub Pawlowski <jpawlowski@google.com>
Fri, 28 Oct 2016 22:23:08 +0000 (15:23 -0700)
committerJakub Pawlowski <jpawlowski@google.com>
Fri, 28 Oct 2016 22:34:50 +0000 (15:34 -0700)
Advertise filtering is never used. It is not finished - adding device to
whitelist can never succed. It is also making advertising API unification
hard.

Bug: 30622771
Test: no tests necessary
Change-Id: I9df9ea18b265a580c2fcdb28a6d6ce4be43f0a24

15 files changed:
bta/gatt/bta_gattc_act.cc
bta/gatt/bta_gattc_api.cc
bta/gatt/bta_gattc_int.h
bta/gatt/bta_gatts_act.cc
bta/gatt/bta_gatts_api.cc
bta/gatt/bta_gatts_int.h
bta/gatt/bta_gatts_main.cc
bta/include/bta_gatt_api.h
btif/src/btif_gatt_client.cc
stack/btm/btm_ble_gap.cc
stack/gatt/gatt_api.cc
stack/gatt/gatt_int.h
stack/gatt/gatt_utils.cc
stack/include/btm_ble_api.h
stack/include/gatt_api.h

index 97c3696..ec16fb0 100644 (file)
@@ -1991,49 +1991,21 @@ void bta_gattc_listen(tBTA_GATTC_DATA * p_msg)
     }
     /* mark bg conn record */
     if (bta_gattc_mark_bg_conn(p_msg->api_listen.client_if,
-                               (BD_ADDR_PTR) p_msg->api_listen.remote_bda,
+                               (BD_ADDR_PTR) NULL,
                                p_msg->api_listen.start,
                                true))
     {
-        if (!GATT_Listen(p_msg->api_listen.client_if,
-                         p_msg->api_listen.start,
-                         p_msg->api_listen.remote_bda))
-        {
-            APPL_TRACE_ERROR("Listen failure");
-            (*p_clreg->p_cback)(BTA_GATTC_LISTEN_EVT, &cb_data);
-        }
-        else
-        {
-            cb_data.status = BTA_GATT_OK;
-
-            (*p_clreg->p_cback)(BTA_GATTC_LISTEN_EVT, &cb_data);
-
-            if (p_msg->api_listen.start)
-            {
-                /* if listen to a specific target */
-                if (p_msg->api_listen.remote_bda != NULL)
-                {
+        GATT_Listen(p_msg->api_listen.start);
+        cb_data.status = BTA_GATT_OK;
 
-                    /* if is a connected remote device */
-                    if (L2CA_GetBleConnRole(p_msg->api_listen.remote_bda) == HCI_ROLE_SLAVE &&
-                        bta_gattc_find_clcb_by_cif(p_msg->api_listen.client_if,
-                                                   p_msg->api_listen.remote_bda,
-                                                   BTA_GATT_TRANSPORT_LE) == NULL)
-                    {
+        (*p_clreg->p_cback)(BTA_GATTC_LISTEN_EVT, &cb_data);
 
-                        bta_gattc_init_clcb_conn(p_msg->api_listen.client_if,
-                                                p_msg->api_listen.remote_bda);
-                    }
-                }
-                /* if listen to all */
-                else
-                {
-                    LOG_DEBUG(LOG_TAG, "Listen For All now");
-                    /* go through all connected device and send
-                    callback for all connected slave connection */
-                    bta_gattc_process_listen_all(p_msg->api_listen.client_if);
-                }
-            }
+        if (p_msg->api_listen.start)
+        {
+            LOG_DEBUG(LOG_TAG, "Listen For All now");
+            /* go through all connected device and send
+            callback for all connected slave connection */
+            bta_gattc_process_listen_all(p_msg->api_listen.client_if);
         }
     }
 }
index 39c3b69..68ed1e8 100644 (file)
@@ -726,13 +726,11 @@ void BTA_GATTC_Refresh(const BD_ADDR remote_bda)
 **
 ** Parameters       client_if: server interface.
 **                  start: to start or stop listening for connection
-**                  remote_bda: remote device BD address, if listen to all device
-**                              use NULL.
 **
 ** Returns          void
 **
 *******************************************************************************/
-void BTA_GATTC_Listen(tBTA_GATTC_IF client_if, bool start, BD_ADDR_PTR target_bda)
+void BTA_GATTC_Listen(tBTA_GATTC_IF client_if, bool start)
 {
     tBTA_GATTC_API_LISTEN *p_buf =
         (tBTA_GATTC_API_LISTEN *)osi_malloc(sizeof(tBTA_GATTC_API_LISTEN) + BD_ADDR_LEN);
@@ -740,12 +738,6 @@ void BTA_GATTC_Listen(tBTA_GATTC_IF client_if, bool start, BD_ADDR_PTR target_bd
     p_buf->hdr.event = BTA_GATTC_API_LISTEN_EVT;
     p_buf->client_if = client_if;
     p_buf->start = start;
-    if (target_bda) {
-        p_buf->remote_bda = (uint8_t*)(p_buf + 1);
-        memcpy(p_buf->remote_bda, target_bda, BD_ADDR_LEN);
-    } else {
-        p_buf->remote_bda = NULL;
-    }
 
     bta_sys_sendmsg(p_buf);
 }
index 089b05d..60991bc 100644 (file)
@@ -181,7 +181,6 @@ typedef struct
 typedef struct
 {
     BT_HDR                  hdr;
-    BD_ADDR_PTR             remote_bda;
     tBTA_GATTC_IF           client_if;
     bool                 start;
 } tBTA_GATTC_API_LISTEN;
index b9394f5..331e5e0 100644 (file)
@@ -582,40 +582,6 @@ void bta_gatts_close (UNUSED_ATTR tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA * p_msg)
     }
 
 }
-/*******************************************************************************
-**
-** Function         bta_gatts_listen
-**
-** Description      Start or stop listening for LE connection on a GATT server
-**
-** Returns          none.
-**
-*******************************************************************************/
-void bta_gatts_listen(UNUSED_ATTR tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA * p_msg)
-{
-    tBTA_GATTS_RCB     *p_rcb = bta_gatts_find_app_rcb_by_app_if(p_msg->api_listen.server_if);
-    tBTA_GATTS          cb_data;
-
-    cb_data.reg_oper.status = BTA_GATT_OK;
-    cb_data.reg_oper.server_if = p_msg->api_listen.server_if;
-
-    if (p_rcb == NULL)
-    {
-        APPL_TRACE_ERROR("Unknown GATTS application");
-        return;
-    }
-
-    if (!GATT_Listen(p_msg->api_listen.server_if,
-                     p_msg->api_listen.start,
-                     p_msg->api_listen.remote_bda))
-    {
-        cb_data.status = BTA_GATT_ERROR;
-        APPL_TRACE_ERROR("bta_gatts_listen Listen failed");
-    }
-
-    if (p_rcb->p_cback)
-        (*p_rcb->p_cback)(BTA_GATTS_LISTEN_EVT, &cb_data);
-}
 
 /*******************************************************************************
 **
index 64bb05f..e1b0669 100644 (file)
@@ -353,37 +353,4 @@ void BTA_GATTS_Close(uint16_t conn_id)
     bta_sys_sendmsg(p_buf);
 }
 
-/*******************************************************************************
-**
-** Function         BTA_GATTS_Listen
-**
-** Description      Start advertisement to listen for connection request for a
-**                  GATT server
-**
-** Parameters       server_if: server interface.
-**                  start: to start or stop listening for connection
-**                  remote_bda: remote device BD address, if listen to all device
-**                              use NULL.
-**
-** Returns          void
-**
-*******************************************************************************/
-void BTA_GATTS_Listen(tBTA_GATTS_IF server_if, bool start, BD_ADDR_PTR target_bda)
-{
-    tBTA_GATTS_API_LISTEN *p_buf =
-        (tBTA_GATTS_API_LISTEN *)osi_malloc(sizeof(tBTA_GATTS_API_LISTEN) + BD_ADDR_LEN);
-
-    p_buf->hdr.event = BTA_GATTS_API_LISTEN_EVT;
-    p_buf->server_if = server_if;
-    p_buf->start = start;
-    if (target_bda) {
-        p_buf->remote_bda = (uint8_t *)(p_buf + 1);
-        memcpy(p_buf->remote_bda, target_bda, BD_ADDR_LEN);
-    } else {
-       p_buf->remote_bda = NULL;
-    }
-
-    bta_sys_sendmsg(p_buf);
-}
-
 #endif /* BTA_GATT_INCLUDED */
index 3628e2f..23f3513 100644 (file)
@@ -47,7 +47,6 @@ enum
     BTA_GATTS_API_OPEN_EVT,
     BTA_GATTS_API_CANCEL_OPEN_EVT,
     BTA_GATTS_API_CLOSE_EVT,
-    BTA_GATTS_API_LISTEN_EVT,
     BTA_GATTS_API_DISABLE_EVT
 };
 typedef uint16_t tBTA_GATTS_INT_EVT;
@@ -118,14 +117,6 @@ typedef struct
 
 typedef tBTA_GATTS_API_OPEN tBTA_GATTS_API_CANCEL_OPEN;
 
-typedef struct
-{
-    BT_HDR                  hdr;
-    BD_ADDR_PTR             remote_bda;
-    tBTA_GATTS_IF           server_if;
-    bool                 start;
-} tBTA_GATTS_API_LISTEN;
-
 typedef union
 {
     BT_HDR                          hdr;
@@ -138,8 +129,6 @@ typedef union
     tBTA_GATTS_API_CANCEL_OPEN      api_cancel_open;
 
     tBTA_GATTS_INT_START_IF         int_start_if;
-    /* if peripheral role is supported */
-    tBTA_GATTS_API_LISTEN           api_listen;
 } tBTA_GATTS_DATA;
 
 /* application registration control block */
@@ -199,7 +188,6 @@ extern void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA * p_
 extern void bta_gatts_open (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA * p_msg);
 extern void bta_gatts_cancel_open (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA * p_msg);
 extern void bta_gatts_close (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA * p_msg);
-extern void bta_gatts_listen(tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA * p_msg);
 
 extern bool bta_gatts_uuid_compare(tBT_UUID tar, tBT_UUID src);
 extern tBTA_GATTS_RCB *bta_gatts_find_app_rcb_by_app_if(tBTA_GATTS_IF server_if);
index 9f78cae..ceff956 100644 (file)
@@ -86,11 +86,6 @@ bool bta_gatts_hdl_event(BT_HDR *p_msg)
             bta_gatts_send_rsp(p_cb,(tBTA_GATTS_DATA *) p_msg);
             break;
 
-        case BTA_GATTS_API_LISTEN_EVT:
-            bta_gatts_listen(p_cb,(tBTA_GATTS_DATA *) p_msg);
-            break;
-
-
         case BTA_GATTS_API_DEL_SRVC_EVT:
         {
             tBTA_GATTS_SRVC_CB *p_srvc_cb = bta_gatts_find_srvc_cb_by_srvc_id(p_cb,
index e4f05d5..f6a88d3 100644 (file)
@@ -932,13 +932,11 @@ extern void BTA_GATTC_Refresh(const BD_ADDR remote_bda);
 **
 ** Parameters       client_if: server interface.
 **                  start: to start or stop listening for connection
-**                  remote_bda: remote device BD address, if listen to all device
-**                              use NULL.
 **
 ** Returns          void
 **
 *******************************************************************************/
-extern void BTA_GATTC_Listen(tBTA_GATTC_IF client_if, bool start, BD_ADDR_PTR target_bda);
+extern void BTA_GATTC_Listen(tBTA_GATTC_IF client_if, bool start);
 
 /*******************************************************************************
 **
@@ -1157,22 +1155,4 @@ extern void BTA_GATTS_CancelOpen(tBTA_GATTS_IF server_if, BD_ADDR remote_bda, bo
 *******************************************************************************/
 extern void BTA_GATTS_Close(uint16_t conn_id);
 
-/*******************************************************************************
-**
-** Function         BTA_GATTS_Listen
-**
-** Description      Start advertisement to listen for connection request for a
-**                  GATT server
-**
-** Parameters       server_if: server interface.
-**                  start: to start or stop listening for connection
-**                  remote_bda: remote device BD address, if listen to all device
-**                              use NULL.
-**
-** Returns          void
-**
-*******************************************************************************/
-extern void BTA_GATTS_Listen(tBTA_GATTS_IF server_if, bool start,
-                             BD_ADDR_PTR target_bda);
-
 #endif /* BTA_GATT_API_H */
index 53a3b5c..dcf10de 100644 (file)
@@ -338,7 +338,7 @@ bt_status_t btif_gattc_listen(int client_if, bool start) {
   CHECK_BTGATT_INIT();
 #if (defined(BLE_PERIPHERAL_MODE_SUPPORT) && \
      (BLE_PERIPHERAL_MODE_SUPPORT == true))
-  return do_in_jni_thread(Bind(&BTA_GATTC_Listen, client_if, start, nullptr));
+  return do_in_jni_thread(Bind(&BTA_GATTC_Listen, client_if, start));
 #else
   return do_in_jni_thread(Bind(&BTA_GATTC_Broadcast, client_if, start));
 #endif
index ddd3a4e..6143381 100644 (file)
@@ -229,21 +229,6 @@ const uint8_t btm_le_state_combo_tbl[BTM_BLE_STATE_MAX][BTM_BLE_STATE_MAX][2] =
 
 /*******************************************************************************
 **
-** Function         BTM_BleUpdateAdvWhitelist
-**
-** Description      Add or remove device from advertising white list
-**
-** Returns          void
-**
-*******************************************************************************/
-bool    BTM_BleUpdateAdvWhitelist(UNUSED_ATTR bool add_remove,
-                                  UNUSED_ATTR BD_ADDR remote_bda)
-{
-    return false;
-}
-
-/*******************************************************************************
-**
 ** Function         BTM_BleUpdateAdvFilterPolicy
 **
 ** Description      This function update the filter policy of advertiser.
index 3a6b576..f7d809b 100644 (file)
@@ -1165,7 +1165,7 @@ void GATT_Deregister (tGATT_IF gatt_if)
     gatt_deregister_bgdev_list(gatt_if);
     /* update the listen mode */
 #if (BLE_PERIPHERAL_MODE_SUPPORT == TRUE)
-    GATT_Listen(gatt_if, false, NULL);
+    GATT_Listen(false);
 #endif
 
     memset (p_reg, 0, sizeof(tGATT_REG));
@@ -1246,7 +1246,7 @@ bool GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, bool is_direct,
     else
     {
         if (transport == BT_TRANSPORT_LE)
-        status = gatt_update_auto_connect_dev(gatt_if,true, bd_addr, true);
+        status = gatt_update_auto_connect_dev(gatt_if,true, bd_addr);
         else
         {
             GATT_TRACE_ERROR("Unsupported transport for background connection");
@@ -1446,37 +1446,13 @@ bool    GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr, uint16_t *p
 ** Description      This function start or stop LE advertisement and listen for
 **                  connection.
 **
-** Parameters       gatt_if: applicaiton interface
-**                  p_bd_addr: listen for specific address connection, or NULL for
-**                             listen to all device connection.
-**                  start: start or stop listening.
-**
-** Returns          true if advertisement is started; false if adv start failure.
+** Parameters       start: start or stop listening.
 **
 *******************************************************************************/
-bool    GATT_Listen (tGATT_IF gatt_if, bool    start, BD_ADDR_PTR bd_addr)
+void GATT_Listen(bool start)
 {
-    tGATT_REG    *p_reg;
-
-    GATT_TRACE_API ("GATT_Listen gatt_if=%d", gatt_if);
-
-    /* Make sure app is registered */
-    if ((p_reg = gatt_get_regcb(gatt_if)) == NULL)
-    {
-        GATT_TRACE_ERROR("GATT_Listen - gatt_if =%d is not registered", gatt_if);
-        return(false);
-    }
-
-    if (bd_addr != NULL)
-    {
-        gatt_update_auto_connect_dev(gatt_if,start, bd_addr, false);
-    }
-    else
-    {
-        p_reg->listening = start ? GATT_LISTEN_TO_ALL : GATT_LISTEN_TO_NONE;
-    }
-
-    return gatt_update_listen_mode();
+    GATT_TRACE_API("GATT_Listen start=%d", start);
+    gatt_update_listen_mode(start ? GATT_LISTEN_TO_ALL : GATT_LISTEN_TO_NONE);
 }
 
 #endif
index 4990d7f..ba1fe8f 100644 (file)
@@ -411,7 +411,6 @@ typedef struct
 typedef struct
 {
     tGATT_IF        gatt_if[GATT_MAX_APPS];
-    tGATT_IF        listen_gif[GATT_MAX_APPS];
     BD_ADDR         remote_bda;
     bool            in_use;
 }tGATT_BG_CONN_DEV;
@@ -543,7 +542,7 @@ extern void gatt_set_srv_chg(void);
 extern void gatt_delete_dev_from_srv_chg_clt_list(BD_ADDR bd_addr);
 extern tGATT_VALUE *gatt_add_pending_ind(tGATT_TCB  *p_tcb, tGATT_VALUE *p_ind);
 extern void gatt_free_srvc_db_buffer_app_id(tBT_UUID *p_app_id);
-extern bool    gatt_update_listen_mode(void);
+extern void gatt_update_listen_mode(int listening);
 extern bool    gatt_cl_send_next_cmd_inq(tGATT_TCB *p_tcb);
 
 /* reserved handle list */
@@ -560,7 +559,7 @@ extern bool    gatt_remove_an_item_from_list(tGATT_HDL_LIST_INFO *p_list, tGATT_
 extern tGATTS_SRV_CHG *gatt_add_srv_chg_clt(tGATTS_SRV_CHG *p_srv_chg);
 
 /* for background connection */
-extern bool    gatt_update_auto_connect_dev (tGATT_IF gatt_if, bool    add, BD_ADDR bd_addr, bool    is_initiator);
+extern bool    gatt_update_auto_connect_dev (tGATT_IF gatt_if, bool    add, BD_ADDR bd_addr);
 extern bool    gatt_is_bg_dev_for_app(tGATT_BG_CONN_DEV *p_dev, tGATT_IF gatt_if);
 extern bool    gatt_remove_bg_dev_for_app(tGATT_IF gatt_if, BD_ADDR bd_addr);
 extern uint8_t gatt_get_num_apps_for_bg_dev(BD_ADDR bd_addr);
index 06b2378..cfa86b7 100644 (file)
@@ -2398,7 +2398,7 @@ tGATT_BG_CONN_DEV * gatt_alloc_bg_dev(BD_ADDR remote_bda)
 ** Returns          true if device added to the list; false failed
 **
 *******************************************************************************/
-bool    gatt_add_bg_dev_list(tGATT_REG *p_reg,  BD_ADDR bd_addr, bool    is_initator)
+bool    gatt_add_bg_dev_list(tGATT_REG *p_reg,  BD_ADDR bd_addr)
 {
     tGATT_IF gatt_if =  p_reg->gatt_if;
     tGATT_BG_CONN_DEV   *p_dev = NULL;
@@ -2414,44 +2414,19 @@ bool    gatt_add_bg_dev_list(tGATT_REG *p_reg,  BD_ADDR bd_addr, bool    is_init
     {
         for (i = 0; i < GATT_MAX_APPS; i ++)
         {
-            if (is_initator)
+            if (p_dev->gatt_if[i] == gatt_if)
             {
-                if (p_dev->gatt_if[i] == gatt_if)
-                {
-                    GATT_TRACE_ERROR("device already in iniator white list");
-                    return true;
-                }
-                else if (p_dev->gatt_if[i] == 0)
-                {
-                    p_dev->gatt_if[i] = gatt_if;
-                    if (i == 0)
-                        ret = BTM_BleUpdateBgConnDev(true, bd_addr);
-                    else
-                        ret = true;
-                    break;
-                }
+                GATT_TRACE_ERROR("device already in iniator white list");
+                return true;
             }
-            else
+            else if (p_dev->gatt_if[i] == 0)
             {
-                if (p_dev->listen_gif[i] == gatt_if)
-                {
-                    GATT_TRACE_ERROR("device already in adv white list");
-                    return true;
-                }
-                else if (p_dev->listen_gif[i] == 0)
-                {
-                    if (p_reg->listening == GATT_LISTEN_TO_ALL)
-                        p_reg->listening = GATT_LISTEN_TO_NONE;
-
-                    p_reg->listening ++;
-                    p_dev->listen_gif[i] = gatt_if;
-
-                    if (i == 0)
-                        ret = BTM_BleUpdateAdvWhitelist(true, bd_addr);
-                    else
-                        ret = true;
-                    break;
-                }
+                p_dev->gatt_if[i] = gatt_if;
+                if (i == 0)
+                    ret = BTM_BleUpdateBgConnDev(true, bd_addr);
+                else
+                    ret = true;
+                break;
             }
         }
     }
@@ -2479,7 +2454,7 @@ bool    gatt_remove_bg_dev_for_app(tGATT_IF gatt_if, BD_ADDR bd_addr)
 
     if (p_tcb)
         gatt_update_app_use_link_flag(gatt_if, p_tcb, false, false);
-    status = gatt_update_auto_connect_dev(gatt_if, false, bd_addr, true);
+    status = gatt_update_auto_connect_dev(gatt_if, false, bd_addr);
     return status;
 }
 
@@ -2553,7 +2528,7 @@ bool    gatt_find_app_for_bg_dev(BD_ADDR bd_addr, tGATT_IF *p_gatt_if)
 ** Returns          pointer to the device record
 **
 *******************************************************************************/
-bool    gatt_remove_bg_dev_from_list(tGATT_REG *p_reg, BD_ADDR bd_addr, bool    is_initiator)
+bool    gatt_remove_bg_dev_from_list(tGATT_REG *p_reg, BD_ADDR bd_addr)
 {
     tGATT_IF gatt_if = p_reg->gatt_if;
     tGATT_BG_CONN_DEV   *p_dev = NULL;
@@ -2565,45 +2540,25 @@ bool    gatt_remove_bg_dev_from_list(tGATT_REG *p_reg, BD_ADDR bd_addr, bool
         return ret;
     }
 
-    for (i = 0; i < GATT_MAX_APPS && (p_dev->gatt_if[i] > 0 || p_dev->listen_gif[i]); i ++)
+    for (i = 0; i < GATT_MAX_APPS && (p_dev->gatt_if[i] > 0); i ++)
     {
-        if (is_initiator)
+        if (p_dev->gatt_if[i] == gatt_if)
         {
-            if (p_dev->gatt_if[i] == gatt_if)
-            {
-                p_dev->gatt_if[i] = 0;
-                /* move all element behind one forward */
-                for (j = i + 1; j < GATT_MAX_APPS; j ++)
-                    p_dev->gatt_if[j - 1] = p_dev->gatt_if[j];
+            p_dev->gatt_if[i] = 0;
+            /* move all element behind one forward */
+            for (j = i + 1; j < GATT_MAX_APPS; j ++)
+                p_dev->gatt_if[j - 1] = p_dev->gatt_if[j];
 
-                if (p_dev->gatt_if[0] == 0)
-                    ret = BTM_BleUpdateBgConnDev(false, p_dev->remote_bda);
-                else
-                    ret = true;
+            if (p_dev->gatt_if[0] == 0)
+                ret = BTM_BleUpdateBgConnDev(false, p_dev->remote_bda);
+            else
+                ret = true;
 
-                break;
-            }
-        }
-        else
-        {
-            if (p_dev->listen_gif[i] == gatt_if)
-            {
-                p_dev->listen_gif[i] = 0;
-                p_reg->listening --;
-                /* move all element behind one forward */
-                for (j = i + 1; j < GATT_MAX_APPS; j ++)
-                    p_dev->listen_gif[j - 1] = p_dev->listen_gif[j];
-
-                if (p_dev->listen_gif[0] == 0)
-                    ret = BTM_BleUpdateAdvWhitelist(false, p_dev->remote_bda);
-                else
-                    ret = true;
-                break;
-            }
+            break;
         }
     }
 
-    if (i != GATT_MAX_APPS && p_dev->gatt_if[0] == 0 && p_dev->listen_gif[0] == 0)
+    if (i != GATT_MAX_APPS && p_dev->gatt_if[0] == 0)
     {
         memset(p_dev, 0, sizeof(tGATT_BG_CONN_DEV));
     }
@@ -2623,7 +2578,6 @@ void gatt_deregister_bgdev_list(tGATT_IF gatt_if)
 {
     tGATT_BG_CONN_DEV    *p_dev_list = &gatt_cb.bgconn_dev[0];
     uint8_t i , j, k;
-    tGATT_REG       *p_reg = gatt_get_regcb(gatt_if);
 
     /* update the BG conn device list */
     for (i = 0 ; i <GATT_MAX_BG_CONN_DEV; i ++, p_dev_list ++ )
@@ -2632,7 +2586,7 @@ void gatt_deregister_bgdev_list(tGATT_IF gatt_if)
         {
             for (j = 0; j < GATT_MAX_APPS; j ++)
             {
-                if (p_dev_list->gatt_if[j] == 0 && p_dev_list->listen_gif[j] == 0)
+                if (p_dev_list->gatt_if[j] == 0)
                     break;
 
                 if (p_dev_list->gatt_if[j] == gatt_if)
@@ -2643,21 +2597,6 @@ void gatt_deregister_bgdev_list(tGATT_IF gatt_if)
                     if (p_dev_list->gatt_if[0] == 0)
                         BTM_BleUpdateBgConnDev(false, p_dev_list->remote_bda);
                 }
-
-                if (p_dev_list->listen_gif[j] == gatt_if)
-                {
-                    p_dev_list->listen_gif[j] = 0;
-
-                    if (p_reg != NULL && p_reg->listening > 0)
-                        p_reg->listening --;
-
-                    /* move all element behind one forward */
-                    for (k = j + 1; k < GATT_MAX_APPS; k ++)
-                        p_dev_list->listen_gif[k - 1] = p_dev_list->listen_gif[k];
-
-                    if (p_dev_list->listen_gif[0] == 0)
-                        BTM_BleUpdateAdvWhitelist(false, p_dev_list->remote_bda);
-                }
             }
         }
     }
@@ -2692,7 +2631,7 @@ void gatt_reset_bgdev_list(void)
 ** Returns          true if connection started; false if connection start failure.
 **
 *******************************************************************************/
-bool    gatt_update_auto_connect_dev (tGATT_IF gatt_if, bool    add, BD_ADDR bd_addr, bool    is_initator)
+bool    gatt_update_auto_connect_dev (tGATT_IF gatt_if, bool    add, BD_ADDR bd_addr)
 {
     bool            ret = false;
     tGATT_REG        *p_reg;
@@ -2708,7 +2647,7 @@ bool    gatt_update_auto_connect_dev (tGATT_IF gatt_if, bool    add, BD_ADDR bd_
 
     if (add)
     {
-        ret = gatt_add_bg_dev_list(p_reg, bd_addr, is_initator);
+        ret = gatt_add_bg_dev_list(p_reg, bd_addr);
 
         if (ret && p_tcb != NULL)
         {
@@ -2718,7 +2657,7 @@ bool    gatt_update_auto_connect_dev (tGATT_IF gatt_if, bool    add, BD_ADDR bd_
     }
     else
     {
-        ret = gatt_remove_bg_dev_from_list(p_reg, bd_addr, is_initator);
+        ret = gatt_remove_bg_dev_from_list(p_reg, bd_addr);
     }
     return ret;
 }
@@ -2756,47 +2695,23 @@ tGATT_PENDING_ENC_CLCB* gatt_add_pending_enc_channel_clcb(tGATT_TCB *p_tcb, tGAT
 ** Returns    Pointer to the new service start buffer, NULL no buffer available
 **
 *******************************************************************************/
-bool    gatt_update_listen_mode(void)
+void gatt_update_listen_mode(int listening)
 {
-    uint8_t         ii = 0;
-    tGATT_REG       *p_reg = &gatt_cb.cl_rcb[0];
-    uint8_t         listening = 0;
     uint16_t        connectability, window, interval;
-    bool            rt = true;
 
-    for (; ii < GATT_MAX_APPS; ii ++, p_reg ++)
+    connectability = BTM_ReadConnectability(&window, &interval);
+
+    if (listening != GATT_LISTEN_TO_NONE)
     {
-        if ( p_reg->in_use && p_reg->listening > listening)
-        {
-            listening = p_reg->listening;
-        }
+        connectability |= BTM_BLE_CONNECTABLE;
     }
-
-    if (listening == GATT_LISTEN_TO_ALL ||
-        listening == GATT_LISTEN_TO_NONE)
-        BTM_BleUpdateAdvFilterPolicy (AP_SCAN_CONN_ALL);
     else
-        BTM_BleUpdateAdvFilterPolicy (AP_SCAN_CONN_WL);
-
-    if (rt)
     {
-        connectability = BTM_ReadConnectability (&window, &interval);
-
-        if (listening != GATT_LISTEN_TO_NONE)
-        {
-            connectability |= BTM_BLE_CONNECTABLE;
-        }
-        else
-        {
-            if ((connectability & BTM_BLE_CONNECTABLE) == 0)
-            connectability &= ~BTM_BLE_CONNECTABLE;
-        }
-        /* turning on the adv now */
-        btm_ble_set_connectability(connectability);
+        if ((connectability & BTM_BLE_CONNECTABLE) == 0)
+        connectability &= ~BTM_BLE_CONNECTABLE;
     }
-
-    return rt;
-
+    /* turning on the adv now */
+    btm_ble_set_connectability(connectability);
 }
 #endif
 
index af9349f..5400b1c 100644 (file)
@@ -746,17 +746,6 @@ extern void BTM_BleTurnOnPrivacyOnRemote(BD_ADDR bd_addr,
 
 /*******************************************************************************
 **
-** Function         BTM_BleUpdateAdvWhitelist
-**
-** Description      Add or remove device from advertising white list
-**
-** Returns          void
-**
-*******************************************************************************/
-extern bool    BTM_BleUpdateAdvWhitelist(bool    add_remove, BD_ADDR emote_bda);
-
-/*******************************************************************************
-**
 ** Function         BTM_BleUpdateAdvFilterPolicy
 **
 ** Description      This function update the filter policy of advertiser.
index 4ec8bf6..d8d159c 100644 (file)
@@ -1080,15 +1080,11 @@ extern bool    GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr,
 ** Description      This function start or stop LE advertisement and listen for
 **                  connection.
 **
-** Parameters       gatt_if: applicaiton interface
-**                  p_bd_addr: listen for specific address connection, or NULL for
-**                             listen to all device connection.
-**                  start: is a direct conenection or a background auto connection
+** Parameters       start: is a direct conenection or a background auto connection
 **
-** Returns          true if advertisement is started; false if adv start failure.
 **
 *******************************************************************************/
-extern bool    GATT_Listen (tGATT_IF gatt_if, bool    start, BD_ADDR_PTR bd_addr);
+extern void GATT_Listen(bool start);
 
 /*******************************************************************************
 **