esp_gatt_status_t status; /*!< Operation status */
uint16_t conn_id; /*!< Connection id */
uint16_t handle; /*!< The Characteristic or descriptor handle */
+ uint16_t offset; /*!< The prepare write offset, this value is valid only when prepare write */
} write; /*!< Gatt client callback param of ESP_GATTC_WRITE_DESCR_EVT */
/**
if (p_clcb->p_q_cmd == NULL) {
p_clcb->p_q_cmd = p_data;
return TRUE;
- } else if (p_data->hdr.event == BTA_GATTC_API_WRITE_EVT &&
- p_data->api_write.write_type == BTA_GATTC_WRITE_PREPARE &&
- p_data->api_write.handle == p_clcb->p_q_cmd->api_write.handle &&
- bta_gattc_has_prepare_command_in_queue(p_clcb)) {
+ } else if ((p_data->hdr.event == BTA_GATTC_API_WRITE_EVT &&
+ p_data->api_write.write_type == BTA_GATTC_WRITE_PREPARE) &&
+ ((p_clcb->p_q_cmd->hdr.event == BTA_GATTC_API_WRITE_EVT &&
+ p_clcb->p_q_cmd->api_write.write_type == BTA_GATTC_WRITE_PREPARE) ||
+ bta_gattc_has_prepare_command_in_queue(p_clcb))) {
+ APPL_TRACE_DEBUG("%s(), prepare offset = %d", __func__, p_data->api_write.offset);
cb_data.write.status = BTA_GATT_CONGESTED;
cb_data.write.handle = p_data->api_write.handle;
cb_data.write.conn_id = p_clcb->bta_conn_id;
+ cb_data.write.offset = p_data->api_write.offset;
/* write complete, callback */
if (p_clcb->p_rcb->p_cback != NULL) {
( *p_clcb->p_rcb->p_cback)(BTA_GATTC_PREP_WRITE_EVT, (tBTA_GATTC *)&cb_data);
param.write.conn_id = BTC_GATT_GET_CONN_ID(write->conn_id);
param.write.status = write->status;
param.write.handle = write->handle;
+ param.write.offset = write->offset;
btc_gattc_cb_to_app(ret_evt, gattc_if, ¶m);
break;
}