Skip to content

Commit 9455791

Browse files
nimble/eatt: Add manual EATT connection control to BTP tester
Added new BTP command `BTP_GATT_EATT_CONNECT` (opcode 0x1f) to trigger EATT connections with configurable L2CAP channels. Implemented handler `eatt_conn()` that: * Calls `ble_eatt_connect()` with the requested channel count and proper address Updated `supported_commands` response to advertise the new capability. Enables testing scenarios requiring explicit control over EATT establishment and channel management.
1 parent 5ab995f commit 9455791

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

apps/bttester/src/btp/btp_gatt.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,12 @@ struct btp_gatt_set_mult_val_cmd {
320320
uint8_t data[0];
321321
} __packed;
322322

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

apps/bttester/src/btp_gatt.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,20 @@ set_mult(const void *cmd, uint16_t cmd_len,
19501950
return BTP_STATUS_SUCCESS;
19511951
}
19521952

1953+
static uint8_t
1954+
eatt_conn(const void *cmd, uint16_t cmd_len,
1955+
void *rsp, uint16_t *rsp_len)
1956+
{
1957+
uint16_t conn_handle;
1958+
const struct btp_gatt_eatt_conn_cmd *cp = cmd;
1959+
1960+
ble_gap_conn_find_handle_by_addr(&cp->address, &conn_handle);
1961+
1962+
ble_eatt_connect(conn_handle, cp->num_channels);
1963+
1964+
return BTP_STATUS_SUCCESS;
1965+
}
1966+
19531967
static uint8_t
19541968
change_database(const void *cmd, uint16_t cmd_len,
19551969
void *rsp, uint16_t *rsp_len)
@@ -2001,6 +2015,7 @@ supported_commands(const void *cmd, uint16_t cmd_len,
20012015
tester_set_bit(rp->data, BTP_GATT_GET_ATTRIBUTES);
20022016
tester_set_bit(rp->data, BTP_GATT_GET_ATTRIBUTE_VALUE);
20032017
tester_set_bit(rp->data, BTP_GATT_CHANGE_DATABASE);
2018+
tester_set_bit(rp->data, BTP_GATT_EATT_CONNECT);
20042019

20052020
*rsp_len = sizeof(*rp) + 4;
20062021

@@ -2137,6 +2152,11 @@ static const struct btp_handler handlers[] = {
21372152
.expect_len = BTP_HANDLER_LENGTH_VARIABLE,
21382153
.func = set_mult,
21392154
},
2155+
{
2156+
.opcode = BTP_GATT_EATT_CONNECT,
2157+
.expect_len = sizeof(struct btp_gatt_eatt_conn_cmd),
2158+
.func = eatt_conn,
2159+
},
21402160
};
21412161

21422162
int

0 commit comments

Comments
 (0)