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;
|
||||
}
|
||||
|
||||
event = p_clcb->p_q_cmd->api_read.cmpl_evt;
|
||||
if (p_clcb->p_q_cmd->hdr.event != BTA_GATTC_API_READ_MULTI_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;
|
||||
osi_free(p_clcb->p_q_cmd);
|
||||
p_clcb->p_q_cmd = NULL;
|
||||
@ -1348,22 +1352,23 @@ void bta_gattc_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
APPL_TRACE_ERROR("No pending command");
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
mapped_op = p_clcb->p_q_cmd->hdr.event - BTA_GATTC_API_READ_EVT + GATTC_OPTYPE_READ;
|
||||
if ( mapped_op > GATTC_OPTYPE_INDICATION) {
|
||||
mapped_op = 0;
|
||||
}
|
||||
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_API_READ_MULTI_EVT) {
|
||||
mapped_op = p_clcb->p_q_cmd->hdr.event - BTA_GATTC_API_READ_EVT + GATTC_OPTYPE_READ;
|
||||
if ( mapped_op > GATTC_OPTYPE_INDICATION) {
|
||||
mapped_op = 0;
|
||||
}
|
||||
|
||||
#if (BT_TRACE_VERBOSE == TRUE)
|
||||
APPL_TRACE_ERROR("expect op:(%s :0x%04x), receive unexpected operation (%s).",
|
||||
bta_gattc_op_code_name[mapped_op] , p_clcb->p_q_cmd->hdr.event,
|
||||
bta_gattc_op_code_name[op]);
|
||||
APPL_TRACE_ERROR("expect op:(%s :0x%04x), receive unexpected operation (%s).",
|
||||
bta_gattc_op_code_name[mapped_op] , p_clcb->p_q_cmd->hdr.event,
|
||||
bta_gattc_op_code_name[op]);
|
||||
#else
|
||||
APPL_TRACE_ERROR("expect op:(%u :0x%04x), receive unexpected operation (%u).",
|
||||
mapped_op , p_clcb->p_q_cmd->hdr.event, op);
|
||||
APPL_TRACE_ERROR("expect op:(%u :0x%04x), receive unexpected operation (%u).",
|
||||
mapped_op , p_clcb->p_q_cmd->hdr.event, op);
|
||||
#endif
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* discard responses if service change indication is received before operation completed */
|
||||
|
@ -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
|
||||
switch (msg->act) {
|
||||
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) {
|
||||
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);
|
||||
@ -151,7 +152,8 @@ static void btc_gattc_free_req_data(btc_msg_t *msg)
|
||||
tBTA_GATTC *arg = (tBTA_GATTC *)(msg->arg);
|
||||
switch (msg->act) {
|
||||
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) {
|
||||
osi_free(arg->read.p_value);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user