OSDN Git Service

Remove dead methods and callbacks
authorJakub Pawlowski <jpawlowski@google.com>
Mon, 29 Feb 2016 21:23:04 +0000 (13:23 -0800)
committerJakub Pawlowski <jpawlowski@google.com>
Thu, 3 Mar 2016 23:02:13 +0000 (15:02 -0800)
Bug: 27455533
Change-Id: Ie5661577320810468dd635022027a1e1a2f70a3e

bta/gatt/bta_gattc_api.c
bta/include/bta_gatt_api.h
btif/src/btif_gatt_client.c
service/gatt_server_old.cpp
service/hal/bluetooth_gatt_interface.cpp
service/hal/fake_bluetooth_gatt_interface.cpp

index d9d5e9c..3f135b1 100644 (file)
@@ -382,51 +382,6 @@ tBTA_GATT_STATUS  BTA_GATTC_GetFirstCharDescr (UINT16 conn_id, tBTA_GATTC_CHAR_I
     return status;
 
 }
-/*******************************************************************************
-**
-** Function         BTA_GATTC_GetNextCharDescr
-**
-** Description      This function is called to find the next characteristic descriptor
-**                  of the characterisctic.
-**
-** Parameters       conn_id: connection ID which identify the server.
-**                  p_start_descr_id: start the descriptor search from the next record
-**                           after the one identified by p_start_descr_id.
-**                  p_descr_uuid_cond: Characteristic descriptor UUID, if NULL find
-**                               the first available characteristic descriptor.
-**                  p_descr_result: output parameter which will store the GATT
-**                                  characteristic descriptor ID.
-**
-** Returns          returns status.
-**
-*******************************************************************************/
-tBTA_GATT_STATUS  BTA_GATTC_GetNextCharDescr (UINT16 conn_id,
-                                             tBTA_GATTC_CHAR_DESCR_ID *p_start_descr_id,
-                                             tBT_UUID           *p_descr_uuid_cond,
-                                             tBTA_GATTC_CHAR_DESCR_ID *p_descr_result)
-{
-    tBTA_GATT_STATUS    status;
-
-    if (!p_start_descr_id || !p_descr_result)
-        return BTA_GATT_ILLEGAL_PARAMETER;
-
-    memset(p_descr_result, 0, sizeof(tBTA_GATTC_CHAR_DESCR_ID));
-
-    if ((status = bta_gattc_query_cache(conn_id, BTA_GATTC_ATTR_TYPE_CHAR_DESCR,
-                                        &p_start_descr_id->char_id.srvc_id,
-                                        &p_start_descr_id->char_id.char_id,
-                                        p_descr_uuid_cond,
-                                        &p_descr_result->char_id.char_id,
-                                        (void *)&p_start_descr_id->descr_id))
-        == BTA_GATT_OK)
-    {
-        memcpy(&p_descr_result->descr_id, &p_descr_result->char_id.char_id, sizeof(tBTA_GATT_ID));
-        memcpy(&p_descr_result->char_id, p_start_descr_id, sizeof(tBTA_GATTC_CHAR_ID));
-    }
-
-    return status;
-}
-
 
 /*******************************************************************************
 **
@@ -467,48 +422,6 @@ tBTA_GATT_STATUS  BTA_GATTC_GetFirstIncludedService(UINT16 conn_id, tBTA_GATT_SR
 
     return status;
 }
-/*******************************************************************************
-**
-** Function         BTA_GATTC_GetNextIncludedService
-**
-** Description      This function is called to find the next included service of the
-**                  service on the given server.
-**
-** Parameters       conn_id: connection ID which identify the server.
-**                  p_start_id: start the search from the next record
-**                                  after the one identified by p_start_id.
-**                  p_uuid_cond: Included service UUID, if NULL find the first available
-**                               included service.
-**                  p_result: output parameter which will store the GATT ID
-**                              of the included service found.
-**
-** Returns          returns status.
-**
-*******************************************************************************/
-tBTA_GATT_STATUS  BTA_GATTC_GetNextIncludedService(UINT16 conn_id,
-                                                   tBTA_GATTC_INCL_SVC_ID *p_start_id,
-                                                   tBT_UUID               *p_uuid_cond,
-                                                   tBTA_GATTC_INCL_SVC_ID *p_result)
-{
-    tBTA_GATT_STATUS    status;
-
-    if (!p_start_id || !p_result)
-        return BTA_GATT_ILLEGAL_PARAMETER;
-
-    if ((status = bta_gattc_query_cache(conn_id,
-                                        BTA_GATTC_ATTR_TYPE_INCL_SRVC,
-                                        &p_start_id->srvc_id,
-                                        &p_start_id->incl_svc_id.id,
-                                        p_uuid_cond,
-                                        &p_result->incl_svc_id.id,
-                                        (void *)&p_result->incl_svc_id.is_primary))
-        == BTA_GATT_OK)
-    {
-        memcpy(&p_result->srvc_id, &p_start_id->srvc_id, sizeof(tBTA_GATT_SRVC_ID));
-    }
-
-    return status;
-}
 
 /*******************************************************************************
 **
index 9cd4f05..b3c4f4b 100644 (file)
@@ -815,30 +815,6 @@ extern tBTA_GATT_STATUS  BTA_GATTC_GetFirstCharDescr (UINT16 conn_id, tBTA_GATTC
 
 /*******************************************************************************
 **
-** Function         BTA_GATTC_GetNextCharDescr
-**
-** Description      This function is called to find the next charatceristic of the
-**                  service on the given server.
-**
-** Parameters       conn_id: connection ID which identify the server.
-**                  p_start_descr_id: start the characteristic search from the next record
-**                           after the one identified by p_start_descr_id.
-**                  p_descr_uuid_cond: Characteristic descriptor UUID, if NULL find
-**                               the first available characteristic descriptor.
-**                  p_descr_result: output parameter which will store the GATT
-**                                  characteristic descriptor ID.
-**
-** Returns          returns status.
-**
-*******************************************************************************/
-extern tBTA_GATT_STATUS  BTA_GATTC_GetNextCharDescr (UINT16 conn_id,
-                                                     tBTA_GATTC_CHAR_DESCR_ID *p_start_descr_id,
-                                                     tBT_UUID           *p_descr_uuid_cond,
-                                                     tBTA_GATTC_CHAR_DESCR_ID *p_descr_result);
-
-
-/*******************************************************************************
-**
 ** Function         BTA_GATTC_GetFirstIncludedService
 **
 ** Description      This function is called to find the first included service of the
@@ -861,29 +837,6 @@ extern tBTA_GATT_STATUS  BTA_GATTC_GetFirstIncludedService(UINT16 conn_id,
 
 /*******************************************************************************
 **
-** Function         BTA_GATTC_GetNextIncludedService
-**
-** Description      This function is called to find the next included service of the
-**                  service on the given server.
-**
-** Parameters       conn_id: connection ID which identify the server.
-**                  p_start_id: start the search from the next record
-**                                  after the one identified by p_start_id.
-**                  p_uuid_cond: Included service UUID, if NULL find the first available
-**                               included service.
-**                  p_result: output parameter which will store the GATT ID
-**                              of the included service found.
-**
-** Returns          returns status.
-**
-*******************************************************************************/
-extern tBTA_GATT_STATUS  BTA_GATTC_GetNextIncludedService(UINT16 conn_id,
-                                                          tBTA_GATTC_INCL_SVC_ID *p_start_id,
-                                                          tBT_UUID             *p_uuid_cond,
-                                                          tBTA_GATTC_INCL_SVC_ID *p_result);
-
-/*******************************************************************************
-**
 ** Function         BTA_GATTC_GetGattDb
 **
 ** Description      This function is called to get gatt db.
index 9936d05..4e18346 100644 (file)
@@ -78,12 +78,6 @@ typedef enum {
     BTIF_GATTC_OPEN,
     BTIF_GATTC_CLOSE,
     BTIF_GATTC_SEARCH_SERVICE,
-    BTIF_GATTC_GET_FIRST_CHAR,
-    BTIF_GATTC_GET_NEXT_CHAR,
-    BTIF_GATTC_GET_FIRST_CHAR_DESCR,
-    BTIF_GATTC_GET_NEXT_CHAR_DESCR,
-    BTIF_GATTC_GET_FIRST_INCL_SERVICE,
-    BTIF_GATTC_GET_NEXT_INCL_SERVICE,
     BTIF_GATTC_READ_CHAR,
     BTIF_GATTC_READ_CHAR_DESCR,
     BTIF_GATTC_WRITE_CHAR,
@@ -510,15 +504,6 @@ static void btif_gattc_upstreams_evt(uint16_t event, char* p_param)
             break;
         }
 
-        case BTA_GATTC_SEARCH_RES_EVT:
-        {
-            btgatt_srvc_id_t data;
-            bta_to_btif_srvc_id(&data, &(p_data->srvc_res.service_uuid));
-            HAL_CBACK(bt_gatt_callbacks, client->search_result_cb
-                , p_data->srvc_res.conn_id, &data);
-            break;
-        }
-
         case BTA_GATTC_READ_DESCR_EVT:
         {
             btgatt_read_params_t data;
@@ -1136,14 +1121,8 @@ static void btgattc_handle_event(uint16_t event, char* p_param)
 {
     tBTA_GATT_STATUS           status;
     tBT_UUID                   uuid;
-    tBTA_GATT_SRVC_ID          srvc_id;
-    tGATT_CHAR_PROP            out_char_prop;
     tBTA_GATTC_CHAR_ID         in_char_id;
-    tBTA_GATTC_CHAR_ID         out_char_id;
     tBTA_GATTC_CHAR_DESCR_ID   in_char_descr_id;
-    tBTA_GATTC_CHAR_DESCR_ID   out_char_descr_id;
-    tBTA_GATTC_INCL_SVC_ID     in_incl_svc_id;
-    tBTA_GATTC_INCL_SVC_ID     out_incl_svc_id;
     tBTA_GATT_UNFMT            descr_val;
 
     btif_gattc_cb_t* p_cb = (btif_gattc_cb_t*) p_param;
@@ -1258,110 +1237,6 @@ static void btgattc_handle_event(uint16_t event, char* p_param)
             break;
         }
 
-        case BTIF_GATTC_GET_FIRST_CHAR:
-        {
-            btgatt_gatt_id_t char_id;
-            btif_to_bta_srvc_id(&srvc_id, &p_cb->srvc_id);
-            status = BTA_GATTC_GetFirstChar(p_cb->conn_id, &srvc_id, NULL,
-                                            &out_char_id, &out_char_prop);
-
-            if (status == 0)
-                bta_to_btif_gatt_id(&char_id, &out_char_id.char_id);
-
-            HAL_CBACK(bt_gatt_callbacks, client->get_characteristic_cb,
-                p_cb->conn_id, status, &p_cb->srvc_id,
-                &char_id, out_char_prop);
-            break;
-        }
-
-        case BTIF_GATTC_GET_NEXT_CHAR:
-        {
-            btgatt_gatt_id_t char_id;
-            btif_to_bta_srvc_id(&in_char_id.srvc_id, &p_cb->srvc_id);
-            btif_to_bta_gatt_id(&in_char_id.char_id, &p_cb->char_id);
-
-            status = BTA_GATTC_GetNextChar(p_cb->conn_id, &in_char_id, NULL,
-                                            &out_char_id, &out_char_prop);
-
-            if (status == 0)
-                bta_to_btif_gatt_id(&char_id, &out_char_id.char_id);
-
-            HAL_CBACK(bt_gatt_callbacks, client->get_characteristic_cb,
-                p_cb->conn_id, status, &p_cb->srvc_id,
-                &char_id, out_char_prop);
-            break;
-        }
-
-        case BTIF_GATTC_GET_FIRST_CHAR_DESCR:
-        {
-            btgatt_gatt_id_t descr_id;
-            btif_to_bta_srvc_id(&in_char_id.srvc_id, &p_cb->srvc_id);
-            btif_to_bta_gatt_id(&in_char_id.char_id, &p_cb->char_id);
-
-            status = BTA_GATTC_GetFirstCharDescr(p_cb->conn_id, &in_char_id, NULL,
-                                                    &out_char_descr_id);
-
-            if (status == 0)
-                bta_to_btif_gatt_id(&descr_id, &out_char_descr_id.descr_id);
-
-            HAL_CBACK(bt_gatt_callbacks, client->get_descriptor_cb,
-                p_cb->conn_id, status, &p_cb->srvc_id,
-                &p_cb->char_id, &descr_id);
-            break;
-        }
-
-        case BTIF_GATTC_GET_NEXT_CHAR_DESCR:
-        {
-            btgatt_gatt_id_t descr_id;
-            btif_to_bta_srvc_id(&in_char_descr_id.char_id.srvc_id, &p_cb->srvc_id);
-            btif_to_bta_gatt_id(&in_char_descr_id.char_id.char_id, &p_cb->char_id);
-            btif_to_bta_gatt_id(&in_char_descr_id.descr_id, &p_cb->descr_id);
-
-            status = BTA_GATTC_GetNextCharDescr(p_cb->conn_id, &in_char_descr_id
-                                        , NULL, &out_char_descr_id);
-
-            if (status == 0)
-                bta_to_btif_gatt_id(&descr_id, &out_char_descr_id.descr_id);
-
-            HAL_CBACK(bt_gatt_callbacks, client->get_descriptor_cb,
-                p_cb->conn_id, status, &p_cb->srvc_id,
-                &p_cb->char_id, &descr_id);
-            break;
-        }
-
-        case BTIF_GATTC_GET_FIRST_INCL_SERVICE:
-        {
-            btgatt_srvc_id_t incl_srvc_id;
-            btif_to_bta_srvc_id(&srvc_id, &p_cb->srvc_id);
-
-            status = BTA_GATTC_GetFirstIncludedService(p_cb->conn_id,
-                        &srvc_id, NULL, &out_incl_svc_id);
-
-            bta_to_btif_srvc_id(&incl_srvc_id, &out_incl_svc_id.incl_svc_id);
-
-            HAL_CBACK(bt_gatt_callbacks, client->get_included_service_cb,
-                p_cb->conn_id, status, &p_cb->srvc_id,
-                &incl_srvc_id);
-            break;
-        }
-
-        case BTIF_GATTC_GET_NEXT_INCL_SERVICE:
-        {
-            btgatt_srvc_id_t incl_srvc_id;
-            btif_to_bta_srvc_id(&in_incl_svc_id.srvc_id, &p_cb->srvc_id);
-            btif_to_bta_srvc_id(&in_incl_svc_id.incl_svc_id, &p_cb->incl_srvc_id);
-
-            status = BTA_GATTC_GetNextIncludedService(p_cb->conn_id,
-                        &in_incl_svc_id, NULL, &out_incl_svc_id);
-
-            bta_to_btif_srvc_id(&incl_srvc_id, &out_incl_svc_id.incl_svc_id);
-
-            HAL_CBACK(bt_gatt_callbacks, client->get_included_service_cb,
-                p_cb->conn_id, status, &p_cb->srvc_id,
-                &incl_srvc_id);
-            break;
-        }
-
         case BTIF_GATTC_GET_GATT_DB:
         {
             btgatt_db_element_t *db = NULL;
@@ -1909,60 +1784,6 @@ static bt_status_t btif_gattc_search_service(int conn_id, bt_uuid_t *filter_uuid
                                  (char*) &btif_cb, sizeof(btif_gattc_cb_t), NULL);
 }
 
-static bt_status_t btif_gattc_get_characteristic( int conn_id
-        , btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *start_char_id)
-{
-    CHECK_BTGATT_INIT();
-    btif_gattc_cb_t btif_cb;
-    btif_cb.conn_id = (uint16_t) conn_id;
-    memcpy(&btif_cb.srvc_id, srvc_id, sizeof(btgatt_srvc_id_t));
-    if (start_char_id)
-    {
-        memcpy(&btif_cb.char_id, start_char_id, sizeof(btgatt_gatt_id_t));
-        return btif_transfer_context(btgattc_handle_event, BTIF_GATTC_GET_NEXT_CHAR,
-                                 (char*) &btif_cb, sizeof(btif_gattc_cb_t), NULL);
-    }
-    return btif_transfer_context(btgattc_handle_event, BTIF_GATTC_GET_FIRST_CHAR,
-                                 (char*) &btif_cb, sizeof(btif_gattc_cb_t), NULL);
-}
-
-static bt_status_t btif_gattc_get_descriptor( int conn_id
-        , btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id
-        , btgatt_gatt_id_t *start_descr_id)
-{
-    CHECK_BTGATT_INIT();
-    btif_gattc_cb_t btif_cb;
-    btif_cb.conn_id = (uint16_t) conn_id;
-    memcpy(&btif_cb.srvc_id, srvc_id, sizeof(btgatt_srvc_id_t));
-    memcpy(&btif_cb.char_id, char_id, sizeof(btgatt_gatt_id_t));
-    if (start_descr_id)
-    {
-        memcpy(&btif_cb.descr_id, start_descr_id, sizeof(btgatt_gatt_id_t));
-        return btif_transfer_context(btgattc_handle_event, BTIF_GATTC_GET_NEXT_CHAR_DESCR,
-                                 (char*) &btif_cb, sizeof(btif_gattc_cb_t), NULL);
-    }
-
-    return btif_transfer_context(btgattc_handle_event, BTIF_GATTC_GET_FIRST_CHAR_DESCR,
-                                 (char*) &btif_cb, sizeof(btif_gattc_cb_t), NULL);
-}
-
-static bt_status_t btif_gattc_get_included_service(int conn_id, btgatt_srvc_id_t *srvc_id,
-                                                   btgatt_srvc_id_t *start_incl_srvc_id)
-{
-    CHECK_BTGATT_INIT();
-    btif_gattc_cb_t btif_cb;
-    btif_cb.conn_id = (uint16_t) conn_id;
-    memcpy(&btif_cb.srvc_id, srvc_id, sizeof(btgatt_srvc_id_t));
-    if (start_incl_srvc_id)
-    {
-        memcpy(&btif_cb.incl_srvc_id, start_incl_srvc_id, sizeof(btgatt_srvc_id_t));
-        return btif_transfer_context(btgattc_handle_event, BTIF_GATTC_GET_NEXT_INCL_SERVICE,
-                                 (char*) &btif_cb, sizeof(btif_gattc_cb_t), NULL);
-    }
-    return btif_transfer_context(btgattc_handle_event, BTIF_GATTC_GET_FIRST_INCL_SERVICE,
-                                 (char*) &btif_cb, sizeof(btif_gattc_cb_t), NULL);
-}
-
 static bt_status_t btif_gattc_get_gatt_db(int conn_id)
 {
     CHECK_BTGATT_INIT();
@@ -2374,9 +2195,6 @@ const btgatt_client_interface_t btgattClientInterface = {
     btif_gattc_listen,
     btif_gattc_refresh,
     btif_gattc_search_service,
-    btif_gattc_get_included_service,
-    btif_gattc_get_characteristic,
-    btif_gattc_get_descriptor,
     btif_gattc_read_char,
     btif_gattc_write_char,
     btif_gattc_read_char_descr,
index c65b369..204a441 100644 (file)
@@ -435,10 +435,6 @@ const btgatt_client_callbacks_t gatt_client_callbacks = {
     ClientConnectCallback,
     ClientDisconnectCallback,
     nullptr, /* search_complete_cb; */
-    nullptr, /* search_result_cb; */
-    nullptr, /* get_characteristic_cb; */
-    nullptr, /* get_descriptor_cb; */
-    nullptr, /* get_included_service_cb; */
     nullptr, /* register_for_notification_cb; */
     nullptr, /* notify_cb; */
     nullptr, /* read_characteristic_cb; */
index b61cff9..107395c 100644 (file)
@@ -130,14 +130,6 @@ void SearchCompleteCallback(int conn_id, int status) {
     SearchCompleteCallback(g_interface, conn_id, status));
 }
 
-void SearchResultCallback(int conn_id, btgatt_srvc_id_t *srvc_id) {
-  shared_lock<shared_timed_mutex> lock(g_instance_lock);
-  VERIFY_INTERFACE_OR_RETURN();
-
-  VLOG(2) << __func__ << " - conn_id: " << conn_id;
-  // do not propagate this event, will do service discovery with new HAL call
-}
-
 void RegisterForNotificationCallback(int conn_id, int registered, int status,
                                       btgatt_srvc_id_t *srvc_id,
                                       btgatt_gatt_id_t *char_id) {
@@ -451,10 +443,6 @@ const btgatt_client_callbacks_t gatt_client_callbacks = {
     ConnectCallback,
     DisconnectCallback,
     SearchCompleteCallback,
-    SearchResultCallback,
-    nullptr,  // get_characteristic_cb
-    nullptr,  // get_descriptor_cb
-    nullptr,  // get_included_service_cb
     RegisterForNotificationCallback,
     NotifyCallback,
     nullptr,  // read_characteristic_cb
index 4b70e8d..d16cda2 100644 (file)
@@ -181,9 +181,6 @@ btgatt_client_interface_t fake_btgattc_iface = {
   nullptr,  // listen
   nullptr,  // refresh
   nullptr,  // search_service
-  nullptr,  // get_included_service
-  nullptr,  // get_characteristic
-  nullptr,  // get_descriptor
   nullptr,  // read_characteristic
   nullptr,  // write_characteristic
   nullptr,  // read_descriptor