You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2020/01/07 11:18:12 UTC
[mynewt-nimble] 05/14: apps/bttester: Fix error handling when doing
GATT Discovery
This is an automated email from the ASF dual-hosted git repository.
naraj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 3eb61786c28786b5572fb6b8a72a5b31f7ea8a33
Author: MichaĆ Narajowski <mi...@codecoup.pl>
AuthorDate: Fri Oct 18 15:58:34 2019 +0200
apps/bttester: Fix error handling when doing GATT Discovery
Previously we would respond to the BTP Tester with a
list of attributes that were discovered before receiving an error.
Now we just respond with a failure if we receive an error.
---
apps/bttester/src/gatt.c | 38 +++++++++++++++++++++++++++++++++-----
1 file changed, 33 insertions(+), 5 deletions(-)
diff --git a/apps/bttester/src/gatt.c b/apps/bttester/src/gatt.c
index 6f2cdc5..9a58194 100644
--- a/apps/bttester/src/gatt.c
+++ b/apps/bttester/src/gatt.c
@@ -1038,9 +1038,16 @@ static int disc_prim_uuid_cb(uint16_t conn_handle,
SYS_LOG_DBG("");
- if (error->status != 0) {
+ if (error->status != 0 && error->status != BLE_HS_EDONE) {
+ tester_rsp(BTP_SERVICE_ID_GATT, opcode,
+ CONTROLLER_INDEX, BTP_STATUS_FAILED);
+ discover_destroy();
+ return 0;
+ }
+
+ if (error->status == BLE_HS_EDONE) {
tester_send(BTP_SERVICE_ID_GATT, opcode,
- CONTROLLER_INDEX, gatt_buf.buf, gatt_buf.len);
+ CONTROLLER_INDEX, gatt_buf.buf, gatt_buf.len);
discover_destroy();
return 0;
}
@@ -1086,7 +1093,14 @@ static int disc_all_desc_cb(uint16_t conn_handle,
SYS_LOG_DBG("");
- if (error->status != 0) {
+ if (error->status != 0 && error->status != BLE_HS_EDONE) {
+ tester_rsp(BTP_SERVICE_ID_GATT, GATT_DISC_ALL_DESC,
+ CONTROLLER_INDEX, BTP_STATUS_FAILED);
+ discover_destroy();
+ return 0;
+ }
+
+ if (error->status == BLE_HS_EDONE) {
tester_send(BTP_SERVICE_ID_GATT, GATT_DISC_ALL_DESC,
CONTROLLER_INDEX, gatt_buf.buf, gatt_buf.len);
discover_destroy();
@@ -1198,7 +1212,14 @@ static int find_included_cb(uint16_t conn_handle,
SYS_LOG_DBG("");
- if (error->status != 0) {
+ if (error->status != 0 && error->status != BLE_HS_EDONE) {
+ tester_rsp(BTP_SERVICE_ID_GATT, GATT_FIND_INCLUDED,
+ CONTROLLER_INDEX, BTP_STATUS_FAILED);
+ discover_destroy();
+ return 0;
+ }
+
+ if (error->status == BLE_HS_EDONE) {
tester_send(BTP_SERVICE_ID_GATT, GATT_FIND_INCLUDED,
CONTROLLER_INDEX, gatt_buf.buf, gatt_buf.len);
discover_destroy();
@@ -1249,7 +1270,14 @@ static int disc_chrc_cb(uint16_t conn_handle,
SYS_LOG_DBG("");
- if (error->status != 0) {
+ if (error->status != 0 && error->status != BLE_HS_EDONE) {
+ tester_rsp(BTP_SERVICE_ID_GATT, btp_opcode,
+ CONTROLLER_INDEX, BTP_STATUS_FAILED);
+ discover_destroy();
+ return 0;
+ }
+
+ if (error->status == BLE_HS_EDONE) {
tester_send(BTP_SERVICE_ID_GATT, btp_opcode,
CONTROLLER_INDEX, gatt_buf.buf, gatt_buf.len);
discover_destroy();