Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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
25#include <sys/types.h>
26
28#include <zephyr/sys/util.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
35#define BT_HAS_PRESET_INDEX_NONE 0x00
36#define BT_HAS_PRESET_INDEX_FIRST 0x01
37#define BT_HAS_PRESET_INDEX_LAST 0xFF
38
40#define BT_HAS_PRESET_NAME_MIN 1
42#define BT_HAS_PRESET_NAME_MAX 40
43
45struct bt_has;
46
52};
53
58
61
64};
65
69};
70
75
83
91};
92
97
100
102 const char *name;
103};
104
118 void (*discover)(struct bt_conn *conn, int err, struct bt_has *has,
119 enum bt_has_hearing_aid_type type, enum bt_has_capabilities caps);
120
134 void (*preset_switch)(struct bt_has *has, int err, uint8_t index);
135
148 void (*preset_read_rsp)(struct bt_has *has, int err,
149 const struct bt_has_preset_record *record, bool is_last);
150
163 void (*preset_update)(struct bt_has *has, uint8_t index_prev,
164 const struct bt_has_preset_record *record, bool is_last);
165
175 void (*preset_deleted)(struct bt_has *has, uint8_t index, bool is_last);
176
188 void (*preset_availability)(struct bt_has *has, uint8_t index, bool available,
189 bool is_last);
190};
191
199
211int bt_has_client_discover(struct bt_conn *conn);
212
224int bt_has_client_conn_get(const struct bt_has *has, struct bt_conn **conn);
225
239int bt_has_client_presets_read(struct bt_has *has, uint8_t index, uint8_t max_count);
240
253int bt_has_client_preset_set(struct bt_has *has, uint8_t index, bool sync);
254
266int bt_has_client_preset_next(struct bt_has *has, bool sync);
267
279int bt_has_client_preset_prev(struct bt_has *has, bool sync);
280
298 int (*select)(uint8_t index, bool sync);
299
308 void (*name_changed)(uint8_t index, const char *name);
309};
310
319
326
335 const char *name;
336
338 const struct bt_has_preset_ops *ops;
339};
340
348int bt_has_register(const struct bt_has_features_param *features);
349
361
372
384
396
397enum {
400};
401
414typedef uint8_t (*bt_has_preset_func_t)(uint8_t index, enum bt_has_properties properties,
415 const char *name, void *user_data);
416
426void bt_has_preset_foreach(uint8_t index, bt_has_preset_func_t func, void *user_data);
427
439
448
456static inline int bt_has_preset_active_clear(void)
457{
459}
460
471int bt_has_preset_name_change(uint8_t index, const char *name);
472
482int bt_has_features_set(const struct bt_has_features_param *features);
483
484#ifdef __cplusplus
485}
486#endif
487
492#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_HAS_H_ */
Bluetooth subsystem core APIs.
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:414
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
Preset index definitions.
Definition: has.h:35
int bt_has_client_preset_set(struct bt_has *has, uint8_t index, bool sync)
Set Active Preset.
bt_has_capabilities
Hearing Aid device capablilities.
Definition: has.h:67
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:456
bt_has_properties
Preset Properties values.
Definition: has.h:55
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.
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
Hearing Aid device type.
Definition: has.h:48
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.
@ BT_HAS_PRESET_SUPPORT
Definition: has.h:68
@ BT_HAS_PROP_NONE
No properties set.
Definition: has.h:57
@ BT_HAS_PROP_AVAILABLE
Preset availability.
Definition: has.h:63
@ BT_HAS_PROP_WRITABLE
Preset name can be written by the client.
Definition: has.h:60
@ BT_HAS_HEARING_AID_TYPE_MONAURAL
Definition: has.h:50
@ BT_HAS_HEARING_AID_TYPE_BINAURAL
Definition: has.h:49
@ BT_HAS_HEARING_AID_TYPE_BANDED
Definition: has.h:51
@ BT_HAS_PRESET_ITER_CONTINUE
Definition: has.h:399
@ BT_HAS_PRESET_ITER_STOP
Definition: has.h:398
#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:106
void(* preset_deleted)(struct bt_has *has, uint8_t index, bool is_last)
Callback function for preset deletion notifications.
Definition: has.h:175
void(* preset_switch)(struct bt_has *has, int err, uint8_t index)
Callback function for Hearing Access Service active preset changes.
Definition: has.h:134
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:148
void(* preset_availability)(struct bt_has *has, uint8_t index, bool available, bool is_last)
Callback function for preset availability notifications.
Definition: has.h:188
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:163
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:118
Structure for registering features of a Hearing Access Service instance.
Definition: has.h:72
bool independent_presets
Independent Presets.
Definition: has.h:90
enum bt_has_hearing_aid_type type
Hearing Aid Type value.
Definition: has.h:74
bool preset_sync_support
Preset Synchronization Support.
Definition: has.h:82
Preset operations structure.
Definition: has.h:282
void(* name_changed)(uint8_t index, const char *name)
Preset name changed callback.
Definition: has.h:308
int(* select)(uint8_t index, bool sync)
Preset select callback.
Definition: has.h:298
Preset record definition.
Definition: has.h:94
uint8_t index
Unique preset index.
Definition: has.h:96
const char * name
Preset name.
Definition: has.h:102
enum bt_has_properties properties
Bitfield of preset properties.
Definition: has.h:99
Register structure for preset.
Definition: has.h:312
const char * name
Preset name.
Definition: has.h:335
const struct bt_has_preset_ops * ops
Preset operations structure.
Definition: has.h:338
enum bt_has_properties properties
Preset properties.
Definition: has.h:325
uint8_t index
Preset index.
Definition: has.h:318
Misc utilities.