-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
bluetooth: BAS: add battery critical status char to bas service #79966
bluetooth: BAS: add battery critical status char to bas service #79966
Conversation
help | ||
Enable this option to include Battery Critical Status Characteristic. |
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.
Looks like this is an issue for this entire Kconfig file, however the help text should be indented with 1 tab + 2 spaces (maybe add a second prior commit to this PR to fix that for the other options in this file)
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.
Done Below PR fixes the indentation issue of BAS Kconfig
#79986
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.
Thanks. You could have included that as the first commit in this PR as well. Anyway, I marked the other PR as Trivial, so it should hopefully go in still today, and then you can rebase this one.
8498061
to
dd9f664
Compare
59e5101
to
a10ea39
Compare
#include <zephyr/logging/log.h> | ||
LOG_MODULE_DECLARE(bas, CONFIG_BT_BAS_LOG_LEVEL); | ||
|
||
#define BATTERY_CRITICAL_STATUS_CHAR_IDX 9 |
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.
For now this is fine, but if you start adding the other optional characteristics, then we can no longer rely on a static index.
An alternative is to use the UUID when calling bt_gatt_indicate
which will be futureproof
|
||
bt_bas_bcs_set_battery_critical_state(false); |
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.
If value == BT_BAS_BLS_CHARGE_LEVEL_UNKNOWN
should we really modify the state?
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.
You are correct, if battery is set to critical, then there shouldn't be an option to reset.
But in the case of testing , this reset will be handy.
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.
You are correct, if battery is set to critical, then there shouldn't be an option to reset.
That is not what I meant :)
And also incorrect; it should definitely be possible to reset the battery state from critical to non-critical, e.g. if changing the battery.
tests/bsim/bluetooth/samples/battery_service/src/central_test.c
Outdated
Show resolved
Hide resolved
tests/bsim/bluetooth/samples/battery_service/src/central_test.c
Outdated
Show resolved
Hide resolved
tests/bsim/bluetooth/samples/battery_service/src/central_test.c
Outdated
Show resolved
Hide resolved
a10ea39
to
f22209d
Compare
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.
Looks pretty good now. A few more comments
tests/bsim/bluetooth/samples/battery_service/src/central_test.c
Outdated
Show resolved
Hide resolved
tests/bsim/bluetooth/samples/battery_service/src/central_test.c
Outdated
Show resolved
Hide resolved
tests/bsim/bluetooth/samples/battery_service/src/central_test.c
Outdated
Show resolved
Hide resolved
0f46f8f
to
e499d8b
Compare
Added the battery critical status char to bas service as per bas_1.1 spec. Updated BSIM test for BAS service to test the INDs of BAS critical characteristic. Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
Added the battery critical status char to bas service as per bas_1.1 spec.
Updated BSIM test for BAS service to test the INDs of BAS critical characteristic.