Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
Hearing Access Service (HAS) More...
Data Structures | |
struct | bt_has_features_param |
Structure for registering features of a Hearing Access Service instance. More... | |
struct | bt_has_preset_record |
Preset record definition. More... | |
struct | bt_has_client_cb |
Hearing Access Service Client callback structure. More... | |
struct | bt_has_preset_ops |
Preset operations structure. More... | |
struct | bt_has_preset_register_param |
Register structure for preset. More... | |
Macros | |
#define | BT_HAS_PRESET_NAME_MIN 1 |
Preset name minimum length. | |
#define | BT_HAS_PRESET_NAME_MAX 40 |
Preset name maximum length. | |
Typedefs | |
typedef uint8_t(* | bt_has_preset_func_t) (uint8_t index, enum bt_has_properties properties, const char *name, void *user_data) |
Preset iterator callback. | |
Enumerations | |
enum | bt_has_hearing_aid_type { BT_HAS_HEARING_AID_TYPE_BINAURAL = 0x00 , BT_HAS_HEARING_AID_TYPE_MONAURAL = 0x01 , BT_HAS_HEARING_AID_TYPE_BANDED = 0x02 } |
Hearing Aid device type. More... | |
enum | bt_has_properties { BT_HAS_PROP_NONE = 0 , BT_HAS_PROP_WRITABLE = BIT(0) , BT_HAS_PROP_AVAILABLE = BIT(1) } |
Preset Properties values. More... | |
enum | bt_has_capabilities { BT_HAS_PRESET_SUPPORT = BIT(0) } |
Hearing Aid device capabilities. More... | |
enum | { BT_HAS_PRESET_ITER_STOP = 0 , BT_HAS_PRESET_ITER_CONTINUE } |
Enum for return values for bt_has_preset_func_t functions. More... | |
Functions | |
int | bt_has_client_cb_register (const struct bt_has_client_cb *cb) |
Registers the callbacks used by the Hearing Access Service client. | |
int | bt_has_client_discover (struct bt_conn *conn) |
Discover Hearing Access Service on a remote device. | |
int | bt_has_client_conn_get (const struct bt_has *has, struct bt_conn **conn) |
Get the Bluetooth connection object of the service object. | |
int | bt_has_client_presets_read (struct bt_has *has, uint8_t index, uint8_t max_count) |
Read Preset Records. | |
int | bt_has_client_preset_set (struct bt_has *has, uint8_t index, bool sync) |
Set Active Preset. | |
int | bt_has_client_preset_next (struct bt_has *has, bool sync) |
Activate Next Preset. | |
int | bt_has_client_preset_prev (struct bt_has *has, bool sync) |
Activate Previous Preset. | |
int | bt_has_register (const struct bt_has_features_param *features) |
Register the Hearing Access Service instance. | |
int | bt_has_preset_register (const struct bt_has_preset_register_param *param) |
Register preset. | |
int | bt_has_preset_unregister (uint8_t index) |
Unregister Preset. | |
int | bt_has_preset_available (uint8_t index) |
Set the preset as available. | |
int | bt_has_preset_unavailable (uint8_t index) |
Set the preset as unavailable. | |
void | bt_has_preset_foreach (uint8_t index, bt_has_preset_func_t func, void *user_data) |
Preset iterator. | |
int | bt_has_preset_active_set (uint8_t index) |
Set active preset. | |
uint8_t | bt_has_preset_active_get (void) |
Get active preset. | |
static int | bt_has_preset_active_clear (void) |
Clear out active preset. | |
int | bt_has_preset_name_change (uint8_t index, const char *name) |
Change the Preset Name. | |
int | bt_has_features_set (const struct bt_has_features_param *features) |
Change the Hearing Aid Features. | |
Preset index definitions | |
#define | BT_HAS_PRESET_INDEX_NONE 0x00 |
No index. | |
#define | BT_HAS_PRESET_INDEX_FIRST 0x01 |
First preset index. | |
#define | BT_HAS_PRESET_INDEX_LAST 0xFF |
Last preset index. | |
Hearing Access Service (HAS)
The Hearing Access Service is used to identify a hearing aid and optionally to control hearing aid presets.
#define BT_HAS_PRESET_INDEX_FIRST 0x01 |
#include <zephyr/bluetooth/audio/has.h>
First preset index.
#define BT_HAS_PRESET_INDEX_LAST 0xFF |
#include <zephyr/bluetooth/audio/has.h>
Last preset index.
#define BT_HAS_PRESET_INDEX_NONE 0x00 |
#include <zephyr/bluetooth/audio/has.h>
No index.
#define BT_HAS_PRESET_NAME_MAX 40 |
#include <zephyr/bluetooth/audio/has.h>
Preset name maximum length.
#define BT_HAS_PRESET_NAME_MIN 1 |
#include <zephyr/bluetooth/audio/has.h>
Preset name minimum length.
bt_has_preset_func_t |
#include <zephyr/bluetooth/audio/has.h>
Preset iterator callback.
index | The index of preset found. |
properties | Preset properties. |
name | Preset name. |
user_data | Data given. |
anonymous enum |
#include <zephyr/bluetooth/audio/has.h>
Enum for return values for bt_has_preset_func_t functions.
Enumerator | |
---|---|
BT_HAS_PRESET_ITER_STOP | Stop iterating. |
BT_HAS_PRESET_ITER_CONTINUE | Continue iterating. |
enum bt_has_capabilities |
#include <zephyr/bluetooth/audio/has.h>
Hearing Aid device capabilities.
Enumerator | |
---|---|
BT_HAS_PRESET_SUPPORT | Indicate support for presets. |
#include <zephyr/bluetooth/audio/has.h>
Hearing Aid device type.
enum bt_has_properties |
#include <zephyr/bluetooth/audio/has.h>
Preset Properties values.
Enumerator | |
---|---|
BT_HAS_PROP_NONE | No properties set. |
BT_HAS_PROP_WRITABLE | Preset name can be written by the client. |
BT_HAS_PROP_AVAILABLE | Preset availability. |
int bt_has_client_cb_register | ( | const struct bt_has_client_cb * | cb | ) |
#include <zephyr/bluetooth/audio/has.h>
Registers the callbacks used by the Hearing Access Service client.
cb | The callback structure. |
int bt_has_client_conn_get | ( | const struct bt_has * | has, |
struct bt_conn ** | conn | ||
) |
#include <zephyr/bluetooth/audio/has.h>
Get the Bluetooth connection object of the service object.
The caller gets a new reference to the connection object which must be released with bt_conn_unref() once done using the object.
[in] | has | Pointer to the Hearing Access Service object. |
[out] | conn | Connection object. |
int bt_has_client_discover | ( | struct bt_conn * | conn | ) |
#include <zephyr/bluetooth/audio/has.h>
Discover Hearing Access Service on a remote device.
Client method to find a Hearing Access Service on a server identified by conn
. The bt_has_client_cb::discover callback will be called when the discovery procedure is complete to provide user a Hearing Access Service (HAS) object.
conn | Bluetooth connection object. |
int bt_has_client_preset_next | ( | struct bt_has * | has, |
bool | sync | ||
) |
#include <zephyr/bluetooth/audio/has.h>
Activate Next Preset.
Client procedure to set next available preset as active. The status is returned in the bt_has_client_cb::preset_switch callback.
has | Pointer to the Hearing Access Service object. |
sync | Request active preset synchronization in set. |
int bt_has_client_preset_prev | ( | struct bt_has * | has, |
bool | sync | ||
) |
#include <zephyr/bluetooth/audio/has.h>
Activate Previous Preset.
Client procedure to set previous available preset as active. The status is returned in the bt_has_client_cb::preset_switch callback.
has | Pointer to the Hearing Access Service object. |
sync | Request active preset synchronization in set. |
#include <zephyr/bluetooth/audio/has.h>
Set Active Preset.
Client procedure to set preset identified by index
as active. The status is returned in the bt_has_client_cb::preset_switch callback.
has | Pointer to the Hearing Access Service object. |
index | Preset index to activate. |
sync | Request active preset synchronization in set. |
#include <zephyr/bluetooth/audio/has.h>
Read Preset Records.
Client method to read up to max_count
presets starting from given index
. The preset records are returned in the bt_has_client_cb::preset_read_rsp callback (called once for each preset).
has | Pointer to the Hearing Access Service object. |
index | The index to start with. |
max_count | Maximum number of presets to read. |
int bt_has_features_set | ( | const struct bt_has_features_param * | features | ) |
#include <zephyr/bluetooth/audio/has.h>
Change the Hearing Aid Features.
Change the hearing aid features.
features | The features to be set. |
|
inlinestatic |
#include <zephyr/bluetooth/audio/has.h>
Clear out active preset.
Used by server to deactivate currently active preset.
uint8_t bt_has_preset_active_get | ( | void | ) |
#include <zephyr/bluetooth/audio/has.h>
Get active preset.
Function used to get the currently active preset index.
int bt_has_preset_active_set | ( | uint8_t | index | ) |
#include <zephyr/bluetooth/audio/has.h>
Set active preset.
Function used to set the preset identified by the index
as the active preset. The preset index will be notified to peer devices.
index | Preset index. |
int bt_has_preset_available | ( | uint8_t | index | ) |
#include <zephyr/bluetooth/audio/has.h>
Set the preset as available.
Set the BT_HAS_PROP_AVAILABLE property bit. This will notify preset availability to peer devices. Only available preset can be selected as active preset.
index | The index of preset that's became available. |
void bt_has_preset_foreach | ( | uint8_t | index, |
bt_has_preset_func_t | func, | ||
void * | user_data | ||
) |
#include <zephyr/bluetooth/audio/has.h>
Preset iterator.
Iterate presets. Optionally, match non-zero index if given.
index | Preset index, passing BT_HAS_PRESET_INDEX_NONE skips index matching. |
func | Callback function. |
user_data | Data to pass to the callback. |
int bt_has_preset_name_change | ( | uint8_t | index, |
const char * | name | ||
) |
#include <zephyr/bluetooth/audio/has.h>
Change the Preset Name.
Change the name of the preset identified by index
.
index | The index of the preset to change the name of. |
name | Name to write. |
int bt_has_preset_register | ( | const struct bt_has_preset_register_param * | param | ) |
#include <zephyr/bluetooth/audio/has.h>
Register preset.
Register preset. The preset will be a added to the list of exposed preset records. This symbol is linkable if CONFIG_BT_HAS_PRESET_COUNT
is non-zero.
param | Preset registration parameter. |
int bt_has_preset_unavailable | ( | uint8_t | index | ) |
#include <zephyr/bluetooth/audio/has.h>
Set the preset as unavailable.
Clear the BT_HAS_PROP_AVAILABLE property bit. This will notify preset availability to peer devices. Unavailable preset cannot be selected as active preset.
index | The index of preset that's became unavailable. |
int bt_has_preset_unregister | ( | uint8_t | index | ) |
#include <zephyr/bluetooth/audio/has.h>
Unregister Preset.
Unregister preset. The preset will be removed from the list of preset records.
index | The index of preset that's being requested to unregister. |
int bt_has_register | ( | const struct bt_has_features_param * | features | ) |
#include <zephyr/bluetooth/audio/has.h>
Register the Hearing Access Service instance.
features | Hearing Access Service register parameters. |