-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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: pacs: Add dynamic PACS registration #83730
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,43 @@ struct bt_pacs_cap { | |
sys_snode_t _node; | ||
}; | ||
|
||
/** Structure for registering PACS */ | ||
struct bt_bap_pacs_register_param { | ||
#if defined(CONFIG_BT_PAC_SNK) || defined(__DOXYGEN__) | ||
/** | ||
* @brief Enables or disables registration of Sink PAC Characteristic. | ||
*/ | ||
bool snk_pac; | ||
#endif /* CONFIG_BT_PAC_SNK */ | ||
|
||
#if defined(CONFIG_BT_PAC_SNK_LOC) || defined(__DOXYGEN__) | ||
/** | ||
* @brief Enables or disables registration of Sink Location Characteristic. | ||
* | ||
* Registration of Sink Location is dependent on @ref bt_bap_pacs_register_param.snk_pac | ||
* also being set. | ||
*/ | ||
bool snk_loc; | ||
#endif /* CONFIG_BT_PAC_SNK_LOC */ | ||
|
||
#if defined(CONFIG_BT_PAC_SRC) || defined(__DOXYGEN__) | ||
/** | ||
* @brief Enables or disables registration of Source PAC Characteristic. | ||
*/ | ||
bool src_pac; | ||
#endif /* CONFIG_BT_PAC_SRC */ | ||
|
||
#if defined(CONFIG_BT_PAC_SRC_LOC) || defined(__DOXYGEN__) | ||
/** | ||
* @brief Enables or disables registration of Source Location Characteristic. | ||
* | ||
* Registration of Source Location is dependent on @ref bt_bap_pacs_register_param.src_pac | ||
* also being set. | ||
*/ | ||
bool src_loc; | ||
#endif /* CONFIG_BT_PAC_SRC_LOC */ | ||
}; | ||
|
||
/** | ||
* @typedef bt_pacs_cap_foreach_func_t | ||
* @brief Published Audio Capability iterator callback. | ||
|
@@ -71,6 +108,22 @@ void bt_pacs_cap_foreach(enum bt_audio_dir dir, | |
bt_pacs_cap_foreach_func_t func, | ||
void *user_data); | ||
|
||
/** | ||
* @brief Register the Published Audio Capability Service instance. | ||
* | ||
* @param param PACS register parameters. | ||
* | ||
* @return 0 in case of success or negative value in case of error. | ||
*/ | ||
int bt_pacs_register(const struct bt_bap_pacs_register_param *param); | ||
|
||
/** | ||
* @brief Unregister the Published Audio Capability Service instance. | ||
* | ||
* @return 0 in case of success or negative value in case of error. | ||
*/ | ||
Comment on lines
+116
to
+124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If possible, please use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to keep it as is, as it will forward error codes from other functions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's one of the reasons to use We do not have any requirement in the coding guidelines for this, so I won't block the PR on this |
||
int bt_pacs_unregister(void); | ||
|
||
/** | ||
* @brief Register Published Audio Capability. | ||
* | ||
|
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.
Would it make sense to also add support for registering initial values here? i.e. the initial contexts, locations and records?
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.
It could, but it could also make sense not to do it. The current content of
struct bt_bap_pacs_register_param
strictly necessary to run the service, and they cannot easily be changed, in fact they would need a reregistration to change.Contexts, locations, and records can more easily change at runtime.
I would prefer to keep it as is for now - but if you really want this change Im happy to create an issue for future change.
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.
Sure :) It makes sense to keep as is, with the caveat that the default values are invalid, so the user shall call the other functions afterwards (similar as they have to today)