Skip to content

Commit 7457bcf

Browse files
fredrikdanebjernashif
authored andcommitted
Bluetooth: Audio: Make HAS optional notify characteristics optional
Added Kconfig options to make HAS characteristics that has notify as optional property selectable and thus optional. These settings are global, meaning that a chosen notify property will be used for all registered has instances. Signed-off-by: Fredrik Danebjer <[email protected]>
1 parent 527591a commit 7457bcf

File tree

9 files changed

+344
-78
lines changed

9 files changed

+344
-78
lines changed

include/zephyr/bluetooth/audio/has.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ enum bt_has_capabilities {
6868
BT_HAS_PRESET_SUPPORT = BIT(0),
6969
};
7070

71-
/** @brief Structure for registering a Hearing Access Service instance. */
72-
struct bt_has_register_param {
71+
/** @brief Structure for registering features of a Hearing Access Service instance. */
72+
struct bt_has_features_param {
7373
/** Hearing Aid Type value */
7474
enum bt_has_hearing_aid_type type;
7575

@@ -341,11 +341,11 @@ struct bt_has_preset_register_param {
341341
/**
342342
* @brief Register the Hearing Access Service instance.
343343
*
344-
* @param param Hearing Access Service register parameters.
344+
* @param features Hearing Access Service register parameters.
345345
*
346346
* @return 0 if success, errno on failure.
347347
*/
348-
int bt_has_register(const struct bt_has_register_param *param);
348+
int bt_has_register(const struct bt_has_features_param *features);
349349

350350
/**
351351
* @brief Register preset.
@@ -470,6 +470,17 @@ static inline int bt_has_preset_active_clear(void)
470470
*/
471471
int bt_has_preset_name_change(uint8_t index, const char *name);
472472

473+
/**
474+
* @brief Change the Hearing Aid Features.
475+
*
476+
* Change the hearing aid features.
477+
*
478+
* @param features The features to be set.
479+
*
480+
* @return 0 in case of success or negative value in case of error.
481+
*/
482+
int bt_has_features_set(const struct bt_has_features_param *features);
483+
473484
#ifdef __cplusplus
474485
}
475486
#endif

samples/bluetooth/hap_ha/src/has_server.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int has_server_preset_init(void)
7575
return 0;
7676
}
7777

78-
static struct bt_has_register_param param = {
78+
static struct bt_has_features_param features = {
7979
.type = BT_HAS_HEARING_AID_TYPE_MONAURAL,
8080
.preset_sync_support = false,
8181
.independent_presets = false
@@ -86,12 +86,12 @@ int has_server_init(void)
8686
int err;
8787

8888
if (IS_ENABLED(CONFIG_HAP_HA_HEARING_AID_BINAURAL)) {
89-
param.type = BT_HAS_HEARING_AID_TYPE_BINAURAL;
89+
features.type = BT_HAS_HEARING_AID_TYPE_BINAURAL;
9090
} else if (IS_ENABLED(CONFIG_HAP_HA_HEARING_AID_BANDED)) {
91-
param.type = BT_HAS_HEARING_AID_TYPE_BANDED;
91+
features.type = BT_HAS_HEARING_AID_TYPE_BANDED;
9292
}
9393

94-
err = bt_has_register(&param);
94+
err = bt_has_register(&features);
9595
if (err) {
9696
return err;
9797
}

subsys/bluetooth/audio/Kconfig.has

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ menuconfig BT_HAS
1515

1616
if BT_HAS
1717

18+
config BT_HAS_FEATURES_NOTIFIABLE
19+
bool "Hearing Aid Features Notifiable Support"
20+
help
21+
This option enables support for clients to subscribe for notifications
22+
on the Hearing Aid Features characteristic.
23+
1824
config BT_HAS_PRESET_COUNT
1925
int "Preset record list size"
2026
default 2
@@ -33,6 +39,18 @@ config BT_HAS_PRESET_NAME_DYNAMIC
3339
help
3440
Enabling this option allows for runtime configuration of preset name.
3541

42+
config BT_HAS_PRESET_CONTROL_POINT_NOTIFIABLE
43+
bool "Preset Control Point Notifiable support"
44+
depends on BT_HAS_PRESET_SUPPORT && BT_EATT
45+
help
46+
This option enables support for clients to subscribe for notifications
47+
on the Hearing Aid Preset Control Point characteristic.
48+
49+
config BT_HAS_ACTIVE_PRESET_INDEX
50+
def_bool BT_HAS_PRESET_SUPPORT
51+
help
52+
This option enables the Hearing Aid Active Preset Index characteristic.
53+
3654
endif # BT_HAS_PRESET_SUPPORT
3755

3856
endif # BT_HAS

0 commit comments

Comments
 (0)