]> granicus.if.org Git - esp-idf/commitdiff
Component/bt: add attr_handle for ESP_GATTS_CONF_EVT
authorzhiweijian <zhiweijian@espressif.com>
Tue, 16 Oct 2018 06:38:49 +0000 (14:38 +0800)
committerbot <bot@espressif.com>
Fri, 19 Oct 2018 08:19:36 +0000 (08:19 +0000)
components/bt/bluedroid/api/include/api/esp_gattc_api.h
components/bt/bluedroid/api/include/api/esp_gatts_api.h
components/bt/bluedroid/bta/gatt/bta_gatts_act.c
components/bt/bluedroid/bta/include/bta/bta_gatt_api.h
components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c
examples/bluetooth/gatt_server/main/gatts_demo.c
examples/bluetooth/gatt_server_service_table/main/gatts_table_creat_demo.c

index f4a36de687a28990633a6b1ba2a98e944bed2bdb..b494bcfd39883da1f6171f381b5a01f1aecbd2dd 100644 (file)
@@ -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.
index 3a5ad9eaa95c3edfbd7721a6cabad147df9c9c21..97296b1c7a85dfee851c4fabc5fe835565e0b5a0 100644 (file)
@@ -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) */
index e7c50c4eab7b8ad8972de08f47fa91e8ba981c41..a7d2ff128d62fe5a42af1586f1e5dce05c0e872e 100644 (file)
@@ -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){
index 0bfbf669366ce50ff931eb817d53a680245d2e04..5048511c4255e1540d4425c71dbd7323dbcab633 100644 (file)
@@ -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;
index b4ed4fa334ef7da01715becf15878cde58d8bcc2..69a7c90599ef164ebb479110ae2f193a05864d28 100644 (file)
@@ -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;
index 8c1d529823480887776bfea06cbc141317f6eae8..f650ee6bea4e08b3458f2e8ae13d1a94d0380015 100644 (file)
@@ -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);
         }
index 530530c4968346b695e884224463fef35cd9cc92..c2a944e105db034e7299fb7ff846737b3188996c 100644 (file)
@@ -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);