Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
aics.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_AICS_H_
8#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_AICS_H_
9
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
38#define BT_AICS_STATE_UNMUTED 0x00
39#define BT_AICS_STATE_MUTED 0x01
40#define BT_AICS_STATE_MUTE_DISABLED 0x02
41
43#define BT_AICS_MODE_MANUAL_ONLY 0x00
44#define BT_AICS_MODE_AUTO_ONLY 0x01
45#define BT_AICS_MODE_MANUAL 0x02
46#define BT_AICS_MODE_AUTO 0x03
47
49#define BT_AICS_INPUT_TYPE_UNSPECIFIED 0x00
50#define BT_AICS_INPUT_TYPE_BLUETOOTH 0x01
51#define BT_AICS_INPUT_TYPE_MICROPHONE 0x02
52#define BT_AICS_INPUT_TYPE_ANALOG 0x03
53#define BT_AICS_INPUT_TYPE_DIGITAL 0x04
54#define BT_AICS_INPUT_TYPE_RADIO 0x05
55#define BT_AICS_INPUT_TYPE_STREAMING 0x06
56
58#define BT_AICS_ERR_INVALID_COUNTER 0x80
59#define BT_AICS_ERR_OP_NOT_SUPPORTED 0x81
60#define BT_AICS_ERR_MUTE_DISABLED 0x82
61#define BT_AICS_ERR_OUT_OF_RANGE 0x83
62#define BT_AICS_ERR_GAIN_MODE_NOT_ALLOWED 0x84
63
65struct bt_aics;
66
71
74
77
80
83
86
89
91 bool status;
92
95
98
100 struct bt_aics_cb *cb;
101};
102
115};
116
122struct bt_aics *bt_aics_free_instance_get(void);
123
133void *bt_aics_svc_decl_get(struct bt_aics *aics);
134
146int bt_aics_client_conn_get(const struct bt_aics *aics, struct bt_conn **conn);
147
156int bt_aics_register(struct bt_aics *aics, struct bt_aics_register_param *param);
157
165typedef void (*bt_aics_write_cb)(struct bt_aics *inst, int err);
166
181typedef void (*bt_aics_state_cb)(struct bt_aics *inst, int err, int8_t gain,
182 uint8_t mute, uint8_t mode);
183
199typedef void (*bt_aics_gain_setting_cb)(struct bt_aics *inst, int err,
200 uint8_t units, int8_t minimum,
201 int8_t maximum);
202
214typedef void (*bt_aics_type_cb)(struct bt_aics *inst, int err, uint8_t type);
215
227typedef void (*bt_aics_status_cb)(struct bt_aics *inst, int err, bool active);
228
240typedef void (*bt_aics_description_cb)(struct bt_aics *inst, int err,
241 char *description);
242
254typedef void (*bt_aics_discover_cb)(struct bt_aics *inst, int err);
255
262
263#if defined(CONFIG_BT_AICS_CLIENT)
264 bt_aics_discover_cb discover;
265 bt_aics_write_cb set_gain;
266 bt_aics_write_cb unmute;
267 bt_aics_write_cb mute;
268 bt_aics_write_cb set_manual_mode;
269 bt_aics_write_cb set_auto_mode;
270#endif /* CONFIG_BT_AICS_CLIENT */
271};
272
273
286int bt_aics_discover(struct bt_conn *conn, struct bt_aics *inst,
287 const struct bt_aics_discover_param *param);
288
299int bt_aics_deactivate(struct bt_aics *inst);
300
312int bt_aics_activate(struct bt_aics *inst);
313
321int bt_aics_state_get(struct bt_aics *inst);
322
330int bt_aics_gain_setting_get(struct bt_aics *inst);
331
339int bt_aics_type_get(struct bt_aics *inst);
340
348int bt_aics_status_get(struct bt_aics *inst);
349
360int bt_aics_disable_mute(struct bt_aics *inst);
361
369int bt_aics_unmute(struct bt_aics *inst);
370
378int bt_aics_mute(struct bt_aics *inst);
379
387int bt_aics_gain_set_manual_only(struct bt_aics *inst);
388
399int bt_aics_gain_set_auto_only(struct bt_aics *inst);
400
408int bt_aics_manual_gain_set(struct bt_aics *inst);
409
417int bt_aics_automatic_gain_set(struct bt_aics *inst);
418
428int bt_aics_gain_set(struct bt_aics *inst, int8_t gain);
429
437int bt_aics_description_get(struct bt_aics *inst);
438
447int bt_aics_description_set(struct bt_aics *inst, const char *description);
448
455
462void bt_aics_client_cb_register(struct bt_aics *inst, struct bt_aics_cb *cb);
463
464#ifdef __cplusplus
465}
466#endif
467
472#endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_AICS_H_ */
Bluetooth subsystem core APIs.
int bt_aics_register(struct bt_aics *aics, struct bt_aics_register_param *param)
Initialize the Audio Input Control Service instance.
void(* bt_aics_status_cb)(struct bt_aics *inst, int err, bool active)
Callback function for the input status.
Definition: aics.h:227
int bt_aics_gain_set_manual_only(struct bt_aics *inst)
Set manual only gain mode in Audio Input Control Service.
int bt_aics_client_conn_get(const struct bt_aics *aics, struct bt_conn **conn)
Get the connection pointer of a client instance.
void(* bt_aics_gain_setting_cb)(struct bt_aics *inst, int err, uint8_t units, int8_t minimum, int8_t maximum)
Callback function for the gain settings.
Definition: aics.h:199
int bt_aics_gain_set(struct bt_aics *inst, int8_t gain)
Set the input gain.
int bt_aics_gain_set_auto_only(struct bt_aics *inst)
Set automatic only gain mode in Audio Input Control Service.
int bt_aics_state_get(struct bt_aics *inst)
Read the Audio Input Control Service input state.
void(* bt_aics_state_cb)(struct bt_aics *inst, int err, int8_t gain, uint8_t mute, uint8_t mode)
Callback function for the input state.
Definition: aics.h:181
void(* bt_aics_write_cb)(struct bt_aics *inst, int err)
Callback function for writes.
Definition: aics.h:165
int bt_aics_gain_setting_get(struct bt_aics *inst)
Read the Audio Input Control Service gain settings.
int bt_aics_unmute(struct bt_aics *inst)
Unmute the Audio Input Control Service input.
int bt_aics_deactivate(struct bt_aics *inst)
Deactivates a Audio Input Control Service instance.
int bt_aics_mute(struct bt_aics *inst)
Mute the Audio Input Control Service input.
int bt_aics_disable_mute(struct bt_aics *inst)
Disable mute in the Audio Input Control Service.
void(* bt_aics_type_cb)(struct bt_aics *inst, int err, uint8_t type)
Callback function for the input type.
Definition: aics.h:214
int bt_aics_automatic_gain_set(struct bt_aics *inst)
Set the input gain to automatic.
int bt_aics_manual_gain_set(struct bt_aics *inst)
Set input gain to manual.
int bt_aics_description_set(struct bt_aics *inst, const char *description)
Set the Audio Input Control Service description.
void * bt_aics_svc_decl_get(struct bt_aics *aics)
Get the service declaration attribute.
struct bt_aics * bt_aics_client_free_instance_get(void)
Get a new Audio Input Control Service client instance.
void(* bt_aics_description_cb)(struct bt_aics *inst, int err, char *description)
Callback function for the description.
Definition: aics.h:240
void(* bt_aics_discover_cb)(struct bt_aics *inst, int err)
Callback function for bt_aics_discover.
Definition: aics.h:254
struct bt_aics * bt_aics_free_instance_get(void)
Get a free instance of Audio Input Control Service from the pool.
void bt_aics_client_cb_register(struct bt_aics *inst, struct bt_aics_cb *cb)
Registers the callbacks for the Audio Input Control Service client.
int bt_aics_activate(struct bt_aics *inst)
Activates a Audio Input Control Service instance.
int bt_aics_discover(struct bt_conn *conn, struct bt_aics *inst, const struct bt_aics_discover_param *param)
Discover a Audio Input Control Service.
int bt_aics_status_get(struct bt_aics *inst)
Read the Audio Input Control Service input status.
int bt_aics_description_get(struct bt_aics *inst)
Read the Audio Input Control Service description.
int bt_aics_type_get(struct bt_aics *inst)
Read the Audio Input Control Service input type.
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
__INT8_TYPE__ int8_t
Definition: stdint.h:72
Definition: aics.h:256
bt_aics_type_cb type
Definition: aics.h:259
bt_aics_gain_setting_cb gain_setting
Definition: aics.h:258
bt_aics_state_cb state
Definition: aics.h:257
bt_aics_status_cb status
Definition: aics.h:260
bt_aics_description_cb description
Definition: aics.h:261
Structure for discovering a Audio Input Control Service instance.
Definition: aics.h:104
uint16_t end_handle
The end handle of the discovering.
Definition: aics.h:114
uint16_t start_handle
The start handle of the discovering.
Definition: aics.h:109
Structure for initializing a Audio Input Control Service instance.
Definition: aics.h:68
uint8_t gain_mode
Initial audio input mode.
Definition: aics.h:76
bool status
Initial audio input status (active/inactive)
Definition: aics.h:91
uint8_t units
Initial audio input gain units (N * 0.1 dB)
Definition: aics.h:79
struct bt_aics_cb * cb
Pointer to the callback structure.
Definition: aics.h:100
int8_t gain
Initial audio input gain (-128 to 127)
Definition: aics.h:70
int8_t max_gain
Initial audio input maximum gain.
Definition: aics.h:85
int8_t min_gain
Initial audio input minimum gain.
Definition: aics.h:82
uint8_t mute
Initial audio input mute state.
Definition: aics.h:73
bool desc_writable
Boolean to set whether the description is writable by clients.
Definition: aics.h:94
uint8_t type
Initial audio input type.
Definition: aics.h:88
char * description
Initial audio input description.
Definition: aics.h:97