diff --git a/components/bt/bluedroid/api/include/api/esp_gattc_api.h b/components/bt/bluedroid/api/include/api/esp_gattc_api.h index f4a36de687..b494bcfd39 100644 --- a/components/bt/bluedroid/api/include/api/esp_gattc_api.h +++ b/components/bt/bluedroid/api/include/api/esp_gattc_api.h @@ -347,7 +347,8 @@ esp_err_t esp_ble_gattc_send_mtu_req (esp_gatt_if_t gattc_if, uint16_t conn_id); /** - * @brief This function is called to request a GATT service discovery + * @brief This function is called to get service from local cache. + * If it does not exist, request a GATT service discovery * on a GATT server. This function report service search result * by a callback event, and followed by a service search complete * event. diff --git a/components/bt/bluedroid/api/include/api/esp_gatts_api.h b/components/bt/bluedroid/api/include/api/esp_gatts_api.h index 3a5ad9eaa9..97296b1c7a 100644 --- a/components/bt/bluedroid/api/include/api/esp_gatts_api.h +++ b/components/bt/bluedroid/api/include/api/esp_gatts_api.h @@ -120,6 +120,7 @@ typedef union { struct gatts_conf_evt_param { esp_gatt_status_t status; /*!< Operation status */ uint16_t conn_id; /*!< Connection id */ + uint16_t handle; /*!< attribute handle */ uint16_t len; /*!< The indication or notification value length, len is valid when send notification or indication failed */ uint8_t *value; /*!< The indication or notification value , value is valid when send notification or indication failed */ } conf; /*!< Gatt server callback param of ESP_GATTS_CONF_EVT (confirm) */ diff --git a/components/bt/bluedroid/bta/gatt/bta_gatts_act.c b/components/bt/bluedroid/bta/gatt/bta_gatts_act.c index e7c50c4eab..a7d2ff128d 100644 --- a/components/bt/bluedroid/bta/gatt/bta_gatts_act.c +++ b/components/bt/bluedroid/bta/gatt/bta_gatts_act.c @@ -691,6 +691,7 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg) p_rcb && p_cb->rcb[p_srvc_cb->rcb_idx].p_cback) { cb_data.req_data.status = status; cb_data.req_data.conn_id = p_msg->api_indicate.hdr.layer_specific; + cb_data.req_data.handle = p_msg->api_indicate.attr_id; cb_data.req_data.value = (uint8_t *)osi_malloc(p_msg->api_indicate.len); if (cb_data.req_data.value != NULL){ diff --git a/components/bt/bluedroid/bta/include/bta/bta_gatt_api.h b/components/bt/bluedroid/bta/include/bta/bta_gatt_api.h index 0bfbf66936..5048511c42 100644 --- a/components/bt/bluedroid/bta/include/bta/bta_gatt_api.h +++ b/components/bt/bluedroid/bta/include/bta/bta_gatt_api.h @@ -555,6 +555,7 @@ typedef struct { BD_ADDR remote_bda; UINT32 trans_id; UINT16 conn_id; + UINT16 handle; tBTA_GATTS_REQ_DATA *p_data; UINT16 data_len; UINT8 *value; diff --git a/components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c b/components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c index b4ed4fa334..69a7c90599 100644 --- a/components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c +++ b/components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c @@ -802,6 +802,7 @@ void btc_gatts_cb_handler(btc_msg_t *msg) gatts_if = BTC_GATT_GET_GATT_IF(p_data->req_data.conn_id); param.conf.conn_id = BTC_GATT_GET_CONN_ID(p_data->req_data.conn_id); param.conf.status = p_data->req_data.status; + param.conf.handle = p_data->req_data.handle; if (p_data->req_data.status != ESP_GATT_OK && p_data->req_data.value){ param.conf.len = p_data->req_data.data_len; diff --git a/examples/bluetooth/gatt_server/main/gatts_demo.c b/examples/bluetooth/gatt_server/main/gatts_demo.c index 8c1d529823..f650ee6bea 100644 --- a/examples/bluetooth/gatt_server/main/gatts_demo.c +++ b/examples/bluetooth/gatt_server/main/gatts_demo.c @@ -485,7 +485,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i esp_ble_gap_start_advertising(&adv_params); break; case ESP_GATTS_CONF_EVT: - ESP_LOGI(GATTS_TAG, "ESP_GATTS_CONF_EVT, status %d", param->conf.status); + ESP_LOGI(GATTS_TAG, "ESP_GATTS_CONF_EVT, status %d attr_handle %d", param->conf.status, param->conf.handle); if (param->conf.status != ESP_GATT_OK){ esp_log_buffer_hex(GATTS_TAG, param->conf.value, param->conf.len); } @@ -628,7 +628,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i gl_profile_tab[PROFILE_B_APP_ID].conn_id = param->connect.conn_id; break; case ESP_GATTS_CONF_EVT: - ESP_LOGI(GATTS_TAG, "ESP_GATTS_CONF_EVT status %d", param->conf.status); + ESP_LOGI(GATTS_TAG, "ESP_GATTS_CONF_EVT status %d attr_handle %d", param->conf.status, param->conf.handle); if (param->conf.status != ESP_GATT_OK){ esp_log_buffer_hex(GATTS_TAG, param->conf.value, param->conf.len); } diff --git a/examples/bluetooth/gatt_server_service_table/main/gatts_table_creat_demo.c b/examples/bluetooth/gatt_server_service_table/main/gatts_table_creat_demo.c index 530530c496..c2a944e105 100644 --- a/examples/bluetooth/gatt_server_service_table/main/gatts_table_creat_demo.c +++ b/examples/bluetooth/gatt_server_service_table/main/gatts_table_creat_demo.c @@ -433,7 +433,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_ ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_MTU_EVT, MTU %d", param->mtu.mtu); break; case ESP_GATTS_CONF_EVT: - ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_CONF_EVT, status = %d", param->conf.status); + ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_CONF_EVT, status = %d, attr_handle %d", param->conf.status, param->conf.handle); break; case ESP_GATTS_START_EVT: ESP_LOGI(GATTS_TABLE_TAG, "SERVICE_START_EVT, status %d, service_handle %d", param->start.status, param->start.service_handle);