Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
aics.h
Go to the documentation of this file.
1
6/*
7 * Copyright (c) 2020-2024 Nordic Semiconductor ASA
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11
12#ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_AICS_H_
13#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_AICS_H_
14
35#include <stdint.h>
36#include <stdbool.h>
37
38#include <zephyr/autoconf.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
50#define BT_AICS_STATE_UNMUTED 0x00
52#define BT_AICS_STATE_MUTED 0x01
54#define BT_AICS_STATE_MUTE_DISABLED 0x02
66#define BT_AICS_MODE_MANUAL_ONLY 0x00
72#define BT_AICS_MODE_AUTO_ONLY 0x01
78#define BT_AICS_MODE_MANUAL 0x02
84#define BT_AICS_MODE_AUTO 0x03
92#define BT_AICS_INPUT_TYPE_UNSPECIFIED 0x00
94#define BT_AICS_INPUT_TYPE_BLUETOOTH 0x01
96#define BT_AICS_INPUT_TYPE_MICROPHONE 0x02
98#define BT_AICS_INPUT_TYPE_ANALOG 0x03
100#define BT_AICS_INPUT_TYPE_DIGITAL 0x04
102#define BT_AICS_INPUT_TYPE_RADIO 0x05
104#define BT_AICS_INPUT_TYPE_STREAMING 0x06
106#define BT_AICS_INPUT_TYPE_AMBIENT 0x07
117#define BT_AICS_ERR_INVALID_COUNTER 0x80
119#define BT_AICS_ERR_OP_NOT_SUPPORTED 0x81
121#define BT_AICS_ERR_MUTE_DISABLED 0x82
123#define BT_AICS_ERR_OUT_OF_RANGE 0x83
125#define BT_AICS_ERR_GAIN_MODE_NOT_ALLOWED 0x84
129struct bt_aics;
130
166
182
188struct bt_aics *bt_aics_free_instance_get(void);
189
199void *bt_aics_svc_decl_get(struct bt_aics *aics);
200
212int bt_aics_client_conn_get(const struct bt_aics *aics, struct bt_conn **conn);
213
222int bt_aics_register(struct bt_aics *aics, struct bt_aics_register_param *param);
223
231typedef void (*bt_aics_write_cb)(struct bt_aics *inst, int err);
232
247typedef void (*bt_aics_state_cb)(struct bt_aics *inst, int err, int8_t gain,
248 uint8_t mute, uint8_t mode);
249
265typedef void (*bt_aics_gain_setting_cb)(struct bt_aics *inst, int err,
266 uint8_t units, int8_t minimum,
267 int8_t maximum);
268
280typedef void (*bt_aics_type_cb)(struct bt_aics *inst, int err, uint8_t type);
281
293typedef void (*bt_aics_status_cb)(struct bt_aics *inst, int err, bool active);
294
306typedef void (*bt_aics_description_cb)(struct bt_aics *inst, int err,
307 char *description);
308
320typedef void (*bt_aics_discover_cb)(struct bt_aics *inst, int err);
321
354
355
368int bt_aics_discover(struct bt_conn *conn, struct bt_aics *inst,
369 const struct bt_aics_discover_param *param);
370
381int bt_aics_deactivate(struct bt_aics *inst);
382
394int bt_aics_activate(struct bt_aics *inst);
395
403int bt_aics_state_get(struct bt_aics *inst);
404
412int bt_aics_gain_setting_get(struct bt_aics *inst);
413
421int bt_aics_type_get(struct bt_aics *inst);
422
430int bt_aics_status_get(struct bt_aics *inst);
431
442int bt_aics_disable_mute(struct bt_aics *inst);
443
451int bt_aics_unmute(struct bt_aics *inst);
452
460int bt_aics_mute(struct bt_aics *inst);
461
469int bt_aics_gain_set_manual_only(struct bt_aics *inst);
470
481int bt_aics_gain_set_auto_only(struct bt_aics *inst);
482
490int bt_aics_manual_gain_set(struct bt_aics *inst);
491
499int bt_aics_automatic_gain_set(struct bt_aics *inst);
500
510int bt_aics_gain_set(struct bt_aics *inst, int8_t gain);
511
519int bt_aics_description_get(struct bt_aics *inst);
520
529int bt_aics_description_set(struct bt_aics *inst, const char *description);
530
537
544void bt_aics_client_cb_register(struct bt_aics *inst, struct bt_aics_cb *cb);
545
546#ifdef __cplusplus
547}
548#endif
549
554#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:293
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:265
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:247
void(* bt_aics_write_cb)(struct bt_aics *inst, int err)
Callback function for writes.
Definition aics.h:231
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:280
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:306
void(* bt_aics_discover_cb)(struct bt_aics *inst, int err)
Callback function for bt_aics_discover.
Definition aics.h:320
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
Struct to hold callbacks for the Audio Input Control Service.
Definition aics.h:327
bt_aics_write_cb set_manual_mode
The set manual mode operation has completed.
Definition aics.h:349
bt_aics_write_cb set_gain
The set gain operation has completed.
Definition aics.h:343
bt_aics_write_cb mute
The mut operation has completed.
Definition aics.h:347
bt_aics_type_cb type
The audio input type has changed.
Definition aics.h:333
bt_aics_gain_setting_cb gain_setting
The gain setting has changed.
Definition aics.h:331
bt_aics_state_cb state
The audio input state has changed.
Definition aics.h:329
bt_aics_write_cb unmute
The unmute operation has completed.
Definition aics.h:345
bt_aics_write_cb set_auto_mode
The set automatic mode has completed.
Definition aics.h:351
bt_aics_status_cb status
The audio input status has changed.
Definition aics.h:335
bt_aics_description_cb description
The audio input decscription has changed.
Definition aics.h:337
bt_aics_discover_cb discover
The discovery has completed.
Definition aics.h:341
Structure for discovering a Audio Input Control Service instance.
Definition aics.h:168
uint16_t end_handle
The end handle of the discovering.
Definition aics.h:180
uint16_t start_handle
The start handle of the discovering.
Definition aics.h:174
Structure for initializing a Audio Input Control Service instance.
Definition aics.h:132
uint8_t gain_mode
Initial audio input mode.
Definition aics.h:140
bool status
Initial audio input status (active/inactive)
Definition aics.h:155
uint8_t units
Initial audio input gain units (N * 0.1 dB)
Definition aics.h:143
struct bt_aics_cb * cb
Pointer to the callback structure.
Definition aics.h:164
int8_t gain
Initial audio input gain (-128 to 127)
Definition aics.h:134
int8_t max_gain
Initial audio input maximum gain.
Definition aics.h:149
int8_t min_gain
Initial audio input minimum gain.
Definition aics.h:146
uint8_t mute
Initial audio input mute state.
Definition aics.h:137
bool desc_writable
Boolean to set whether the description is writable by clients.
Definition aics.h:158
uint8_t type
Initial audio input type.
Definition aics.h:152
char * description
Initial audio input description.
Definition aics.h:161