We were not properly propagating errors returned by applications.
---
android/gatt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/android/gatt.c b/android/gatt.c
index e24feb7..18a5092 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5544,6 +5544,7 @@ static void handle_server_send_response(const void *buf, uint16_t len)
* gatt_db_attribute_write().
*/
req = queue_peek_head(conn->device->pending_requests);
+ req->error = err_to_att(cmd->status);
req->state = REQUEST_DONE;
/*
--
1.9.1
Hi Jakub,
On Wednesday 10 of December 2014 13:40:49 Jakub Tyszkowski wrote:
> We were not properly propagating errors returned by applications.
> ---
> android/gatt.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/android/gatt.c b/android/gatt.c
> index e24feb7..18a5092 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -5544,6 +5544,7 @@ static void handle_server_send_response(const void
> *buf, uint16_t len) * gatt_db_attribute_write().
> */
> req = queue_peek_head(conn->device->pending_requests);
> + req->error = err_to_att(cmd->status);
> req->state = REQUEST_DONE;
>
> /*
All patches applied (after fixing typo in last commit message), thanks.
--
BR
Szymon Janc
---
android/pts-gatt.txt | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/android/pts-gatt.txt b/android/pts-gatt.txt
index 43e1c8a..d1cf981 100644
--- a/android/pts-gatt.txt
+++ b/android/pts-gatt.txt
@@ -783,7 +783,7 @@ TC_GAW_SR_BI_06_C PASS haltest:
<properties> 10 <permissions> 17
gatts start_service
gatts send_response: <status> 12
-TC_GAW_SR_BV_05_C FAIL haltest:
+TC_GAW_SR_BV_05_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
@@ -793,18 +793,18 @@ TC_GAW_SR_BV_05_C FAIL haltest:
repeat with correct offset
gatts send_response:
repeat with correct value
-TC_GAW_SR_BI_07_C FAIL haltest:
+TC_GAW_SR_BI_07_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
gatts start_service
gatts send_response
-TC_GAW_SR_BI_08_C FAIL haltest:
+TC_GAW_SR_BI_08_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 2 <permissions> 1
gatts start_service
-TC_GAW_SR_BI_09_C FAIL haltest:
+TC_GAW_SR_BI_09_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
@@ -813,7 +813,7 @@ TC_GAW_SR_BI_09_C FAIL haltest:
<data> value greater than MTU
repeat with correct offset
gatts send_response: <status> 7
-TC_GAW_SR_BI_11_C FAIL haltest:
+TC_GAW_SR_BI_11_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
@@ -822,7 +822,7 @@ TC_GAW_SR_BI_11_C FAIL haltest:
<data> value greater than MTU
repeat with correct offset
gatts send_response: <status> 8
-TC_GAW_SR_BI_12_C FAIL haltest:
+TC_GAW_SR_BI_12_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
@@ -831,7 +831,7 @@ TC_GAW_SR_BI_12_C FAIL haltest:
<data> value greater than MTU
repeat with correct offset
gatts send_response: <status> 5
-TC_GAW_SR_BI_13_C FAIL haltest:
+TC_GAW_SR_BI_13_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
@@ -840,14 +840,14 @@ TC_GAW_SR_BI_13_C FAIL haltest:
<data> value greater than MTU
repeat with correct offset
gatts send_response: <status> 12
-TC_GAW_SR_BV_06_C FAIL haltest:
+TC_GAW_SR_BV_06_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
gatts start_service
gatts send_response:
repeat with correct value
-TC_GAW_SR_BV_10_C FAIL haltest:
+TC_GAW_SR_BV_10_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
@@ -857,37 +857,37 @@ TC_GAW_SR_BV_10_C FAIL haltest:
repeat with correct offset
gatts send_response:
repeat with correct value
-TC_GAW_SR_BI_14_C FAIL haltest:
+TC_GAW_SR_BI_14_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
gatts start_service
gatts send_response: <status> 1
-TC_GAW_SR_BI_15_C FAIL haltest:
+TC_GAW_SR_BI_15_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
gatts start_service
gatts send_response: <status> 3
-TC_GAW_SR_BI_17_C FAIL haltest:
+TC_GAW_SR_BI_17_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
gatts start_service
gatts send_response: <status> 8
-TC_GAW_SR_BI_18_C FAIL haltest:
+TC_GAW_SR_BI_18_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
gatts start_service
gatts send_response: <status> 5
-TC_GAW_SR_BI_19_C FAIL haltest:
+TC_GAW_SR_BI_19_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
gatts start_service
gatts send_response: <status> 12
-TC_GAW_SR_BV_07_C FAIL haltest:
+TC_GAW_SR_BV_07_C PASS haltest:
gatts add_service
gatts add_characteristic:
<properties> 10 <permissions> 17
--
1.9.1
Those statuses or errors are of type int and and we need to crop
them to att's range. This fixes potential issues when user app sends
status that is equal or greater than GATT_FAILURE.
---
android/gatt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/android/gatt.c b/android/gatt.c
index 18a5092..b2ce9c1 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5556,12 +5556,12 @@ static void handle_server_send_response(const void *buf, uint16_t len)
if (transaction->opcode < ATT_OP_WRITE_REQ)
gatt_db_attribute_read_result(transaction->attrib,
transaction->serial_id,
- cmd->status,
+ err_to_att(cmd->status),
cmd->data, cmd->len);
else
gatt_db_attribute_write_result(transaction->attrib,
transaction->serial_id,
- cmd->status);
+ err_to_att(cmd->status));
send_dev_complete_response(conn->device, transaction->opcode);
--
1.9.1