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

extended advertising v2 #382

Merged
merged 8 commits into from Feb 3, 2024
Merged

extended advertising v2 #382

merged 8 commits into from Feb 3, 2024

Conversation

barbibulle
Copy link
Collaborator

This is an enhanced API for extended advertising which allows:
1/ using extended advertising commands for legacy advertising (keeping the original advertising API as-is)
2/ creating advertising set objects, which can be independently started/stopped/updated, using a new API.
The new/extended API also allows creating advertisements with legacy PDUs (very typical when you want to be compatible with older devices/phones) in addition to newer ones.

The unit tests aren't complete yet, because they will be easier to write once we merge the PR with basic support for extended advertising in the local controller class. Using Host mocks isn't a great way to test, because you need the full logic of a Controller to ensure that the sequence of events (for example, you need responses for some commands, not just mocking accepting a command and mocking some events), as well as the declared/supported properties, behave correctly.
A future PR will also include a way to test with Root Canal, when available (only on some platforms), but that's out of scope for this PR.

bumble/device.py Outdated Show resolved Hide resolved
tests/device_test.py Outdated Show resolved Hide resolved
bumble/host.py Outdated
Comment on lines 50 to 51
HCI_INQUIRY_COMPLETE_EVENT,
HCI_INQUIRY_RESULT_EVENT,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Including so many items does raise my concern. It also violates Google's Python Style Guide(though it's also not compatible with Black style, and we never follow it from the beginning).

I think we may import hci module here, and add a nick name without HCI_ prefix if we want to avoid repeated HCI at each line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right, the list is becoming too long. I'll make the change here to just import hci and use hci.XXX in this file. Eventually, I'll try to push a PR later on to do the same change in other files that also import too many symbols directly. It will make the lines a bit longer, but I think it's a cleaner model.

examples/run_extended_advertiser_2.py Outdated Show resolved Hide resolved
bumble/device.py Outdated Show resolved Hide resolved
bumble/device.py Show resolved Hide resolved
bumble/device.py Show resolved Hide resolved
bumble/device.py Outdated Show resolved Hide resolved
bumble/device.py Outdated Show resolved Hide resolved
bumble/device.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@zxzxwu zxzxwu left a comment

Choose a reason for hiding this comment

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

LGTM

@barbibulle barbibulle merged commit ef0b30d into main Feb 3, 2024
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants