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:13 UTC

[mynewt-nimble] 06/14: apps/bttester: Improve logging for GATT Write Long

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 b5fafe7749e34aeed805ab44bd1d8e5d2f0092b6
Author: MichaƂ Narajowski <mi...@codecoup.pl>
AuthorDate: Mon Nov 25 12:54:19 2019 +0100

    apps/bttester: Improve logging for GATT Write Long
---
 apps/bttester/src/gatt.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/apps/bttester/src/gatt.c b/apps/bttester/src/gatt.c
index 9a58194..7196da4 100644
--- a/apps/bttester/src/gatt.c
+++ b/apps/bttester/src/gatt.c
@@ -896,7 +896,7 @@ static void write_long(u8_t *data, u16_t len)
 	const struct gatt_write_long_cmd *cmd = (void *) data;
 	struct ble_gap_conn_desc conn;
 	struct os_mbuf *om = NULL;
-	int rc;
+	int rc = 0;
 
 	SYS_LOG_DBG("");
 
@@ -906,23 +906,23 @@ static void write_long(u8_t *data, u16_t len)
 	}
 
 	om = ble_hs_mbuf_from_flat(cmd->data, sys_le16_to_cpu(cmd->data_length));
-
 	if (!om) {
 		SYS_LOG_ERR("Insufficient resources");
 		goto fail;
 	}
 
-	if (ble_gattc_write_long(conn.conn_handle, sys_le16_to_cpu(cmd->handle),
-				 sys_le16_to_cpu(cmd->offset), om, write_rsp,
-				 (void *) GATT_WRITE_LONG)) {
-		goto fail;
-}
-
-	return;
+	rc = ble_gattc_write_long(conn.conn_handle,
+				  sys_le16_to_cpu(cmd->handle),
+				  sys_le16_to_cpu(cmd->offset),
+				  om, write_rsp,
+				  (void *) GATT_WRITE_LONG);
+	if (!rc) {
+		return;
+	}
 
 fail:
+	SYS_LOG_ERR("Failed to send Write Long request, rc=%d", rc);
 	os_mbuf_free_chain(om);
-
 	tester_rsp(BTP_SERVICE_ID_GATT, GATT_WRITE_LONG, CONTROLLER_INDEX,
 		   BTP_STATUS_FAILED);
 }