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


The following commit(s) were added to refs/heads/master by this push:
     new 863b91cac nimble/eatt: Add manual EATT connection control to BTP tester
863b91cac is described below

commit 863b91cacfcee7cd1b66e551cec2507918691deb
Author: Szymon Czapracki <[email protected]>
AuthorDate: Fri Mar 28 18:13:29 2025 +0100

    nimble/eatt: Add manual EATT connection control to BTP tester
    
    Adds new BTP command `BTP_GATT_EATT_CONNECT` (opcode 0x1f) to trigger
      EATT connections with configurable L2CAP channels.
    
    Implements handler `eatt_conn()` that:
      * Calls `ble_eatt_connect()` with the requested channel count
        and proper address
    
    Enables testing scenarios requiring explicit control over EATT establishment
    and channel management.
---
 apps/bttester/src/btp/btp_gatt.h |  6 ++++++
 apps/bttester/src/btp_gatt.c     | 22 ++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/apps/bttester/src/btp/btp_gatt.h b/apps/bttester/src/btp/btp_gatt.h
index 6c57ade09..7e52efd46 100644
--- a/apps/bttester/src/btp/btp_gatt.h
+++ b/apps/bttester/src/btp/btp_gatt.h
@@ -321,6 +321,12 @@ struct btp_gatt_notify_mult_val_cmd {
     uint16_t handles[0];
 } __packed;
 
+#define BTP_GATT_EATT_CONNECT 0x1f
+struct btp_gatt_eatt_conn_cmd {
+    ble_addr_t address;
+    uint8_t num_channels;
+} __packed;
+
 /* GATT events */
 #define BTP_GATT_EV_NOTIFICATION        0x80
 struct btp_gatt_notification_ev {
diff --git a/apps/bttester/src/btp_gatt.c b/apps/bttester/src/btp_gatt.c
index 17c083bf3..2886cc846 100644
--- a/apps/bttester/src/btp_gatt.c
+++ b/apps/bttester/src/btp_gatt.c
@@ -1931,6 +1931,23 @@ notify_mult(const void *cmd, uint16_t cmd_len,
     return BTP_STATUS_SUCCESS;
 }
 
+static uint8_t
+eatt_conn(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
+{
+    uint16_t conn_handle;
+    const struct btp_gatt_eatt_conn_cmd *cp = cmd;
+    int rc;
+
+    ble_gap_conn_find_handle_by_addr(&cp->address, &conn_handle);
+
+    rc = ble_eatt_connect(conn_handle, cp->num_channels);
+    if (rc == 0 || rc == BLE_HS_EALREADY) {
+        return BTP_STATUS_SUCCESS;
+    }
+
+    return BTP_STATUS_FAILED;
+}
+
 static uint8_t
 change_database(const void *cmd, uint16_t cmd_len,
                 void *rsp, uint16_t *rsp_len)
@@ -2088,6 +2105,11 @@ static const struct btp_handler handlers[] = {
         .expect_len = BTP_HANDLER_LENGTH_VARIABLE,
         .func = notify_mult,
     },
+    {
+        .opcode = BTP_GATT_EATT_CONNECT,
+        .expect_len = sizeof(struct btp_gatt_eatt_conn_cmd),
+        .func = eatt_conn,
+    },
 };
 
 int

Reply via email to