Skip to content

Conversation

@szymon-czapracki
Copy link
Contributor

New syscfg options for multiple EATT channels.
Introduce multiple channels to ble_eatt structure.
Add new API function for connecting EATT on demand.
Add new shell command for manually connecting EATT channels.

@github-actions github-actions bot added host size/M Medium PR labels Jun 25, 2025
Introduce BLE_EATT_AUTO_CONNECT syscfg option
to allow manual EATT connection setup

Introduce a configurable limit for maximum number
of L2CAP channels per connection
@szymon-czapracki szymon-czapracki force-pushed the eatt_manual_connection branch 2 times, most recently from a4c3fc3 to 4389896 Compare June 25, 2025 11:52
Extend ble_eatt struct with channel array and channel count.
Add helper functions for channel indexing and lookup.
Update ble_eatt_find to search all channels for matching CID.
Add channel allocation logic on connect event.
Replace direct channel access with indexed lookup.
Refactor ble_eatt_tx and L2CAP ev-handler to support multiple channels.
Introduce ble_eatt_connect() API to allow manual setup EATT.
This change enables explicit control over EATT channel creation.

The function validates the connection handle and requested channel
count, supports requesting all channels by passing 0

Add declaration of ble_eatt_connect() to the ble_att.h header.
Introduc a new shell command `gatt_eatt_connect` to allow manual
connection of multiple EATT channels per connection.

The command parses the connection handle and requested number of channels,
displays basic usage help, and calls the internal `ble_eatt_connect()` API.

Register the command in the shell, add parameter descriptions and
declaration in `cmd_gatt.h`.
@szymon-czapracki szymon-czapracki force-pushed the eatt_manual_connection branch from 4389896 to 0fe92a4 Compare June 25, 2025 12:33
Comment on lines +4667 to 4673
{
.sc_cmd = "gatt-eatt-connect",
.sc_cmd_func = cmd_gatt_eatt_connect,
#if MYNEWT_VAL(SHELL_CMD_HELP)
.help = &gatt_eatt_connect_help,
#endif
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it conditional (on MYNEWT_VAL(BLE_EATT_CHAN_NUM));
It has to be conditionally compiled, otherwise it will fail, because gatt_eatt_connect_help is undefined if BLE_EATT_CHAN_NUM is not set

Comment on lines +698 to +699
console_printf("To enable this features set BLE_EATT_CHAN_NUM\n");
return ENOTSUP;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO The function should be conditionally compiled as well

Comment on lines 579 to +586
eatt = ble_eatt_find(conn_handle, cid);
if (!eatt || !eatt->chan) {
if (!eatt) {
BLE_EATT_LOG_ERROR("Eatt not available");
rc = BLE_HS_ENOENT;
goto error;
}

channel = ble_eatt_channel_find_by_cid(eatt, cid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks odd to me. If ble_eatt_find() takes as parameter cid, I would expect it will return eatt instance matching cid given. Now, when you place an array of channels into eatt so it does not simply wrap L2CAP channel, the ble_eatt_find() should not take cid as parameter IMO.

Comment on lines +313 to +315
chan_idx = ble_eatt_free_channel_idx(eatt);
if (chan_idx > 0) {
eatt->chan[chan_idx] = event->connect.chan;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, the condition is incorrect, as array index 0 is valid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants