Skip to content

allow host resolved address to be used for connection #13685

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

Conversation

paul-szczepanek-arm
Copy link
Member

Summary of changes

Search for RPA in advertising so we can connect using resolved address.

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 requested review from pan- and a team September 30, 2020 08:30
@ciarmcom
Copy link
Member

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

#if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
if (_connect_to_address_type != peer_address_type_t::ANONYMOUS) {
ret = startScan(
(scan_duration_t)connectionParams.getConnectionSupervisionTimeoutArray()[0],
Copy link
Member Author

Choose a reason for hiding this comment

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

this is probably not the right value to use

@@ -521,6 +525,17 @@ ble_error_t Gap::connect(

ble_error_t ret = BLE_ERROR_INTERNAL_STACK_FAILURE;

#if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
if (_ready_to_connect_to_host_resolved_address) {
Copy link
Member

Choose a reason for hiding this comment

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

It took me some time to understand what this exactly does. Using a state enum would make the code more readable and prevent multiple calls to connect that may lead to memory leak.

(scan_period_t)0
);
if (ret == BLE_ERROR_NONE) {
_connection_parameters = new ConnectionParameters(connectionParams);
Copy link
Member

Choose a reason for hiding this comment

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

Can you release it in reset

@paul-szczepanek-arm
Copy link
Member Author

Thanks, I added an enum and used the extra 3rd state to avoid having an internal connect since the connect is called synchronously from the scan result so I can use that state to know it's an internal call.

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.

LGTM

@@ -532,15 +528,26 @@ ble_error_t Gap::connect(
ble_error_t ret = BLE_ERROR_INTERNAL_STACK_FAILURE;

#if BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
/* if host resolution is used we need to connect in two passes, first we scan for addresses to find
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 comment

@pan- pan- merged commit 949f9f0 into ARMmbed:feature-ble-host-privacy Oct 1, 2020
@mergify mergify bot added needs: CI and removed needs: review labels Oct 1, 2020
@pan- pan- mentioned this pull request Oct 5, 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.

4 participants