Zephyr Project API  3.2.0
A Scalable Open Source RTOS
has.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Codecoup
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_HAS_H_
8#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_HAS_H_
9
26#include <sys/types.h>
27#include <zephyr/sys/util.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
34#define BT_HAS_PRESET_INDEX_NONE 0x00
35#define BT_HAS_PRESET_INDEX_FIRST 0x01
36#define BT_HAS_PRESET_INDEX_LAST 0xFF
37
39#define BT_HAS_PRESET_NAME_MIN 1
41#define BT_HAS_PRESET_NAME_MAX 40
42
44struct bt_has;
45
51};
52
57
60
63};
64
68};
69
74
77
79 const char *name;
80};
81
95 void (*discover)(struct bt_conn *conn, int err, struct bt_has *has,
96 enum bt_has_hearing_aid_type type, enum bt_has_capabilities caps);
97
111 void (*preset_switch)(struct bt_has *has, int err, uint8_t index);
112
125 void (*preset_read_rsp)(struct bt_has *has, int err,
126 const struct bt_has_preset_record *record, bool is_last);
127
140 void (*preset_update)(struct bt_has *has, uint8_t index_prev,
141 const struct bt_has_preset_record *record, bool is_last);
142
152 void (*preset_deleted)(struct bt_has *has, uint8_t index, bool is_last);
153
165 void (*preset_availability)(struct bt_has *has, uint8_t index, bool available,
166 bool is_last);
167};
168
176
188int bt_has_client_discover(struct bt_conn *conn);
189
201int bt_has_client_conn_get(const struct bt_has *has, struct bt_conn **conn);
202
216int bt_has_client_presets_read(struct bt_has *has, uint8_t index, uint8_t max_count);
217
230int bt_has_client_preset_set(struct bt_has *has, uint8_t index, bool sync);
231
243int bt_has_client_preset_next(struct bt_has *has, bool sync);
244
256int bt_has_client_preset_prev(struct bt_has *has, bool sync);
257
275 int (*select)(uint8_t index, bool sync);
276
285 void (*name_changed)(uint8_t index, const char *name);
286};
287
296
303
312 const char *name;
313
315 const struct bt_has_preset_ops *ops;
316};
317
329
340
352
364
365enum {
368};
369
383 const char *name, void *user_data);
384
395
407
416
424static inline int bt_has_preset_active_clear(void)
425{
427}
428
440
441#ifdef __cplusplus
442}
443#endif
444
449#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_HAS_H_ */
Bluetooth subsystem core APIs.
ZTEST_BMEM int index[(3)]
Definition: main.c:32
uint8_t(* 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:382
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
Definition: has.h:34
int bt_has_client_preset_set(struct bt_has *has, uint8_t index, bool sync)
Set Active Preset.
bt_has_capabilities
Definition: has.h:66
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:424
bt_has_properties
Definition: has.h:54
int bt_has_client_conn_get(const struct bt_has *has, struct bt_conn **conn)
Get the Bluetooth connection object of the service object.
void bt_has_preset_foreach(uint8_t index, bt_has_preset_func_t func, void *user_data)
Preset iterator.
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
Definition: has.h:47
int bt_has_preset_unavailable(uint8_t index)
Set the preset as unavailable.
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.
@ BT_HAS_PRESET_ITER_CONTINUE
Definition: has.h:367
@ BT_HAS_PRESET_ITER_STOP
Definition: has.h:366
@ BT_HAS_PRESET_SUPPORT
Definition: has.h:67
@ BT_HAS_PROP_NONE
Definition: has.h:56
@ BT_HAS_PROP_AVAILABLE
Definition: has.h:62
@ BT_HAS_PROP_WRITABLE
Definition: has.h:59
@ BT_HAS_HEARING_AID_TYPE_MONAURAL
Definition: has.h:49
@ BT_HAS_HEARING_AID_TYPE_BINAURAL
Definition: has.h:48
@ BT_HAS_HEARING_AID_TYPE_BANDED
Definition: has.h:50
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Hearing Access Service Client callback structure.
Definition: has.h:83
void(* preset_deleted)(struct bt_has *has, uint8_t index, bool is_last)
Callback function for preset deletion notifications.
Definition: has.h:152
void(* preset_switch)(struct bt_has *has, int err, uint8_t index)
Callback function for Hearing Access Service active preset changes.
Definition: has.h:111
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:125
void(* preset_availability)(struct bt_has *has, uint8_t index, bool available, bool is_last)
Callback function for preset availability notifications.
Definition: has.h:165
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:140
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:95
Preset operations structure.
Definition: has.h:259
void(* name_changed)(uint8_t index, const char *name)
Preset name changed callback.
Definition: has.h:285
int(* select)(uint8_t index, bool sync)
Preset select callback.
Definition: has.h:275
Preset record definition.
Definition: has.h:71
uint8_t index
Definition: has.h:73
const char * name
Definition: has.h:79
enum bt_has_properties properties
Definition: has.h:76
Register structure for preset.
Definition: has.h:289
const char * name
Preset name.
Definition: has.h:312
const struct bt_has_preset_ops * ops
Definition: has.h:315
enum bt_has_properties properties
Preset properties.
Definition: has.h:302
uint8_t index
Preset index.
Definition: has.h:295
static const intptr_t user_data[5]
Definition: main.c:588
Misc utilities.