From 7bd8133639dfe25f1981a1441851a44b21fbca3d Mon Sep 17 00:00:00 2001 From: island Date: Thu, 16 Nov 2017 16:40:18 +0800 Subject: [PATCH] component/bt: delete api bta_gattc_cache_write --- .../bt/bluedroid/bta/gatt/bta_gattc_cache.c | 50 +------------------ 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/components/bt/bluedroid/bta/gatt/bta_gattc_cache.c b/components/bt/bluedroid/bta/gatt/bta_gattc_cache.c index 230f511ff2..f6fe9f1a8f 100644 --- a/components/bt/bluedroid/bta/gatt/bta_gattc_cache.c +++ b/components/bt/bluedroid/bta/gatt/bta_gattc_cache.c @@ -43,7 +43,6 @@ #define LOG_TAG "bt_bta_gattc" // #include "osi/include/log.h" -static void bta_gattc_cache_write(BD_ADDR server_bda, UINT16 num_attr, tBTA_GATTC_NV_ATTR *attr); static void bta_gattc_char_dscpt_disc_cmpl(UINT16 conn_id, tBTA_GATTC_SERV *p_srvc_cb); extern void bta_to_btif_uuid(bt_uuid_t *p_dest, tBT_UUID *p_src); static size_t bta_gattc_get_db_size_with_type(list_t *services, @@ -1967,8 +1966,7 @@ void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id) } } - /* Gattc cache write/read will be supported in IDF 3.1, so comment it temporarily*/ - //bta_gattc_cache_write(p_srvc_cb->server_bda, db_size, nv_attr); + /* TODO: Gattc cache write/read need to be added in IDF 3.1*/ osi_free(nv_attr); } @@ -2037,52 +2035,6 @@ done: return success; } -/******************************************************************************* -** -** Function bta_gattc_cache_write -** -** Description This callout function is executed by GATT when a server cache -** is available to save. -** -** Parameter server_bda: server bd address of this cache belongs to -** num_attr: number of attribute to be save. -** attr: pointer to the list of attributes to save. -** Returns -** -*******************************************************************************/ -static void bta_gattc_cache_write(BD_ADDR server_bda, UINT16 num_attr, - tBTA_GATTC_NV_ATTR *attr) -{ - char fname[255] = {0}; - bta_gattc_generate_cache_file_name(fname, server_bda); - FILE *fd = fopen(fname, "wb"); - if (!fd) { - APPL_TRACE_ERROR("%s: can't open GATT cache file for writing: %s", __func__, fname); - return; - } - - UINT16 cache_ver = GATT_CACHE_VERSION; - if (fwrite(&cache_ver, sizeof(UINT16), 1, fd) != 1) { - APPL_TRACE_DEBUG("%s: can't write GATT cache version: %s", __func__, fname); - fclose(fd); - return; - } - - if (fwrite(&num_attr, sizeof(UINT16), 1, fd) != 1) { - APPL_TRACE_DEBUG("%s: can't write GATT cache attribute count: %s", __func__, fname); - fclose(fd); - return; - } - - if (fwrite(attr, sizeof(tBTA_GATTC_NV_ATTR), num_attr, fd) != num_attr) { - APPL_TRACE_DEBUG("%s: can't write GATT cache attributes: %s", __func__, fname); - fclose(fd); - return; - } - - fclose(fd); -} - /******************************************************************************* ** ** Function bta_gattc_cache_reset