Zephyr API Documentation 4.4.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
has.h
Go to the documentation of this file.
1
5
6/*
7 * Copyright (c) 2022 Codecoup
8 * Copyright (c) 2024 Nordic Semiconductor ASA
9 *
10 * SPDX-License-Identifier: Apache-2.0
11 */
12
13#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_HAS_H_
14#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_HAS_H_
15
30
31#include <stdint.h>
32#include <stdbool.h>
33
35#include <zephyr/sys/util.h>
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
47#define BT_HAS_PRESET_INDEX_NONE 0x00
49#define BT_HAS_PRESET_INDEX_FIRST 0x01
51#define BT_HAS_PRESET_INDEX_LAST 0xFF
53
55#define BT_HAS_PRESET_NAME_MIN 1
57#define BT_HAS_PRESET_NAME_MAX 40
58
63struct bt_has;
64
83
95
101
123
135
149 void (*discover)(struct bt_conn *conn, int err, struct bt_has *has,
150 enum bt_has_hearing_aid_type type, enum bt_has_capabilities caps);
151
165 void (*preset_switch)(struct bt_has *has, int err, uint8_t index);
166
179 void (*preset_read_rsp)(struct bt_has *has, int err,
180 const struct bt_has_preset_record *record, bool is_last);
181
194 void (*preset_update)(struct bt_has *has, uint8_t index_prev,
195 const struct bt_has_preset_record *record, bool is_last);
196
206 void (*preset_deleted)(struct bt_has *has, uint8_t index, bool is_last);
207
219 void (*preset_availability)(struct bt_has *has, uint8_t index, bool available,
220 bool is_last);
221};
222
231
244
256int bt_has_client_conn_get(const struct bt_has *has, struct bt_conn **conn);
257
271int bt_has_client_presets_read(struct bt_has *has, uint8_t index, uint8_t max_count);
272
285int bt_has_client_preset_set(struct bt_has *has, uint8_t index, bool sync);
286
298int bt_has_client_preset_next(struct bt_has *has, bool sync);
299
311int bt_has_client_preset_prev(struct bt_has *has, bool sync);
312
330 int (*select)(uint8_t index, bool sync);
331
340 void (*name_changed)(uint8_t index, const char *name);
341};
342
372
380int bt_has_register(const struct bt_has_features_param *features);
381
393
404
416
428
441typedef bool (*bt_has_preset_func_t)(uint8_t index, enum bt_has_properties properties,
442 const char *name, void *user_data);
443
457int bt_has_preset_foreach(uint8_t index, bt_has_preset_func_t func, void *user_data);
458
470
479
491
502int bt_has_preset_name_change(uint8_t index, const char *name);
503
513int bt_has_features_set(const struct bt_has_features_param *features);
514
515#ifdef __cplusplus
516}
517#endif
518
522
523#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_HAS_H_ */
Bluetooth subsystem core APIs.
int 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.
int bt_has_preset_unregister(uint8_t index)
Unregister Preset.
int bt_has_client_preset_prev(struct bt_has *has, bool sync)
Activate Previous Preset.
#define BT_HAS_PRESET_INDEX_NONE
No index.
Definition has.h:47
int bt_has_client_preset_set(struct bt_has *has, uint8_t index, bool sync)
Set Active Preset.
bt_has_capabilities
Hearing Aid device capabilities.
Definition has.h:97
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_next(struct bt_has *has, bool sync)
Activate Next Preset.
int bt_has_preset_name_change(uint8_t index, const char *name)
Change the Preset Name.
static int bt_has_preset_active_clear(void)
Clear out active preset.
Definition has.h:487
bt_has_properties
Preset Properties values.
Definition has.h:85
int bt_has_features_set(const struct bt_has_features_param *features)
Change the Hearing Aid Features.
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_cb_register(const struct bt_has_client_cb *cb)
Registers the callbacks used by the Hearing Access Service client.
bt_has_hearing_aid_type
Hearing Aid device type.
Definition has.h:66
int bt_has_preset_unavailable(uint8_t index)
Set the preset as unavailable.
int bt_has_register(const struct bt_has_features_param *features)
Register the Hearing Access Service instance.
int bt_has_preset_available(uint8_t index)
Set the preset as available.
int bt_has_preset_register(const struct bt_has_preset_register_param *param)
Register preset.
uint8_t bt_has_preset_active_get(void)
Get active preset.
int bt_has_client_discover(struct bt_conn *conn)
Discover Hearing Access Service on a remote device.
bool(* bt_has_preset_func_t)(uint8_t index, enum bt_has_properties properties, const char *name, void *user_data)
Preset iterator callback.
Definition has.h:441
@ BT_HAS_PRESET_SUPPORT
Indicate support for presets.
Definition has.h:99
@ BT_HAS_PROP_NONE
No properties set.
Definition has.h:87
@ BT_HAS_PROP_AVAILABLE
Preset availability.
Definition has.h:93
@ BT_HAS_PROP_WRITABLE
Preset name can be written by the client.
Definition has.h:90
@ BT_HAS_HEARING_AID_TYPE_MONAURAL
A single hearing aid for the left or the right ear.
Definition has.h:76
@ 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 u...
Definition has.h:71
@ BT_HAS_HEARING_AID_TYPE_BANDED
Two hearing aids with a connection to one another that expose a single Bluetooth radio interface.
Definition has.h:81
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
#define bool
Definition stdbool.h:13
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Opaque type representing a connection to a remote device.
Hearing Access Service Client callback structure.
Definition has.h:137
void(* preset_deleted)(struct bt_has *has, uint8_t index, bool is_last)
Callback function for preset deletion notifications.
Definition has.h:206
void(* preset_switch)(struct bt_has *has, int err, uint8_t index)
Callback function for Hearing Access Service active preset changes.
Definition has.h:165
void(* preset_read_rsp)(struct bt_has *has, int err, const struct bt_has_preset_record *record, bool is_last)
Callback function for presets read operation.
Definition has.h:179
void(* preset_availability)(struct bt_has *has, uint8_t index, bool available, bool is_last)
Callback function for preset availability notifications.
Definition has.h:219
void(* preset_update)(struct bt_has *has, uint8_t index_prev, const struct bt_has_preset_record *record, bool is_last)
Callback function for preset update notifications.
Definition has.h:194
void(* discover)(struct bt_conn *conn, int err, struct bt_has *has, enum bt_has_hearing_aid_type type, enum bt_has_capabilities caps)
Callback function for bt_has_discover.
Definition has.h:149
Structure for registering features of a Hearing Access Service instance.
Definition has.h:103
bool independent_presets
Independent Presets.
Definition has.h:121
enum bt_has_hearing_aid_type type
Hearing Aid Type value.
Definition has.h:105
bool preset_sync_support
Preset Synchronization Support.
Definition has.h:113
Preset operations structure.
Definition has.h:314
void(* name_changed)(uint8_t index, const char *name)
Preset name changed callback.
Definition has.h:340
int(* select)(uint8_t index, bool sync)
Preset select callback.
Definition has.h:330
Preset record definition.
Definition has.h:125
uint8_t index
Unique preset index.
Definition has.h:127
const char * name
Preset name.
Definition has.h:133
enum bt_has_properties properties
Bitfield of preset properties.
Definition has.h:130
Register structure for preset.
Definition has.h:344
const char * name
Preset name.
Definition has.h:367
const struct bt_has_preset_ops * ops
Preset operations structure.
Definition has.h:370
enum bt_has_properties properties
Preset properties.
Definition has.h:357
uint8_t index
Preset index.
Definition has.h:350
Opaque Hearing Access Service object.
Misc utilities.
Macro utilities.