Skip to content

Replace deprecated BLE API calls #12235

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

Closed

Conversation

hugueskamba
Copy link
Collaborator

@hugueskamba hugueskamba commented Jan 10, 2020

Summary of changes

As the LegacyGap class has been deprecated, in favor of the Gap
class, all references of its references in the code base has been
replaced.

Impact of changes

Migration actions required

Documentation


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- @paul-szczepanek-arm


@ciarmcom ciarmcom requested review from pan-, paul-szczepanek-arm and a team January 10, 2020 12:00
@ciarmcom
Copy link
Member

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

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 10, 2020

Even simple PRs should provide some Summary of changes . Please describe the PR.

what has been deprecated in BLE and what we should use - would it be useful to have in the commit msg ?

@hugueskamba hugueskamba changed the title Replace deprecated BLE APIs Replace deprecated BLE API calls Jan 13, 2020
@hugueskamba hugueskamba force-pushed the hk-replace-deprecated-ble branch from 3da0107 to fae6ab1 Compare January 13, 2020 07:40
@hugueskamba
Copy link
Collaborator Author

Even simple PRs should provide some Summary of changes . Please describe the PR.

what has been deprecated in BLE and what we should use - would it be useful to have in the commit msg ?

Done.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 13, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 13, 2020

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 14, 2020

Restarted entire pipeline to get test reports in logs

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 14, 2020

We are investigating failures in CI, will restart once fixed

cc @VeliMattiLahtela

@mbed-ci
Copy link

mbed-ci commented Jan 14, 2020

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 4
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 14, 2020

The failure is there, looks like it is related to the changes.

cc @ARMmbed/mbed-os-pan

@hugueskamba hugueskamba force-pushed the hk-replace-deprecated-ble branch from fae6ab1 to 260ef85 Compare January 14, 2020 15:34
@hugueskamba
Copy link
Collaborator Author

The failure is there, looks like it is related to the changes.

cc @ARMmbed/mbed-os-pan

@pan-
There seems to be a problem with the implementation of enablePrivacy_
The address is never initialised by the time Gap::enablePrivacy is called. And as far as I can tell, there is no function to initialize it either. I am working on adding something to initialize _non_private_address in features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_SOFTDEVICE/TARGET_NRF51/source/nRF5xGap.cpp.

@paul-szczepanek-arm
Copy link
Member

The init sequence needs to be amended if the set privacy call does not cause an HCI command to be sent. The sequence relies on each command causing a new HCI reply being generated.

As the `LegacyGap` class has been deprecated, in favor of the `Gap`
class, all references of its references in the code base has been
replaced.
@hugueskamba hugueskamba force-pushed the hk-replace-deprecated-ble branch from 260ef85 to dbf4cdb Compare January 15, 2020 09:04
@hugueskamba
Copy link
Collaborator Author

hugueskamba commented Jan 15, 2020

@pan- @paul-szczepanek-arm @LDong-Arm
Can you please review this. The cordio test passes with these changes. Especially whether the correct values for .use_non_resolvable_random_address and .resolution_strategy have been used. Also is setPeripheralPrivacyConfiguration or should I have used setCentralPrivacyConfiguration instead?
Thanks.

@hugueskamba
Copy link
Collaborator Author

hugueskamba commented Jan 15, 2020

those are only relevant if privacy is enabled (it only really enables privacy if one of the strategies requires it)

It appears it also is relevant when enablePrivacy is called with false as the initialization does not complete without the configuration.
Is there maybe an assumption that enablePrivacy(false) is only possible after a enablePrivacy(true) which would have done the configuration?

EDIT:
There is something in enablePrivacy that prevents any processing if the new state is equal to the current state. That will prevent enablePrivacy(false) to work at boot as the current state (disabled) is the same as the new state (disabled).

Doing a configuration is actually what allows the initialization to complete (not enablePrivacy) because the configuration ends up calling update_address_resolution_setting() which is what we expect enablePrivacy to call.

It was agreed that the currently deprecated API should be made Internal (usable in Mbed OS but not public) instead.

@mbed-ci
Copy link

mbed-ci commented Jan 16, 2020

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 5
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_cloud-client-pytest

@0xc0170 0xc0170 added the release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0 label Jan 17, 2020
@0xc0170
Copy link
Contributor

0xc0170 commented Jan 17, 2020

cloud test restarted

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 17, 2020

@pan- @paul-szczepanek-arm Updated with tests passing, is this good to go in?

@0xc0170 0xc0170 requested a review from pan- January 20, 2020 15:09
@adbridge
Copy link
Contributor

NOTE the ci last ran several days ago and thus this will need to be run again before it can be merged, to ensure no conflicts etc due to other merges in the interim!

@evedon
Copy link
Contributor

evedon commented Jan 22, 2020

@adbridge Could you restart CI please?

@adbridge
Copy link
Contributor

CI restarted

@adbridge
Copy link
Contributor

@evedon this still needs approval from the Pan team..

@mergify mergify bot added needs: CI and removed needs: review labels Jan 22, 2020
@mbed-ci
Copy link

mbed-ci commented Jan 22, 2020

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 6
Build artifacts

@adbridge
Copy link
Contributor

@evedon From Vincent:

I’m not seeing this getting approved; we discussed with Hugues last Thursday and there is no clear replacement for the deprecated function Gap::setAddress .
The function is deprecated for a good reason; it shouldn’t be part of the public API however it makes sense to have it available for drivers.
This whole PR changes the behaviour of BLE devices as it replaces a random static address with a private one. Meaning the address will change other time.

@adbridge adbridge added do not merge and removed ready for merge release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0 labels Jan 22, 2020
@evedon
Copy link
Contributor

evedon commented Jan 22, 2020

More work is required. @pan- will take over

@mergify
Copy link

mergify bot commented Jan 25, 2020

This PR cannot be merged due to conflicts. Please rebase to resolve them.

@hugueskamba
Copy link
Collaborator Author

The PR https://github.com/ARMmbed/mbed-os/pull/12321/files replaces the deprecated PR with a new API.

@hugueskamba hugueskamba deleted the hk-replace-deprecated-ble branch January 28, 2020 13:45
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.

8 participants