Zephyr API 3.6.99
Loading...
Searching...
No Matches
Hearing Access Service (HAS)

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.
 

Detailed Description

Hearing Access Service (HAS)

Since
3.1
Version
0.8.0

The Hearing Access Service is used to identify a hearing aid and optionally to control hearing aid presets.

Macro Definition Documentation

◆ BT_HAS_PRESET_INDEX_FIRST

#define BT_HAS_PRESET_INDEX_FIRST   0x01

#include <zephyr/bluetooth/audio/has.h>

First preset index.

◆ BT_HAS_PRESET_INDEX_LAST

#define BT_HAS_PRESET_INDEX_LAST   0xFF

#include <zephyr/bluetooth/audio/has.h>

Last preset index.

◆ BT_HAS_PRESET_INDEX_NONE

#define BT_HAS_PRESET_INDEX_NONE   0x00

#include <zephyr/bluetooth/audio/has.h>

No index.

◆ BT_HAS_PRESET_NAME_MAX

#define BT_HAS_PRESET_NAME_MAX   40

#include <zephyr/bluetooth/audio/has.h>

Preset name maximum length.

◆ BT_HAS_PRESET_NAME_MIN

#define BT_HAS_PRESET_NAME_MIN   1

#include <zephyr/bluetooth/audio/has.h>

Preset name minimum length.

Typedef Documentation

◆ bt_has_preset_func_t

typedef uint8_t(* bt_has_preset_func_t) (uint8_t index, enum bt_has_properties properties, const char *name, void *user_data)

#include <zephyr/bluetooth/audio/has.h>

Preset iterator callback.

Parameters
indexThe index of preset found.
propertiesPreset properties.
namePreset name.
user_dataData given.
Returns
BT_HAS_PRESET_ITER_CONTINUE if should continue to the next preset.
BT_HAS_PRESET_ITER_STOP to stop.

Enumeration Type Documentation

◆ anonymous enum

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.

◆ bt_has_capabilities

#include <zephyr/bluetooth/audio/has.h>

Hearing Aid device capabilities.

Enumerator
BT_HAS_PRESET_SUPPORT 

Indicate support for presets.

◆ bt_has_hearing_aid_type

#include <zephyr/bluetooth/audio/has.h>

Hearing Aid device type.

Enumerator
BT_HAS_HEARING_AID_TYPE_BINAURAL 

Two hearing aids that form a Coordinated Set, one for the right ear and one for the left ear of the user.

Typically used by a user with bilateral hearing loss.

BT_HAS_HEARING_AID_TYPE_MONAURAL 

A single hearing aid for the left or the right ear.

Typically used by a user with unilateral hearing loss.

BT_HAS_HEARING_AID_TYPE_BANDED 

Two hearing aids with a connection to one another that expose a single Bluetooth radio interface.

◆ 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.

Function Documentation

◆ bt_has_client_cb_register()

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.

Parameters
cbThe callback structure.
Returns
0 in case of success or negative value in case of error.

◆ bt_has_client_conn_get()

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.

Parameters
[in]hasPointer to the Hearing Access Service object.
[out]connConnection object.
Returns
0 in case of success or negative value in case of error.

◆ bt_has_client_discover()

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.

Parameters
connBluetooth connection object.
Returns
0 if success, errno on failure.

◆ bt_has_client_preset_next()

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.

Parameters
hasPointer to the Hearing Access Service object.
syncRequest active preset synchronization in set.
Returns
0 in case of success or negative value in case of error.

◆ bt_has_client_preset_prev()

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.

Parameters
hasPointer to the Hearing Access Service object.
syncRequest active preset synchronization in set.
Returns
0 in case of success or negative value in case of error.

◆ bt_has_client_preset_set()

int bt_has_client_preset_set ( struct bt_has * has,
uint8_t index,
bool sync )

#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.

Parameters
hasPointer to the Hearing Access Service object.
indexPreset index to activate.
syncRequest active preset synchronization in set.
Returns
0 in case of success or negative value in case of error.

◆ bt_has_client_presets_read()

int bt_has_client_presets_read ( struct bt_has * has,
uint8_t index,
uint8_t max_count )

#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).

Parameters
hasPointer to the Hearing Access Service object.
indexThe index to start with.
max_countMaximum number of presets to read.
Returns
0 in case of success or negative value in case of error.

◆ bt_has_features_set()

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.

Parameters
featuresThe features to be set.
Returns
0 in case of success or negative value in case of error.

◆ bt_has_preset_active_clear()

static int bt_has_preset_active_clear ( void )
inlinestatic

#include <zephyr/bluetooth/audio/has.h>

Clear out active preset.

Used by server to deactivate currently active preset.

Returns
0 in case of success or negative value in case of error.

◆ bt_has_preset_active_get()

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.

Returns
Active preset index.

◆ bt_has_preset_active_set()

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.

Parameters
indexPreset index.
Returns
0 in case of success or negative value in case of error.

◆ bt_has_preset_available()

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.

Parameters
indexThe index of preset that's became available.
Returns
0 in case of success or negative value in case of error.

◆ bt_has_preset_foreach()

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.

Parameters
indexPreset index, passing BT_HAS_PRESET_INDEX_NONE skips index matching.
funcCallback function.
user_dataData to pass to the callback.

◆ bt_has_preset_name_change()

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.

Parameters
indexThe index of the preset to change the name of.
nameName to write.
Returns
0 in case of success or negative value in case of error.

◆ bt_has_preset_register()

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.

Parameters
paramPreset registration parameter.
Returns
0 if success, errno on failure.

◆ bt_has_preset_unavailable()

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.

Parameters
indexThe index of preset that's became unavailable.
Returns
0 in case of success or negative value in case of error.

◆ bt_has_preset_unregister()

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.

Parameters
indexThe index of preset that's being requested to unregister.
Returns
0 if success, errno on failure.

◆ bt_has_register()

int bt_has_register ( const struct bt_has_features_param * features)

#include <zephyr/bluetooth/audio/has.h>

Register the Hearing Access Service instance.

Parameters
featuresHearing Access Service register parameters.
Returns
0 if success, errno on failure.