bluez5: report HF indicator 2 based battery status

HF indicator 2 (see [assigned-numbers], Hands-Free Profile) is able to
report battery percentage at 1% intervals (in range [0, 100]), contrary
to the `+XAPL` `+IPHONEACCEV` extension which only supports 10%
increments.  This does not guarantee increased granularity however, as
peers may still be limited to imprecise battery measurements internally
or round to coarser percentages.
Supporting both additionally broadens the range of devices for which PW
can report its battery level.

[assigned-numbers]:
https://www.bluetooth.com/specifications/assigned-numbers/
This commit is contained in:
Zsombor Welker 2021-08-07 23:34:09 +02:00 committed by Wim Taymans
parent f816f702a5
commit f87942027f
2 changed files with 34 additions and 0 deletions

View file

@ -256,6 +256,12 @@ enum spa_bt_hfp_hf_feature {
SPA_BT_HFP_HF_FEATURE_ESCO_S4 = (1 << 9),
};
/* https://btprodspecificationrefs.blob.core.windows.net/assigned-numbers/Assigned%20Number%20Types/Hands-Free%20Profile.pdf */
enum spa_bt_hfp_hf_indicator {
SPA_BT_HFP_HF_INDICATOR_ENHANCED_SAFETY = 1,
SPA_BT_HFP_HF_INDICATOR_BATTERY_LEVEL = 2,
};
enum spa_bt_hfp_sdp_hf_features {
SPA_BT_HFP_SDP_HF_FEATURE_NONE = (0),
SPA_BT_HFP_SDP_HF_FEATURE_ECNR = (1 << 0),