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: GATT: factor out notify callback #75401

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

jori-nordic
Copy link
Collaborator

  • De-duplicate code
  • Add LOG_WRN on unsubscribe error

Fixes #74720
Fixes #74721

- De-duplicate code
- Add `LOG_WRN` on unsubscribe error

Fixes zephyrproject-rtos#74720
Fixes zephyrproject-rtos#74721

Signed-off-by: Jonathan Rico <[email protected]>
Comment on lines +3621 to +3622
if (params->notify(conn, params, data, length) == BT_GATT_ITER_STOP) {
err = bt_gatt_unsubscribe(conn, params);
Copy link
Member

Choose a reason for hiding this comment

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

Not related to this PR, but I have to say that this looks a bit awkward as an API, since it seems like it'd be trivial (and more clear & explicit) for the callback itself to do this unsubscribe() call rather than implying it through the return value.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree. I spelled it out in the function name to surface that awkwardness :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I also agree - Maybe something we can avoid if we get a new GATT API for EATT

Comment on lines +3621 to +3622
if (params->notify(conn, params, data, length) == BT_GATT_ITER_STOP) {
err = bt_gatt_unsubscribe(conn, params);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I also agree - Maybe something we can avoid if we get a new GATT API for EATT

@jori-nordic jori-nordic added the bug The issue is a bug, or the PR is fixing a bug label Jul 4, 2024
@jori-nordic jori-nordic added this to the v3.7.0 milestone Jul 4, 2024
@aescolar aescolar merged commit a7c5fb7 into zephyrproject-rtos:main Jul 5, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Host area: Bluetooth bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
5 participants