Skip to content

Commit ea0a2ef

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 ea0a2ef

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,24 @@ 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,
1944+
void *rsp, uint16_t *rsp_len)
1945+
{
1946+
uint16_t conn_handle;
1947+
const struct btp_gatt_eatt_conn_cmd *cp = cmd;
1948+
int rc;
1949+
1950+
ble_gap_conn_find_handle_by_addr(&cp->address, &conn_handle);
1951+
1952+
rc = ble_eatt_connect(conn_handle, cp->num_channels);
1953+
if (rc == 0 || rc == BLE_HS_EALREADY) {
1954+
return BTP_STATUS_SUCCESS;
1955+
}
1956+
1957+
return BTP_STATUS_FAILED;
1958+
}
1959+
19421960
static uint8_t
19431961
change_database(const void *cmd, uint16_t cmd_len,
19441962
void *rsp, uint16_t *rsp_len)
@@ -2096,6 +2114,11 @@ static const struct btp_handler handlers[] = {
20962114
.expect_len = BTP_HANDLER_LENGTH_VARIABLE,
20972115
.func = notify_mult,
20982116
},
2117+
{
2118+
.opcode = BTP_GATT_EATT_CONNECT,
2119+
.expect_len = sizeof(struct btp_gatt_eatt_conn_cmd),
2120+
.func = eatt_conn,
2121+
},
20992122
};
21002123

21012124
int

0 commit comments

Comments
 (0)