You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2022/04/19 08:19:48 UTC

[mynewt-nimble] 01/02: apps/bttester: add option to connect single ECFC channel

This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit f8f10ab96abb31da4055f57c9b28349183f28deb
Author: Krzysztof Kopyściński <kr...@codecoup.pl>
AuthorDate: Wed Nov 17 12:32:51 2021 +0100

    apps/bttester: add option to connect single ECFC channel
    
    BTP specification was extended and we can decide weather or not
    connect ECFC channel by specifying it in 'option' command argument.
    This allows to connect single ECFC channel.
---
 apps/bttester/src/bttester.h | 3 +++
 apps/bttester/src/l2cap.c    | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/apps/bttester/src/bttester.h b/apps/bttester/src/bttester.h
index d37939dc..767d9fff 100644
--- a/apps/bttester/src/bttester.h
+++ b/apps/bttester/src/bttester.h
@@ -754,6 +754,8 @@ struct l2cap_read_supported_commands_rp {
 	uint8_t data[0];
 } __packed;
 
+#define L2CAP_CONNECT_OPT_ECFC		0x01
+
 #define L2CAP_CONNECT			0x02
 struct l2cap_connect_cmd {
 	uint8_t address_type;
@@ -761,6 +763,7 @@ struct l2cap_connect_cmd {
 	uint16_t psm;
 	uint16_t mtu;
 	uint8_t num;
+	uint8_t options;
 } __packed;
 
 struct l2cap_connect_rp {
diff --git a/apps/bttester/src/l2cap.c b/apps/bttester/src/l2cap.c
index 7bfa53e7..41a51d81 100644
--- a/apps/bttester/src/l2cap.c
+++ b/apps/bttester/src/l2cap.c
@@ -397,6 +397,7 @@ static void connect(uint8_t *data, uint16_t len)
 	uint16_t mtu = htole16(cmd->mtu);
 	int rc;
 	int i, j;
+	bool ecfc = cmd->options & L2CAP_CONNECT_OPT_ECFC;
 
 	SYS_LOG_DBG("connect: type: %d addr: %s", addr->type, bt_hex(addr->val, 6));
 
@@ -439,11 +440,11 @@ static void connect(uint8_t *data, uint16_t len)
 	    }
 	}
 
-	if (cmd->num == 1) {
+	if (cmd->num == 1 && !ecfc) {
 		rc = ble_l2cap_connect(desc.conn_handle, htole16(cmd->psm),
 				       mtu, sdu_rx[0],
 				       tester_l2cap_event, NULL);
-	} else if (cmd->num > 1) {
+	} else if (ecfc) {
 		rc = ble_l2cap_enhanced_connect(desc.conn_handle,
 						htole16(cmd->psm), mtu,
 						cmd->num, sdu_rx,