diff --git a/subsys/bluetooth/audio/Kconfig.has b/subsys/bluetooth/audio/Kconfig.has index fa549c5621e..45644b9185b 100644 --- a/subsys/bluetooth/audio/Kconfig.has +++ b/subsys/bluetooth/audio/Kconfig.has @@ -66,7 +66,10 @@ config BT_HAS_PRESET_COUNT This option sets the number of Hearing Access Service Presets that can be registered. Setting this value to 0 disables Presets support. -if BT_HAS_PRESET_COUNT > 0 +config BT_HAS_PRESET_SUPPORT + def_bool BT_HAS_PRESET_COUNT > 0 + +if BT_HAS_PRESET_SUPPORT if BT_HAS_HEARING_AID_BINAURAL @@ -91,7 +94,7 @@ config BT_HAS_PRESET_NAME_DYNAMIC help Enabling this option allows for runtime configuration of preset name. -endif # BT_HAS_PRESET_COUNT > 0 +endif # BT_HAS_PRESET_SUPPORT config BT_DEBUG_HAS bool "Hearing Access Service debug" diff --git a/subsys/bluetooth/audio/has.c b/subsys/bluetooth/audio/has.c index fc803e6ca54..5ed53d9eacd 100644 --- a/subsys/bluetooth/audio/has.c +++ b/subsys/bluetooth/audio/has.c @@ -30,7 +30,7 @@ static struct bt_has has; -#if CONFIG_BT_HAS_PRESET_COUNT > 0 +#if defined(CONFIG_BT_HAS_PRESET_SUPPORT) static ssize_t write_control_point(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *data, uint16_t len, uint16_t offset, uint8_t flags); @@ -46,7 +46,7 @@ static ssize_t read_active_preset_index(struct bt_conn *conn, const struct bt_ga return bt_gatt_attr_read(conn, attr, buf, len, offset, &has.active_index, sizeof(has.active_index)); } -#endif /* CONFIG_BT_HAS_PRESET_COUNT > 0 */ +#endif /* CONFIG_BT_HAS_PRESET_SUPPORT */ static ssize_t read_features(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) @@ -71,7 +71,7 @@ BT_GATT_SERVICE_DEFINE(has_svc, BT_GATT_PRIMARY_SERVICE(BT_UUID_HAS), BT_GATT_CHARACTERISTIC(BT_UUID_HAS_HEARING_AID_FEATURES, BT_GATT_CHRC_READ, BT_GATT_PERM_READ_ENCRYPT, read_features, NULL, NULL), -#if CONFIG_BT_HAS_PRESET_COUNT > 0 +#if defined(CONFIG_BT_HAS_PRESET_SUPPORT) BT_GATT_CHARACTERISTIC(BT_UUID_HAS_PRESET_CONTROL_POINT, #if defined(CONFIG_BT_EATT) BT_GATT_CHRC_WRITE | BT_GATT_CHRC_INDICATE | BT_GATT_CHRC_NOTIFY, @@ -84,10 +84,10 @@ BT_GATT_SERVICE_DEFINE(has_svc, BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, BT_GATT_PERM_READ_ENCRYPT, read_active_preset_index, NULL, NULL), BT_GATT_CCC(ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE_ENCRYPT), -#endif /* CONFIG_BT_HAS_PRESET_COUNT > 0 */ +#endif /* CONFIG_BT_HAS_PRESET_SUPPORT */ ); -#if CONFIG_BT_HAS_PRESET_COUNT > 0 +#if defined(CONFIG_BT_HAS_PRESET_SUPPORT) #define PRESET_CONTROL_POINT_ATTR &has_svc.attrs[4] static struct has_client { @@ -706,7 +706,7 @@ void bt_has_preset_foreach(uint8_t index, bt_has_preset_func_t func, void *user_ preset_foreach(start_index, end_index, bt_has_preset_foreach_func, &data); } -#endif /* CONFIG_BT_HAS_PRESET_COUNT > 0 */ +#endif /* CONFIG_BT_HAS_PRESET_SUPPORT */ static int has_init(const struct device *dev) {