bluez5: handle XAPL battery level per Apple Guidelines

Corrects the handling of AT+XAPL Apple extensions to send
`+XAPL=iPhone,2` instead of `+XAPL: iPhone,2` based on Apple's
documentation.

Replaces magic numbers with enum values.

[Accessory Design Guidelines](https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf)
This commit is contained in:
Zsombor Welker 2021-08-12 21:45:22 +02:00
parent a1777d00e3
commit f5850af4d8
2 changed files with 27 additions and 6 deletions

View file

@ -60,8 +60,6 @@ extern "C" {
#define PIPEWIRE_BATTERY_PROVIDER "/org/freedesktop/pipewire/battery"
#define SPA_BT_HFP_HF_IPHONEACCEV_KEY_BATTERY 1
#define MIN_LATENCY 512
#define MAX_LATENCY 1024
@ -262,6 +260,23 @@ enum spa_bt_hfp_hf_indicator {
SPA_BT_HFP_HF_INDICATOR_BATTERY_LEVEL = 2,
};
/* HFP Command AT+IPHONEACCEV
* https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf */
enum spa_bt_hfp_hf_iphoneaccev_keys {
SPA_BT_HFP_HF_IPHONEACCEV_KEY_BATTERY_LEVEL = 1,
SPA_BT_HFP_HF_IPHONEACCEV_KEY_DOCK_STATE = 2,
};
/* HFP Command AT+XAPL
* https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf
* Bits 0, 5 and above are reserved. */
enum spa_bt_hfp_hf_xapl_features {
SPA_BT_HFP_HF_XAPL_FEATURE_BATTERY_REPORTING = (1 << 1),
SPA_BT_HFP_HF_XAPL_FEATURE_DOCKED_OR_POWERED = (1 << 2),
SPA_BT_HFP_HF_XAPL_FEATURE_SIRI_STATUS_REPORTING = (1 << 3),
SPA_BT_HFP_HF_XAPL_FEATURE_NOISE_REDUCTION_REPORTING = (1 << 4),
};
enum spa_bt_hfp_sdp_hf_features {
SPA_BT_HFP_SDP_HF_FEATURE_NONE = (0),
SPA_BT_HFP_SDP_HF_FEATURE_ECNR = (1 << 0),