Add function for checking adapter features, similar to btd_has_kernel_features. Currently supports the CIS feature bits. --- Notes: v2: use feature flags, not separate functions src/adapter.c | 13 +++++++++++++ src/adapter.h | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index aadad4016..4ccacdb8b 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -10712,6 +10712,19 @@ bool btd_le_connect_before_pairing(void) return false; } +bool btd_adapter_has_features(struct btd_adapter *adapter, uint32_t features) +{ + uint32_t flags = 0; + + if (adapter->current_settings & MGMT_SETTING_CIS_CENTRAL) + flags |= ADAPTER_CIS_CENTRAL; + + if (adapter->current_settings & MGMT_SETTING_CIS_PERIPHERAL) + flags |= ADAPTER_CIS_PERIPHERAL; + + return (flags & features) ? true : false; +} + bool btd_has_kernel_features(uint32_t features) { return (kernel_features & features) ? true : false; diff --git a/src/adapter.h b/src/adapter.h index 78eb069ae..96a8668d5 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -256,6 +256,13 @@ void btd_adapter_for_each_device(struct btd_adapter *adapter, bool btd_le_connect_before_pairing(void); +enum adapter_features { + ADAPTER_CIS_CENTRAL = 1 << 0, + ADAPTER_CIS_PERIPHERAL = 1 << 1, +}; + +bool btd_adapter_has_features(struct btd_adapter *adapter, uint32_t features); + enum experimental_features { EXP_FEAT_DEBUG = 1 << 0, EXP_FEAT_LE_SIMULT_ROLES = 1 << 1, -- 2.39.1