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 deprecated API calls in battery and thermometer services #10634

Merged
merged 1 commit into from May 23, 2019

Conversation

LDong-Arm
Copy link
Contributor

Description

Fix deprecated API warnings reported by ARMmbed/mbed-os-example-ble#180 (and a bit more)

Note: There're more warnings from URIBeanconConfig (deprecated) and UART (to be deprecated) services, but those should be simply suppressed instead. Will create a separate/independent PR for that.

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@pan- @paul-szczepanek-arm

Release Notes

Update BatterService and HealthThermometerService to use
up-to-date BLE APIs.

Note: HealthThermometerService::updateTemperature() will
not check GAP connection which should be taken care of by
the caller.
@ciarmcom ciarmcom requested review from pan-, paul-szczepanek-arm and a team May 22, 2019 13:00
@ciarmcom
Copy link
Member

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

@@ -72,10 +72,8 @@ class HealthThermometerService {
*
*/
void updateTemperature(float temperature) {
if (ble.getGapState().connected) {

Choose a reason for hiding this comment

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

I guess this could be replaced by getConnectionCount()?

Copy link
Contributor Author

@LDong-Arm LDong-Arm May 22, 2019

Choose a reason for hiding this comment

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

Good point. Unfortunately getConnectionCount() is not available anymore (reverted soon after it was first introduced), but a few deprecation notices still point to/recommend that. I guess it needs to be fixed as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one removed getConnectionCount(): 61536c3

Choose a reason for hiding this comment

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

I don't know why it was removed. The variable backing it is still functional. @pan-?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure it was intentionally removed; just a mistake when non backward compatible changes were reverted. #8738 has been wild.

Copy link
Member

Choose a reason for hiding this comment

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

So that's actually not required and application code doesn't have to ensure that it is connected before calling updateTemperature.

@0xc0170
Copy link
Contributor

0xc0170 commented May 23, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented May 23, 2019

Test run: SUCCESS

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

@0xc0170 0xc0170 merged commit 86bd7f0 into ARMmbed:master May 23, 2019
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.

None yet

6 participants