-
Notifications
You must be signed in to change notification settings - Fork 463
EATT manual connection & multiple channels initial support #2055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
EATT manual connection & multiple channels initial support #2055
Conversation
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
a4c3fc3 to
4389896
Compare
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`.
4389896 to
0fe92a4
Compare
| { | ||
| .sc_cmd = "gatt-eatt-connect", | ||
| .sc_cmd_func = cmd_gatt_eatt_connect, | ||
| #if MYNEWT_VAL(SHELL_CMD_HELP) | ||
| .help = &gatt_eatt_connect_help, | ||
| #endif | ||
| }, |
There was a problem hiding this comment.
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
| console_printf("To enable this features set BLE_EATT_CHAN_NUM\n"); | ||
| return ENOTSUP; |
There was a problem hiding this comment.
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
| 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); |
There was a problem hiding this comment.
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.
| chan_idx = ble_eatt_free_channel_idx(eatt); | ||
| if (chan_idx > 0) { | ||
| eatt->chan[chan_idx] = event->connect.chan; |
There was a problem hiding this comment.
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
New syscfg options for multiple EATT channels.
Introduce multiple channels to
ble_eattstructure.Add new API function for connecting EATT on demand.
Add new shell command for manually connecting EATT channels.