Skip to content

timeout and state of advertising & keyboard leds info #98

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

Merged
merged 5 commits into from
Aug 19, 2020

Conversation

xiongyihui
Copy link
Contributor

  • add timeout to BLERadio.start_advertising
  • add BLERadio.advertising property
  • add ReportOut.report property to get keyboard leds info

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Very nice! Thank you. Just a few changes.

@@ -162,14 +162,16 @@ def __init__(self, adapter=None):
self._current_advertisement = None
self._connection_cache = {}

def start_advertising(self, advertisement, scan_response=None, interval=0.1):
def start_advertising(self, advertisement, scan_response=None, interval=0.1, timeout=0):
Copy link
Collaborator

@dhalbert dhalbert Aug 19, 2020

Choose a reason for hiding this comment

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

Use timeout=None to indicate no timeout. That is more Pythonic, and the way we do it in other similar API's. For instance, BLERadio.start_scan() uses timeout=None.

"""
Starts advertising the given advertisement.

:param buf scan_response: scan response data packet bytes.
If ``None``, a default scan response will be generated that includes
`BLERadio.name` and `BLERadio.tx_power`.
:param float interval: advertising interval, in seconds
:param int timeout: advertising timeout in seconds.
If 0, no timeout.
Copy link
Collaborator

Choose a reason for hiding this comment

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

if None, no timeout.

@dhalbert
Copy link
Collaborator

Run the "black" formatter over the changed source files, to fix the build failure.

@xiongyihui
Copy link
Contributor Author

Thanks for the review. Updated

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Just one more thing.

@dhalbert
Copy link
Collaborator

BTW, you can allow us to make simple edits to this or future PR's if you check a box. See:
https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork

@xiongyihui
Copy link
Contributor Author

Thanks. Will do that next time.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Great, thank you for putting in these missing pieces!

@dhalbert dhalbert merged commit 9af3aff into adafruit:master Aug 19, 2020
@dhalbert
Copy link
Collaborator

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Aug 20, 2020
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