Skip to content

Add advertiser classes and handle adv set terminated events - #366

Merged
zxzxwu merged 2 commits into
google:mainfrom
zxzxwu:extadv
Dec 8, 2023
Merged

Add advertiser classes and handle adv set terminated events#366
zxzxwu merged 2 commits into
google:mainfrom
zxzxwu:extadv

Conversation

@zxzxwu

@zxzxwu zxzxwu commented Dec 6, 2023

Copy link
Copy Markdown
Collaborator
  • Convert hci.OwnAddressType to enum
  • Add LegacyAdvertiser and ExtendedAdvertiser classes
  • Rename start/stop_advertising() => start/stop_legacy_advertising()
  • Handle HCI_Advertising_Set_Terminated
  • Properly restart advertisement on disconnection

@zxzxwu

zxzxwu commented Dec 6, 2023

Copy link
Copy Markdown
Collaborator Author

Maybe we should merge this request after we have a way to test extended advertising?

Comment thread bumble/device.py Outdated
DEVICE_MAX_EXTENDED_ADVERTISING_SET_HANDLE + 1,
):
if i not in self.extended_advertising_handles:
if i not in self.extended_advertisers.keys():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: if i not in self.extended_advertisers should be sufficient.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think this could provide a better readability?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Either way is fine, but in general I think it is more readable to use the standard/idiomatic way of using collections.
For looking up a key in a dict, the recommended way in most style guides is to just use key in dict (see https://google.github.io/styleguide/pyguide.html#284-decision for example).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That's fair. Modified.

Comment thread bumble/host.py
Comment thread bumble/host.py Outdated
* Convert hci.OwnAddressType to enum
* Add LegacyAdvertiser and ExtendedAdvertiser classes
* Rename start/stop_advertising() => start/stop_legacy_advertising()
* Handle HCI_Advertising_Set_Terminated
* Properly restart advertisement on disconnection
@zxzxwu zxzxwu mentioned this pull request Dec 7, 2023
4 tasks
@zxzxwu
zxzxwu merged commit 698d947 into google:main Dec 8, 2023
@zxzxwu
zxzxwu deleted the extadv branch December 12, 2023 05:53
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.

2 participants