Bluetooth: has: Fix HAS features value
The bt_has_register_param's preset_sync_support and independent_presets make sense only if CONFIG_BT_HAS_PRESET_COUNT is non-zero meaning the CONFIG_BT_HAS_PRESET_SUPPORT is enabled. Otherwise, those parameters shall be skipped. Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
parent
2971c0a588
commit
80f87b9480
2 changed files with 27 additions and 15 deletions
|
@ -72,10 +72,20 @@ struct bt_has_register_param {
|
||||||
/** Hearing Aid Type value */
|
/** Hearing Aid Type value */
|
||||||
enum bt_has_hearing_aid_type type;
|
enum bt_has_hearing_aid_type type;
|
||||||
|
|
||||||
/** Preset Synchronization Support. Only applicable for binaural hearing aids. */
|
/**
|
||||||
|
* @brief Preset Synchronization Support.
|
||||||
|
*
|
||||||
|
* Only applicable if @p type is @ref BT_HAS_HEARING_AID_TYPE_BINAURAL
|
||||||
|
* and @kconfig{CONFIG_BT_HAS_PRESET_COUNT} is non-zero.
|
||||||
|
*/
|
||||||
bool preset_sync_support;
|
bool preset_sync_support;
|
||||||
|
|
||||||
/** Independent Presets. Only applicable for binaural hearing aids. */
|
/**
|
||||||
|
* @brief Independent Presets.
|
||||||
|
*
|
||||||
|
* Only applicable if @p type is @ref BT_HAS_HEARING_AID_TYPE_BINAURAL
|
||||||
|
* and @kconfig{CONFIG_BT_HAS_PRESET_COUNT} is non-zero.
|
||||||
|
*/
|
||||||
bool independent_presets;
|
bool independent_presets;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1142,24 +1142,26 @@ int bt_has_register(const struct bt_has_register_param *param)
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_HAS_PRESET_SUPPORT)) {
|
if (IS_ENABLED(CONFIG_BT_HAS_PRESET_SUPPORT)) {
|
||||||
has.features |= BT_HAS_FEAT_DYNAMIC_PRESETS;
|
has.features |= BT_HAS_FEAT_DYNAMIC_PRESETS;
|
||||||
}
|
|
||||||
|
|
||||||
if (param->preset_sync_support) {
|
if (param->preset_sync_support) {
|
||||||
if (param->type != BT_HAS_HEARING_AID_TYPE_BINAURAL) {
|
if (param->type != BT_HAS_HEARING_AID_TYPE_BINAURAL) {
|
||||||
LOG_DBG("Preset sync support only available for binaural hearing aid type");
|
LOG_DBG("Preset sync support only available "
|
||||||
return -EINVAL;
|
"for binaural hearing aid type");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
has.features |= BT_HAS_FEAT_PRESET_SYNC_SUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
has.features |= BT_HAS_FEAT_PRESET_SYNC_SUPP;
|
if (param->independent_presets) {
|
||||||
}
|
if (param->type != BT_HAS_HEARING_AID_TYPE_BINAURAL) {
|
||||||
|
LOG_DBG("Independent presets only available "
|
||||||
|
"for binaural hearing aid type");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (param->independent_presets) {
|
has.features |= BT_HAS_FEAT_INDEPENDENT_PRESETS;
|
||||||
if (param->type != BT_HAS_HEARING_AID_TYPE_BINAURAL) {
|
|
||||||
LOG_DBG("Independent presets only available for binaural hearing aid type");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
has.features |= BT_HAS_FEAT_INDEPENDENT_PRESETS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_HAS_PRESET_NAME_DYNAMIC)) {
|
if (IS_ENABLED(CONFIG_BT_HAS_PRESET_NAME_DYNAMIC)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue