Merge branch 'bugfix/btdm_fix_service_change_event_param_error' into 'master'

Component/bt: fix service change event params error

See merge request idf/esp-idf!2150

(cherry picked from commit b26ab188af)

f5d58142 Component/bt: fix service change event params error
This commit is contained in:
Jiang Jiang Jian 2018-03-30 14:57:13 +08:00
parent a1cc202b70
commit a80e687f8c
3 changed files with 20 additions and 12 deletions

View file

@ -1837,7 +1837,10 @@ BOOLEAN bta_gattc_process_srvc_chg_ind(UINT16 conn_id,
}
/* notify applicationf or service change */
if (p_clrcb->p_cback != NULL) {
(* p_clrcb->p_cback)(BTA_GATTC_SRVC_CHG_EVT, (tBTA_GATTC *)p_srcb->server_bda);
tBTA_GATTC_SERVICE_CHANGE srvc_chg= {0};
memcpy(srvc_chg.remote_bda, p_srcb->server_bda, sizeof(BD_ADDR));
srvc_chg.conn_id = conn_id;
(* p_clrcb->p_cback)(BTA_GATTC_SRVC_CHG_EVT, (tBTA_GATTC *)&srvc_chg);
}
}

View file

@ -387,27 +387,30 @@ typedef struct {
BD_ADDR remote_bda;
} tBTA_GATTC_DISCONNECT;
typedef struct {
UINT16 conn_id;
BD_ADDR remote_bda;
} tBTA_GATTC_SERVICE_CHANGE;
typedef union {
tBTA_GATT_STATUS status;
tBTA_GATTC_SEARCH_CMPL search_cmpl; /* discovery complete */
tBTA_GATTC_SRVC_RES srvc_res; /* discovery result */
tBTA_GATTC_REG reg_oper; /* registration data */
tBTA_GATTC_SEARCH_CMPL search_cmpl; /* discovery complete */
tBTA_GATTC_SRVC_RES srvc_res; /* discovery result */
tBTA_GATTC_REG reg_oper; /* registration data */
tBTA_GATTC_OPEN open;
tBTA_GATTC_CONNECT connect;
tBTA_GATTC_CLOSE close;
tBTA_GATTC_DISCONNECT disconnect;
tBTA_GATTC_READ read; /* read attribute/descriptor data */
tBTA_GATTC_WRITE write; /* write complete data */
tBTA_GATTC_EXEC_CMPL exec_cmpl; /* execute complete */
tBTA_GATTC_NOTIFY notify; /* notification/indication event data */
tBTA_GATTC_READ read; /* read attribute/descriptor data */
tBTA_GATTC_WRITE write; /* write complete data */
tBTA_GATTC_EXEC_CMPL exec_cmpl; /* execute complete */
tBTA_GATTC_NOTIFY notify; /* notification/indication event data */
tBTA_GATTC_ENC_CMPL_CB enc_cmpl;
BD_ADDR remote_bda; /* service change event */
tBTA_GATTC_CFG_MTU cfg_mtu; /* configure MTU operation */
tBTA_GATTC_CONGEST congest;
tBTA_GATTC_QUEUE_FULL queue_full;
tBTA_GATTC_SERVICE_CHANGE srvc_chg; /* service change event */
} tBTA_GATTC;
/* GATTC enable callback function */

View file

@ -914,8 +914,10 @@ void btc_gattc_cb_handler(btc_msg_t *msg)
break;
}
case BTA_GATTC_SRVC_CHG_EVT: {
memcpy(param.srvc_chg.remote_bda, arg->remote_bda, sizeof(esp_bd_addr_t));
btc_gattc_cb_to_app(ESP_GATTC_SRVC_CHG_EVT, ESP_GATT_IF_NONE, &param);
tBTA_GATTC_SERVICE_CHANGE *srvc_change = &arg->srvc_chg;
gattc_if = BTC_GATT_GET_GATT_IF(srvc_change->conn_id);
memcpy(param.srvc_chg.remote_bda, srvc_change->remote_bda, sizeof(esp_bd_addr_t));
btc_gattc_cb_to_app(ESP_GATTC_SRVC_CHG_EVT, gattc_if, &param);
break;
}
case BTA_GATTC_QUEUE_FULL_EVT: {