Skip to content

Commit 3b102b1

Browse files
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.
1 parent fe23e06 commit 3b102b1

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

apps/bttester/src/btp/btp_gatt.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,12 @@ struct btp_gatt_notify_mult_val_cmd {
321321
uint16_t handles[0];
322322
} __packed;
323323

324+
#define BTP_GATT_EATT_CONNECT 0x1f
325+
struct btp_gatt_eatt_conn_cmd {
326+
ble_addr_t address;
327+
uint8_t num_channels;
328+
} __packed;
329+
324330
/* GATT events */
325331
#define BTP_GATT_EV_NOTIFICATION 0x80
326332
struct btp_gatt_notification_ev {

apps/bttester/src/btp_gatt.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,23 @@ notify_mult(const void *cmd, uint16_t cmd_len,
19391939
return BTP_STATUS_SUCCESS;
19401940
}
19411941

1942+
static uint8_t
1943+
eatt_conn(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
1944+
{
1945+
uint16_t conn_handle;
1946+
const struct btp_gatt_eatt_conn_cmd *cp = cmd;
1947+
int rc;
1948+
1949+
ble_gap_conn_find_handle_by_addr(&cp->address, &conn_handle);
1950+
1951+
rc = ble_eatt_connect(conn_handle, cp->num_channels);
1952+
if (rc == 0 || rc == BLE_HS_EALREADY) {
1953+
return BTP_STATUS_SUCCESS;
1954+
}
1955+
1956+
return BTP_STATUS_FAILED;
1957+
}
1958+
19421959
static uint8_t
19431960
change_database(const void *cmd, uint16_t cmd_len,
19441961
void *rsp, uint16_t *rsp_len)
@@ -2096,6 +2113,11 @@ static const struct btp_handler handlers[] = {
20962113
.expect_len = BTP_HANDLER_LENGTH_VARIABLE,
20972114
.func = notify_mult,
20982115
},
2116+
{
2117+
.opcode = BTP_GATT_EATT_CONNECT,
2118+
.expect_len = sizeof(struct btp_gatt_eatt_conn_cmd),
2119+
.func = eatt_conn,
2120+
},
20992121
};
21002122

21012123
int

0 commit comments

Comments
 (0)