From 7617a3c43407f757b88091711bc9bc1e52e0ae62 Mon Sep 17 00:00:00 2001 From: Yulong Date: Wed, 11 Oct 2017 07:47:12 -0400 Subject: [PATCH 1/2] component/bt: Fix the bug cann't use esp_ble_gatts_get_attr_value to get the attribute value after long write. --- components/bt/bluedroid/stack/gatt/gatt_sr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/bt/bluedroid/stack/gatt/gatt_sr.c b/components/bt/bluedroid/stack/gatt/gatt_sr.c index 08591334f..972b17e23 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_sr.c +++ b/components/bt/bluedroid/stack/gatt/gatt_sr.c @@ -422,6 +422,8 @@ void gatt_process_exec_write_req (tGATT_TCB *p_tcb, UINT8 op_code, UINT16 len, U if((queue_data->p_attr->p_value != NULL) && (queue_data->p_attr->p_value->attr_val.attr_val != NULL)){ memcpy(queue_data->p_attr->p_value->attr_val.attr_val+queue_data->offset, queue_data->value, queue_data->len); } + //don't forget to increase the attribute value length in the gatts database. + queue_data->p_attr->p_value->attr_val.attr_len += queue_data->len; } osi_free(queue_data); } From 4b1968f3156b515e7f118b5b1ff012a4875f18dd Mon Sep 17 00:00:00 2001 From: Yulong Date: Mon, 16 Oct 2017 03:42:49 -0400 Subject: [PATCH 2/2] component/bt: Change the queue_data->p_attr->p_value->attr_val.attr_len += queue_data->len code to the if case. --- components/bt/bluedroid/stack/gatt/gatt_sr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bt/bluedroid/stack/gatt/gatt_sr.c b/components/bt/bluedroid/stack/gatt/gatt_sr.c index 972b17e23..cbfb3e492 100644 --- a/components/bt/bluedroid/stack/gatt/gatt_sr.c +++ b/components/bt/bluedroid/stack/gatt/gatt_sr.c @@ -421,9 +421,9 @@ void gatt_process_exec_write_req (tGATT_TCB *p_tcb, UINT8 op_code, UINT16 len, U if (is_prepare_write_valid){ if((queue_data->p_attr->p_value != NULL) && (queue_data->p_attr->p_value->attr_val.attr_val != NULL)){ memcpy(queue_data->p_attr->p_value->attr_val.attr_val+queue_data->offset, queue_data->value, queue_data->len); + //don't forget to increase the attribute value length in the gatts database. + queue_data->p_attr->p_value->attr_val.attr_len += queue_data->len; } - //don't forget to increase the attribute value length in the gatts database. - queue_data->p_attr->p_value->attr_val.attr_len += queue_data->len; } osi_free(queue_data); }