Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
vcs.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020-2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VCS_H_
8#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VCS_H_
9
22#include <zephyr/types.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#if defined(CONFIG_BT_VCS)
31#define BT_VCS_VOCS_CNT CONFIG_BT_VCS_VOCS_INSTANCE_COUNT
32#define BT_VCS_AICS_CNT CONFIG_BT_VCS_AICS_INSTANCE_COUNT
33#else
34#define BT_VCS_VOCS_CNT 0
35#define BT_VCS_AICS_CNT 0
36#endif /* CONFIG_BT_VCS */
37
39#define BT_VCS_ERR_INVALID_COUNTER 0x80
40#define BT_VCS_ERR_OP_NOT_SUPPORTED 0x81
41
43#define BT_VCS_STATE_UNMUTED 0x00
44#define BT_VCS_STATE_MUTED 0x01
45
47struct bt_vcs;
48
53
56
59
62
65
67 struct bt_vcs_cb *cb;
68};
69
81 struct bt_vocs **vocs;
82
86 struct bt_aics **aics;
87};
88
101int bt_vcs_register(struct bt_vcs_register_param *param, struct bt_vcs **vcs);
102
116int bt_vcs_included_get(struct bt_vcs *vcs, struct bt_vcs_included *included);
117
129int bt_vcs_client_conn_get(const struct bt_vcs *vcs, struct bt_conn **conn);
130
144typedef void (*bt_vcs_discover_cb)(struct bt_vcs *vcs, int err,
145 uint8_t vocs_count, uint8_t aics_count);
146
160typedef void (*bt_vcs_state_cb)(struct bt_vcs *vcs, int err, uint8_t volume,
161 uint8_t mute);
162
175typedef void (*bt_vcs_flags_cb)(struct bt_vcs *vcs, int err, uint8_t flags);
176
185typedef void (*bt_vcs_write_cb)(struct bt_vcs *vcs, int err);
186
187struct bt_vcs_cb {
188 /* Volume Control Service */
191#if defined(CONFIG_BT_VCS_CLIENT)
192 bt_vcs_discover_cb discover;
193 bt_vcs_write_cb vol_down;
194 bt_vcs_write_cb vol_up;
195 bt_vcs_write_cb mute;
196 bt_vcs_write_cb unmute;
197 bt_vcs_write_cb vol_down_unmute;
198 bt_vcs_write_cb vol_up_unmute;
199 bt_vcs_write_cb vol_set;
200
201 /* Volume Offset Control Service */
202 struct bt_vocs_cb vocs_cb;
203
204 /* Audio Input Control Service */
205 struct bt_aics_cb aics_cb;
206#endif /* CONFIG_BT_VCS_CLIENT */
207};
208
224int bt_vcs_discover(struct bt_conn *conn, struct bt_vcs **vcs);
225
239
247int bt_vcs_vol_get(struct bt_vcs *vcs);
248
256int bt_vcs_flags_get(struct bt_vcs *vcs);
257
265int bt_vcs_vol_down(struct bt_vcs *vcs);
266
274int bt_vcs_vol_up(struct bt_vcs *vcs);
275
283int bt_vcs_unmute_vol_down(struct bt_vcs *vcs);
284
292int bt_vcs_unmute_vol_up(struct bt_vcs *vcs);
293
302int bt_vcs_vol_set(struct bt_vcs *vcs, uint8_t volume);
303
311int bt_vcs_unmute(struct bt_vcs *vcs);
312
320int bt_vcs_mute(struct bt_vcs *vcs);
321
330int bt_vcs_vocs_state_get(struct bt_vcs *vcs, struct bt_vocs *inst);
331
340int bt_vcs_vocs_location_get(struct bt_vcs *vcs, struct bt_vocs *inst);
341
351int bt_vcs_vocs_location_set(struct bt_vcs *vcs, struct bt_vocs *inst,
352 uint8_t location);
353
363int bt_vcs_vocs_state_set(struct bt_vcs *vcs, struct bt_vocs *inst,
364 int16_t offset);
365
374int bt_vcs_vocs_description_get(struct bt_vcs *vcs, struct bt_vocs *inst);
375
385int bt_vcs_vocs_description_set(struct bt_vcs *vcs, struct bt_vocs *inst,
386 const char *description);
387
399int bt_vcs_aics_deactivate(struct bt_vcs *vcs, struct bt_aics *inst);
400
413int bt_vcs_aics_activate(struct bt_vcs *vcs, struct bt_aics *inst);
414
423int bt_vcs_aics_state_get(struct bt_vcs *vcs, struct bt_aics *inst);
424
433int bt_vcs_aics_gain_setting_get(struct bt_vcs *vcs, struct bt_aics *inst);
434
443int bt_vcs_aics_type_get(struct bt_vcs *vcs, struct bt_aics *inst);
444
453int bt_vcs_aics_status_get(struct bt_vcs *vcs, struct bt_aics *inst);
454
463int bt_vcs_aics_mute(struct bt_vcs *vcs, struct bt_aics *inst);
464
473int bt_vcs_aics_unmute(struct bt_vcs *vcs, struct bt_aics *inst);
474
483int bt_vcs_aics_manual_gain_set(struct bt_vcs *vcs, struct bt_aics *inst);
484
493int bt_vcs_aics_automatic_gain_set(struct bt_vcs *vcs, struct bt_aics *inst);
494
504int bt_vcs_aics_gain_set(struct bt_vcs *vcs, struct bt_aics *inst,
505 int8_t gain);
506
515int bt_vcs_aics_description_get(struct bt_vcs *vcs, struct bt_aics *inst);
516
526int bt_vcs_aics_description_set(struct bt_vcs *vcs, struct bt_aics *inst,
527 const char *description);
528
537
538#ifdef __cplusplus
539}
540#endif
541
546#endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VCS_H_ */
void
Definition: eswifi_shell.c:15
int bt_vcs_aics_description_get(struct bt_vcs *vcs, struct bt_aics *inst)
Read the Audio Input Control Service description.
int bt_vcs_aics_unmute(struct bt_vcs *vcs, struct bt_aics *inst)
Unmute the Audio Input Control Service input.
void(* bt_vcs_discover_cb)(struct bt_vcs *vcs, int err, uint8_t vocs_count, uint8_t aics_count)
Callback function for bt_vcs_discover.
Definition: vcs.h:144
int bt_vcs_vol_up(struct bt_vcs *vcs)
Turn the volume up by one step on the server.
int bt_vcs_aics_manual_gain_set(struct bt_vcs *vcs, struct bt_aics *inst)
Set input gain to manual.
int bt_vcs_aics_type_get(struct bt_vcs *vcs, struct bt_aics *inst)
Read the Audio Input Control Service input type.
int bt_vcs_register(struct bt_vcs_register_param *param, struct bt_vcs **vcs)
Register the Volume Control Service.
int bt_vcs_aics_gain_setting_get(struct bt_vcs *vcs, struct bt_aics *inst)
Read the Audio Input Control Service gain settings.
int bt_vcs_aics_deactivate(struct bt_vcs *vcs, struct bt_aics *inst)
Deactivates an Audio Input Control Service instance.
int bt_vcs_included_get(struct bt_vcs *vcs, struct bt_vcs_included *included)
Get Volume Control Service included services.
int bt_vcs_vocs_state_set(struct bt_vcs *vcs, struct bt_vocs *inst, int16_t offset)
Set the Volume Offset Control Service offset state.
void(* bt_vcs_state_cb)(struct bt_vcs *vcs, int err, uint8_t volume, uint8_t mute)
Callback function for Volume Control Service volume state.
Definition: vcs.h:160
int bt_vcs_mute(struct bt_vcs *vcs)
Mute the server.
int bt_vcs_unmute(struct bt_vcs *vcs)
Unmute the server.
int bt_vcs_discover(struct bt_conn *conn, struct bt_vcs **vcs)
Discover Volume Control Service and included services.
int bt_vcs_vol_down(struct bt_vcs *vcs)
Turn the volume down by one step on the server.
int bt_vcs_unmute_vol_down(struct bt_vcs *vcs)
Turn the volume down and unmute the server.
int bt_vcs_vocs_location_get(struct bt_vcs *vcs, struct bt_vocs *inst)
Read the Volume Offset Control Service location.
int bt_vcs_flags_get(struct bt_vcs *vcs)
Read the Volume Control Service flags.
int bt_vcs_unmute_vol_up(struct bt_vcs *vcs)
Turn the volume up and unmute the server.
int bt_vcs_vol_step_set(uint8_t volume_step)
Set the Volume Control Service volume step size.
int bt_vcs_vocs_state_get(struct bt_vcs *vcs, struct bt_vocs *inst)
Read the Volume Offset Control Service offset state.
int bt_vcs_aics_status_get(struct bt_vcs *vcs, struct bt_aics *inst)
Read the Audio Input Control Service input status.
int bt_vcs_aics_automatic_gain_set(struct bt_vcs *vcs, struct bt_aics *inst)
Set the input gain to automatic.
int bt_vcs_aics_activate(struct bt_vcs *vcs, struct bt_aics *inst)
Activates an Audio Input Control Service instance.
int bt_vcs_aics_description_set(struct bt_vcs *vcs, struct bt_aics *inst, const char *description)
Set the Audio Input Control Service description.
int bt_vcs_vocs_location_set(struct bt_vcs *vcs, struct bt_vocs *inst, uint8_t location)
Set the Volume Offset Control Service location.
void(* bt_vcs_write_cb)(struct bt_vcs *vcs, int err)
Callback function for writes.
Definition: vcs.h:185
int bt_vcs_client_cb_register(struct bt_vcs_cb *cb)
Registers the callbacks used by the Volume Control Service client.
int bt_vcs_vol_get(struct bt_vcs *vcs)
Read the Volume Control Service volume state.
int bt_vcs_vol_set(struct bt_vcs *vcs, uint8_t volume)
Set the volume on the server.
int bt_vcs_aics_mute(struct bt_vcs *vcs, struct bt_aics *inst)
Mute the Audio Input Control Service input.
#define BT_VCS_VOCS_CNT
Definition: vcs.h:34
int bt_vcs_vocs_description_set(struct bt_vcs *vcs, struct bt_vocs *inst, const char *description)
Set the Volume Offset Control Service description.
#define BT_VCS_AICS_CNT
Definition: vcs.h:35
int bt_vcs_client_conn_get(const struct bt_vcs *vcs, struct bt_conn **conn)
Get the connection pointer of a client instance.
int bt_vcs_vocs_description_get(struct bt_vcs *vcs, struct bt_vocs *inst)
Read the Volume Offset Control Service output description.
int bt_vcs_aics_state_get(struct bt_vcs *vcs, struct bt_aics *inst)
Read the Audio Input Control Service input state.
int bt_vcs_aics_gain_set(struct bt_vcs *vcs, struct bt_aics *inst, int8_t gain)
Set the input gain.
void(* bt_vcs_flags_cb)(struct bt_vcs *vcs, int err, uint8_t flags)
Callback function for Volume Control Service flags.
Definition: vcs.h:175
flags
Definition: http_parser.h:131
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__INT8_TYPE__ int8_t
Definition: stdint.h:42
__INT16_TYPE__ int16_t
Definition: stdint.h:43
Definition: aics.h:255
bt_aics_description_cb description
Definition: aics.h:260
Structure for initializing a Audio Input Control Service instance.
Definition: aics.h:67
Definition: vcs.h:187
bt_vcs_state_cb state
Definition: vcs.h:189
bt_vcs_flags_cb flags
Definition: vcs.h:190
Volume Control Service included services.
Definition: vcs.h:77
uint8_t vocs_cnt
Definition: vcs.h:79
uint8_t aics_cnt
Definition: vcs.h:84
struct bt_vocs ** vocs
Definition: vcs.h:81
struct bt_aics ** aics
Definition: vcs.h:86
Definition: vcs.h:50
uint8_t mute
Definition: vcs.h:55
struct bt_aics_register_param aics_param[0]
Definition: vcs.h:64
uint8_t step
Definition: vcs.h:52
struct bt_vcs_cb * cb
Definition: vcs.h:67
struct bt_vocs_register_param vocs_param[0]
Definition: vcs.h:61
uint8_t volume
Definition: vcs.h:58
Definition: vocs.h:189
Structure for registering a Volume Offset Control Service instance.
Definition: vocs.h:47