-
Notifications
You must be signed in to change notification settings - Fork 1.3k
_bleio: support anonymous advertising #2919
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
_bleio: support anonymous advertising #2919
Conversation
I added a new property Additionally, I created a new property |
Add a new parameter to the `start_advertising()` function to enable anonymous advertising. This forces a call to `sd_ble_gap_privacy_set()` with `privacy_mode` set to `BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY` and `private_addr_type` set to `BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE`. With this, addresses will cycle at a predefined rate (currently once every 15 minutes). Signed-off-by: Sean Cross <[email protected]>
Add a field to allow specifying a timeout when initiating advertising. As part of this, add a new property to determine if the device is still advertising. Additionally, have the `anonymous` property require a timeout, and set the timeout to the maximum possible value if no timeout is specified. Signed-off-by: Sean Cross <[email protected]>
There is now an adapter timeout message. Signed-off-by: Sean Cross <[email protected]>
e20cc02
to
f56188c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor things. Looks good otherwise! @tannewt, do you have further comments?
Thanks for the feedback, @dhalbert . I've made all of those changes as requested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see a push (and I have a reversal of a request).
The timeout value is calculated by the common-hal layer now, so we don't need to be quite so clever about calculating it here. Signed-off-by: Sean Cross <[email protected]>
I pushed to the wrong repo. Oops. Also, alright, I reverted that change. I already added a note to the documentation regarding defaults of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, looks good to me. @tannewt, do you want to take a final look and merge if OK, since you had comments as well? I won't merge right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thank you!
This experimental patch adds a new parameter to
_bleio.adapter.start_advertising()
:anonymous
.This boolean parameter defaults to
False
. When set toTrue
, it enables privacy mode by callingsd_ble_gap_privacy_set()
.I have tested this on my device, and I confirm that it works -- the address is randomized, and is rotated every 15 minutes. A second device is capable of connecting to a GATT service and communicating.
Unanswered questions:
0
which uses the Nordic defaultsIRK
be exposed anywhere, and does this affect bonding at all?