Skip to content
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

Bluetooth: provide struct bt_gatt_indicate_params to bt_gatt_indicate_func_t #28688

Closed
JordanYates opened this issue Sep 25, 2020 · 1 comment
Labels
Enhancement Changes/Updates/Additions to existing features

Comments

@JordanYates
Copy link
Collaborator

Is your enhancement proposal related to a problem? Please describe.

As noted by the function documentation, bt_gatt_indicate is an asynchronous function, and therefore the struct bt_gatt_indicate_params provided to it must valid while it is active. The required lifetime of the struct bt_gatt_indicate_params is presumably until the member function bt_gatt_indicate_func_t is called (this is not specified). Currently, it is not possible to determine from the callback which struct bt_gatt_indicate_params is now available to be reused.

This is an issue when multiple indications need to be queued, with the structs allocated from some kernel mechanism (k_mem_slab or other), as there is no way to free the instances once they are no longer needed.

Describe the solution you'd like
const struct bt_gatt_attr *attr parameter to bt_gatt_indicate_func_t changed to struct bt_gatt_indicate_params *params.
The attr element is still accessible from the *params, but the params instance can also be freed in the callback.

Describe alternatives you've considered
None, there is no user data parameter or similar to retrieve the struct bt_gatt_indicate_params pointer from the completing indication.

@JordanYates JordanYates added the Enhancement Changes/Updates/Additions to existing features label Sep 25, 2020
@JordanYates
Copy link
Collaborator Author

Superseded by #29357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant