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
Conversation
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.
@LDong-Arm, thank you for your changes. |
@@ -72,10 +72,8 @@ class HealthThermometerService { | |||
* | |||
*/ | |||
void updateTemperature(float temperature) { | |||
if (ble.getGapState().connected) { |
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 guess this could be replaced by getConnectionCount()?
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.
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.
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.
This one removed getConnectionCount(): 61536c3
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 don't know why it was removed. The variable backing it is still functional. @pan-?
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'm not sure it was intentionally removed; just a mistake when non backward compatible changes were reverted. #8738 has been wild.
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.
So that's actually not required and application code doesn't have to ensure that it is connected before calling updateTemperature.
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
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
Reviewers
@pan- @paul-szczepanek-arm
Release Notes