mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt: Change the cmpl_evt command in the bta_gattc_read_cmpl function.
This commit is contained in:
parent
e815660824
commit
f325ba3942
@ -1227,7 +1227,11 @@ void bta_gattc_read_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_OP_CMPL *p_data)
|
|||||||
cb_data.read.handle = p_clcb->p_q_cmd->api_read.handle;
|
cb_data.read.handle = p_clcb->p_q_cmd->api_read.handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p_clcb->p_q_cmd->hdr.event != BTA_GATTC_API_READ_MULTI_EVT) {
|
||||||
event = p_clcb->p_q_cmd->api_read.cmpl_evt;
|
event = p_clcb->p_q_cmd->api_read.cmpl_evt;
|
||||||
|
} else {
|
||||||
|
event = p_clcb->p_q_cmd->api_read_multi.cmpl_evt;
|
||||||
|
}
|
||||||
cb_data.read.conn_id = p_clcb->bta_conn_id;
|
cb_data.read.conn_id = p_clcb->bta_conn_id;
|
||||||
osi_free(p_clcb->p_q_cmd);
|
osi_free(p_clcb->p_q_cmd);
|
||||||
p_clcb->p_q_cmd = NULL;
|
p_clcb->p_q_cmd = NULL;
|
||||||
@ -1348,8 +1352,8 @@ void bta_gattc_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
|||||||
APPL_TRACE_ERROR("No pending command");
|
APPL_TRACE_ERROR("No pending command");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (p_clcb->p_q_cmd->hdr.event != bta_gattc_opcode_to_int_evt[op - GATTC_OPTYPE_READ] ||
|
if (p_clcb->p_q_cmd->hdr.event != bta_gattc_opcode_to_int_evt[op - GATTC_OPTYPE_READ]) {
|
||||||
p_clcb->p_q_cmd->hdr.event != BTA_GATTC_API_READ_MULTI_EVT) {
|
if (p_clcb->p_q_cmd->hdr.event != BTA_GATTC_API_READ_MULTI_EVT) {
|
||||||
mapped_op = p_clcb->p_q_cmd->hdr.event - BTA_GATTC_API_READ_EVT + GATTC_OPTYPE_READ;
|
mapped_op = p_clcb->p_q_cmd->hdr.event - BTA_GATTC_API_READ_EVT + GATTC_OPTYPE_READ;
|
||||||
if ( mapped_op > GATTC_OPTYPE_INDICATION) {
|
if ( mapped_op > GATTC_OPTYPE_INDICATION) {
|
||||||
mapped_op = 0;
|
mapped_op = 0;
|
||||||
@ -1365,6 +1369,7 @@ void bta_gattc_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
|||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* discard responses if service change indication is received before operation completed */
|
/* discard responses if service change indication is received before operation completed */
|
||||||
if (p_clcb->auto_update == BTA_GATTC_DISC_WAITING && p_clcb->p_srcb->srvc_hdl_chg) {
|
if (p_clcb->auto_update == BTA_GATTC_DISC_WAITING && p_clcb->p_srcb->srvc_hdl_chg) {
|
||||||
|
@ -128,7 +128,8 @@ static void btc_gattc_copy_req_data(btc_msg_t *msg, void *p_dest, void *p_src)
|
|||||||
// Allocate buffer for request data if necessary
|
// Allocate buffer for request data if necessary
|
||||||
switch (msg->act) {
|
switch (msg->act) {
|
||||||
case BTA_GATTC_READ_DESCR_EVT:
|
case BTA_GATTC_READ_DESCR_EVT:
|
||||||
case BTA_GATTC_READ_CHAR_EVT: {
|
case BTA_GATTC_READ_CHAR_EVT:
|
||||||
|
case BTA_GATTC_READ_MUTIPLE_EVT: {
|
||||||
if (p_src_data->read.p_value && p_src_data->read.p_value->p_value) {
|
if (p_src_data->read.p_value && p_src_data->read.p_value->p_value) {
|
||||||
p_dest_data->read.p_value = (tBTA_GATT_UNFMT *)osi_malloc(sizeof(tBTA_GATT_UNFMT) + p_src_data->read.p_value->len);
|
p_dest_data->read.p_value = (tBTA_GATT_UNFMT *)osi_malloc(sizeof(tBTA_GATT_UNFMT) + p_src_data->read.p_value->len);
|
||||||
p_dest_data->read.p_value->p_value = (uint8_t *)(p_dest_data->read.p_value + 1);
|
p_dest_data->read.p_value->p_value = (uint8_t *)(p_dest_data->read.p_value + 1);
|
||||||
@ -151,7 +152,8 @@ static void btc_gattc_free_req_data(btc_msg_t *msg)
|
|||||||
tBTA_GATTC *arg = (tBTA_GATTC *)(msg->arg);
|
tBTA_GATTC *arg = (tBTA_GATTC *)(msg->arg);
|
||||||
switch (msg->act) {
|
switch (msg->act) {
|
||||||
case BTA_GATTC_READ_DESCR_EVT:
|
case BTA_GATTC_READ_DESCR_EVT:
|
||||||
case BTA_GATTC_READ_CHAR_EVT: {
|
case BTA_GATTC_READ_CHAR_EVT:
|
||||||
|
case BTA_GATTC_READ_MUTIPLE_EVT: {
|
||||||
if (arg->read.p_value) {
|
if (arg->read.p_value) {
|
||||||
osi_free(arg->read.p_value);
|
osi_free(arg->read.p_value);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user