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

BT Classic: support for 32 and 128-bit custom UUIDs (IDFGH-10721) #11942

Merged

Conversation

ilutchenko
Copy link
Contributor

@ilutchenko ilutchenko commented Jul 24, 2023

The problem

This PR fixes issue #11529

What was done

I added new API functions that can add 32 and 128-bit UUID to the EIR data when these UUIDs are set in SDP.
The old functions that only work with 16-bit UUIDs have been left unchanged to avoid having to redo code that already utilizes them.

How it was tested

sdptool and wireshark output:
for 32-bit UUID:
image
image

for 128-bit UUID:
image
image

@CLAassistant
Copy link

CLAassistant commented Jul 24, 2023

CLA assistant check
All committers have signed the CLA.

@ilutchenko ilutchenko force-pushed the eir-support-32-128-bit-uuids branch from d3ec4bc to b45981c Compare July 24, 2023 15:48
@espressif-bot espressif-bot added the Status: Opened Issue is new label Jul 24, 2023
@github-actions github-actions bot changed the title BT Classic: support for 32 and 128-bit custom UUIDs BT Classic: support for 32 and 128-bit custom UUIDs (IDFGH-10721) Jul 24, 2023
@ilutchenko ilutchenko force-pushed the eir-support-32-128-bit-uuids branch from b45981c to 86c4c67 Compare July 24, 2023 15:55
@xiongweichao
Copy link
Collaborator

Please delete unnecessary whitespace in the code.

@ESP-YTGerd
Copy link
Collaborator

Hi, @ilutchenko thanks for your contribution, are you still following up this PR? Please resolve all the comments so that we can merge it.

@ilutchenko
Copy link
Contributor Author

Hi @ESP-YTGerd ! Yes, I will fix up it soon. Just found some bugs during applying @xiongweichao's suggestions, need to figure out how to deal with them in the best way.

@github-actions
Copy link

github-actions bot commented Sep 20, 2023

Messages
📖 Good Job! All checks are passing!

👋 Welcome ilutchenko, thank you for your first contribution to espressif/esp-idf project!

📘 Please check Contributions Guide for the contribution checklist, information regarding code and documentation style, testing and other topics.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for espressif/esp-idf project.

Pull request review and merge process you can expect

Espressif develops the ESP-IDF project in an internal repository (Gitlab). We do welcome contributions in the form of bug reports, feature requests and pull requests via this public GitHub repository.

  1. An internal issue has been created for the PR, we assign it to the relevant engineer
  2. They review the PR and either approve it or ask you for changes or clarifications
  3. Once the Github PR is approved, we synchronize it into our internal git repository
  4. In the internal git repository we do the final review, collect approvals from core owners and make sure all the automated tests are passing
    • At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
  5. If the change is approved and passes the tests it is merged into the master branch
  6. On next sync from the internal git repository merged change will appear in this public Github repository

Generated by 🚫 dangerJS against 0a23da7

@ilutchenko ilutchenko force-pushed the eir-support-32-128-bit-uuids branch 3 times, most recently from e805e34 to a1f8509 Compare September 21, 2023 07:49
@ilutchenko
Copy link
Contributor Author

So, deleting records and EIR UUIDs pulled me into a deep rabbit hole.
As I discovered, SDP records creation and removal didn't work correctly.
So I spent some time debugging and bugfixing.

Done since the previous PR version:

  • resolved xiongweichao's comments
  • fixed handler return when SDP record is created
  • fixed SDP database slot release in free_sdp_slot()
  • UUID is removed from EIR when you delete the SDP record with esp_sdp_remove_record()

@xiongweichao , could you take another look at this PR, please?

@ilutchenko
Copy link
Contributor Author

@xiongweichao , @ESP-YTGerd
Could you take a last look at this PR, please?

BTW, I have a question about failed CI. Pre-commit check passed successfully on my local machine but failed on GitHub Actions with a strange error.
Should I do something with it?

@ESP-YTGerd
Copy link
Collaborator

Hi, @ilutchenko
1: Can try to rebase to the Origin/Master branch, since the pre-commit just check the codes what you have committed.
2: It's also recommended to modify the commit message, which has the following format:

Subject (first line) has format: <type|action>(<scope/component>): <summary> (or <type|action>: <summary>)
If related to Github issue, add **full** Github issue link, e.g. `https://github.com/espressif/esp-idf/issues/47`

Example of a complete commit message:

feat(bt/bluedroid): Add new APIs for 32 and 128-bit UUIDs

1: <detail >(if needed)

Closes https://github.com/espressif/esp-idf/issues/xxx (if github issue linked)

Explanation of typical <action/type> in conventional commit style:

* `change`: making general changes or improvements to the codebase (e.g.: `change(api): Style of authentication module`)
* `ci`: making changes to the CI system configuration or CI scripts (e.g.: `ci: Configure pre-commit checks`)
* `docs`: making changes to the documentation (e.g.: `docs(ble): Update BLE API documentation`)
* `feat`: adding a new feature or functionality to the project (e.g: `feat(api): Implement user login functionality`)
* `fix`: fixing a bug or resolving an issue (e.g: `fix(mbedtls): Fix null pointer exception in data validation`)
* `refactor`: refactoring existing code without changing its behavior (e.g: `refactor(area): Extract common utility function`)
* `remove`: removing files, features, or functionalities from the project (e.g: `remove(api): Delete deprecated API endpoint`)
* `revert`: reverting a previous change (e.g: `revert(api): Revert changes to user authentication from MR 12345`)

@ilutchenko ilutchenko force-pushed the eir-support-32-128-bit-uuids branch 2 times, most recently from 4d9e477 to 5b8abb6 Compare October 25, 2023 16:17
@ilutchenko
Copy link
Contributor Author

Hi @ESP-YTGerd
So, I squashed all the work into one commit and updated its description as you suggested.
I think it is ready to merge.

@ESP-YTGerd
Copy link
Collaborator

Hi, @ilutchenko
LGTM, but also please resolve the comments what I have reviewed and then I can merge this PR, thanks!

@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels Oct 26, 2023
@ilutchenko
Copy link
Contributor Author

Hi @ESP-YTGerd ,
All notes were implemented and comments sections were resolved.

components/bt/host/bluedroid/bta/sys/bta_sys_conn.c Outdated Show resolved Hide resolved
components/bt/host/bluedroid/bta/sys/bta_sys_conn.c Outdated Show resolved Hide resolved
components/bt/host/bluedroid/bta/sys/bta_sys_conn.c Outdated Show resolved Hide resolved
**
*******************************************************************************/
//extern
void BTM_AddCustomEirService( tBT_UUID *custom_uuid, tBT_UUID uuid );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
void BTM_AddCustomEirService( tBT_UUID *custom_uuid, tBT_UUID uuid );
void BTM_AddCustomEirService(tBT_UUID *custom_uuid, tBT_UUID uuid);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, some other function declarations in this file have spaces near bracers, and some don't.
Okay, I removed them.

components/bt/host/bluedroid/stack/include/stack/btm_api.h Outdated Show resolved Hide resolved
@ESP-YTGerd
Copy link
Collaborator

@ilutchenko
oh, sorry, my bad, I forgot to submit my comments.

@ilutchenko
Copy link
Contributor Author

@ESP-YTGerd , done

1. Added new API functions that can add 32 and 128-bit UUID to the EIR data
when these UUIDs are set in SDP.
The old functions that only work with 16-bit UUIDs have been left
unchanged to avoid having to redo code that already utilizes them.

2. Fixed bug with zero handler return in btc_sdp.c
sdp_create_record.handle in tBTA_SDP struct wasn't saved before.
Because of it Bluetooth stack always returned zero handler to
application callback.

Closes espressif#11529
@ESP-YTGerd
Copy link
Collaborator

Hi, @ilutchenko The internal MR in gitlab was created and all the changes will be automatically synchronized to github, once the MR is merged.

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: In Progress Work is in progress labels Nov 17, 2023
@espressif-bot espressif-bot merged commit a7fbf45 into espressif:master Nov 20, 2023
5 checks passed
@ESP-YTGerd
Copy link
Collaborator

Hi, @ilutchenko
This PR has been merged and thanks for your contribution again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants