diff mbox series

[BlueZ,v2,6/9] adapter: add function for checking adapter features, add CIS features

Message ID fec95d980e1d7c4588a227d24140a213d156470c.1676112710.git.pav@iki.fi (mailing list archive)
State New, archived
Headers show
Series [BlueZ,v2,1/9] doc: remove unimplemented Quality Report from MGMT settings | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint fail WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 1: T1 Title exceeds max length (84>80): "[BlueZ,v2,6/9] adapter: add function for checking adapter features, add CIS features"
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Pauli Virtanen Feb. 11, 2023, 10:53 a.m. UTC
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 mbox series

Patch

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,