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

BLE: Fix scan state and host resolution of RPAs #13779

Merged
merged 3 commits into from
Oct 20, 2020

Conversation

paul-szczepanek-arm
Copy link
Member

@paul-szczepanek-arm paul-szczepanek-arm commented Oct 16, 2020

Summary of changes

The scanning status of the device did not distinguish between all the states. I have removed the bools the combination of which was interpreted to divine the status and replaced it with an enum. The remaining bool is a toggle that shows the intention of whether we want scan active or not. The rest is handled by each event by looking at it and the current state.

Related to there was a mistake in the scan behaviour missing early termination in host resolution which was also was missing in one of the code paths. This PR includes a fix for that.

Impact of changes

Migration actions required

Documentation

none


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

pan-


@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Oct 16, 2020
@ciarmcom
Copy link
Member

@paul-szczepanek-arm, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

@ciarmcom ciarmcom requested a review from a team October 16, 2020 17:30
@0xc0170 0xc0170 requested a review from a team October 19, 2020 07:31
@paul-szczepanek-arm paul-szczepanek-arm force-pushed the fix-scan-state branch 2 times, most recently from 78b3b8a to b29b886 Compare October 19, 2020 13:37
@paul-szczepanek-arm
Copy link
Member Author

Tested with ble testsuite.

Copy link
Member

@pan- pan- left a comment

Choose a reason for hiding this comment

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

Thanks @paul-szczepanek-arm LGTM.

);
#if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
if (_connect_to_host_resolved_address_state == ConnectionToHostResolvedAddressState::scan) {
ret = startScan(scan_duration_t::forever(), duplicates_filter_t::ENABLE, scan_period_t(0));
Copy link
Member

Choose a reason for hiding this comment

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

Why would you want to have host based resolution on a target that supports extended advertising ?
Could you report a warning to the user with MBED_WARNING ? If extended advertising is supported, in practice controller resolution is supported and the configuration probably needs to be amended.

The warning can be conditional of the resolution in controller.

Copy link
Member

Choose a reason for hiding this comment

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

This can be made in another PR when we advice users of the best configuration for their controller depending on the features.

Copy link
Member Author

Choose a reason for hiding this comment

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

good point, I will make such a PR

if (!_central_privacy_configuration.use_non_resolvable_random_address == connectable) {
/* if we're scanning we need to stop */
if (_scan_state == ScanState::scan) {
/* but we can only stop if we're scanning forever */
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the comments, that makes it clear.

@mergify mergify bot added needs: CI and removed needs: review labels Oct 19, 2020
@0xc0170
Copy link
Contributor

0xc0170 commented Oct 20, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Oct 20, 2020

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_dynamic-memory-usage ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️
jenkins-ci/mbed-os-ci_cloud-client-pytest ✔️

@0xc0170 0xc0170 merged commit 1b663a3 into ARMmbed:master Oct 20, 2020
@mergify mergify bot removed the ready for merge label Oct 20, 2020
@mbedmain mbedmain added release-version: 6.4.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants