Zephyr Project API  3.3.0
A Scalable Open Source RTOS
vcp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020-2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VCP_H_
8#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VCP_H_
9
22#include <zephyr/types.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#if defined(CONFIG_BT_VCP_VOL_REND)
31#define BT_VCP_VOL_REND_VOCS_CNT CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT
32#define BT_VCP_VOL_REND_AICS_CNT CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT
33#else
34#define BT_VCP_VOL_REND_VOCS_CNT 0
35#define BT_VCP_VOL_REND_AICS_CNT 0
36#endif /* CONFIG_BT_VCP_VOL_REND */
37
39#define BT_VCP_ERR_INVALID_COUNTER 0x80
40#define BT_VCP_ERR_OP_NOT_SUPPORTED 0x81
41
43#define BT_VCP_STATE_UNMUTED 0x00
44#define BT_VCP_STATE_MUTED 0x01
45
47struct bt_vcp_vol_ctlr;
48
53
56
59
62
65
68};
69
81 struct bt_vocs **vocs;
82
86 struct bt_aics **aics;
87};
88
102
114
128 void (*state)(int err, uint8_t volume, uint8_t mute);
129
141 void (*flags)(int err, uint8_t flags);
142};
143
157
164
171
178
185
192
199
208
215
222
237 void (*state)(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t volume,
238 uint8_t mute);
239
255 void (*flags)(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t flags);
256
270 void (*discover)(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t vocs_count,
271 uint8_t aics_count);
272
282 void (*vol_down)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
283
293 void (*vol_up)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
294
304 void (*mute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
305
315 void (*unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
316
326 void (*vol_down_unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
327
337 void (*vol_up_unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
338
348 void (*vol_set)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
349
350 /* Volume Offset Control Service callbacks */
352
353 /* Audio Input Control Service callbacks */
355};
356
365
382int bt_vcp_vol_ctlr_discover(struct bt_conn *conn,
383 struct bt_vcp_vol_ctlr **vol_ctlr);
384
396int bt_vcp_vol_ctlr_conn_get(const struct bt_vcp_vol_ctlr *vol_ctlr,
397 struct bt_conn **conn);
398
412int bt_vcp_vol_ctlr_included_get(struct bt_vcp_vol_ctlr *vol_ctlr,
413 struct bt_vcp_included *included);
414
422int bt_vcp_vol_ctlr_read_state(struct bt_vcp_vol_ctlr *vol_ctlr);
423
431int bt_vcp_vol_ctlr_read_flags(struct bt_vcp_vol_ctlr *vol_ctlr);
432
440int bt_vcp_vol_ctlr_vol_down(struct bt_vcp_vol_ctlr *vol_ctlr);
441
449int bt_vcp_vol_ctlr_vol_up(struct bt_vcp_vol_ctlr *vol_ctlr);
450
458int bt_vcp_vol_ctlr_unmute_vol_down(struct bt_vcp_vol_ctlr *vol_ctlr);
459
467int bt_vcp_vol_ctlr_unmute_vol_up(struct bt_vcp_vol_ctlr *vol_ctlr);
468
477int bt_vcp_vol_ctlr_set_vol(struct bt_vcp_vol_ctlr *vol_ctlr, uint8_t volume);
478
486int bt_vcp_vol_ctlr_unmute(struct bt_vcp_vol_ctlr *vol_ctlr);
487
495int bt_vcp_vol_ctlr_mute(struct bt_vcp_vol_ctlr *vol_ctlr);
496
497#ifdef __cplusplus
498}
499#endif
500
505#endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VCP_H_ */
int bt_vcp_vol_ctlr_vol_down(struct bt_vcp_vol_ctlr *vol_ctlr)
Turn the volume down one step on a remote Volume Renderer.
int bt_vcp_vol_rend_mute(void)
Mute the server.
int bt_vcp_vol_ctlr_mute(struct bt_vcp_vol_ctlr *vol_ctlr)
Mute a remote Volume Renderer.
int bt_vcp_vol_rend_included_get(struct bt_vcp_included *included)
Get Volume Control Service included services.
int bt_vcp_vol_rend_get_flags(void)
Get the Volume Control Service flags.
int bt_vcp_vol_ctlr_unmute_vol_down(struct bt_vcp_vol_ctlr *vol_ctlr)
Turn the volume down one step and unmute on a remote Volume Renderer.
int bt_vcp_vol_ctlr_unmute_vol_up(struct bt_vcp_vol_ctlr *vol_ctlr)
Turn the volume up one step and unmute on a remote Volume Renderer.
int bt_vcp_vol_rend_unmute(void)
Unmute the server.
int bt_vcp_vol_rend_unmute_vol_down(void)
Turn the volume down and unmute the server.
int bt_vcp_vol_ctlr_unmute(struct bt_vcp_vol_ctlr *vol_ctlr)
Unmute a remote Volume Renderer.
int bt_vcp_vol_rend_set_step(uint8_t volume_step)
Set the Volume Control Service volume step size.
#define BT_VCP_VOL_REND_AICS_CNT
Definition: vcp.h:35
int bt_vcp_vol_rend_set_vol(uint8_t volume)
Set the volume on the server.
int bt_vcp_vol_ctlr_read_state(struct bt_vcp_vol_ctlr *vol_ctlr)
Read the volume state of a remote Volume Renderer.
int bt_vcp_vol_rend_vol_up(void)
Turn the volume up by one step on the server.
int bt_vcp_vol_rend_register(struct bt_vcp_vol_rend_register_param *param)
Register the Volume Control Service.
int bt_vcp_vol_ctlr_cb_register(struct bt_vcp_vol_ctlr_cb *cb)
Registers the callbacks used by the Volume Controller.
int bt_vcp_vol_ctlr_vol_up(struct bt_vcp_vol_ctlr *vol_ctlr)
Turn the volume up one step on a remote Volume Renderer.
int bt_vcp_vol_rend_get_state(void)
Get the Volume Control Service volume state.
int bt_vcp_vol_ctlr_set_vol(struct bt_vcp_vol_ctlr *vol_ctlr, uint8_t volume)
Set the absolute volume on a remote Volume Renderer.
int bt_vcp_vol_ctlr_included_get(struct bt_vcp_vol_ctlr *vol_ctlr, struct bt_vcp_included *included)
Get Volume Control Service included services.
int bt_vcp_vol_ctlr_conn_get(const struct bt_vcp_vol_ctlr *vol_ctlr, struct bt_conn **conn)
Get the connection pointer of a client instance.
int bt_vcp_vol_ctlr_discover(struct bt_conn *conn, struct bt_vcp_vol_ctlr **vol_ctlr)
Discover Volume Control Service and included services.
int bt_vcp_vol_rend_unmute_vol_up(void)
Turn the volume up and unmute the server.
#define BT_VCP_VOL_REND_VOCS_CNT
Definition: vcp.h:34
int bt_vcp_vol_ctlr_read_flags(struct bt_vcp_vol_ctlr *vol_ctlr)
Read the volume flags of a remote Volume Renderer.
int bt_vcp_vol_rend_vol_down(void)
Turn the volume down by one step on the server.
flags
Definition: parser.h:96
state
Definition: parser_state.h:29
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Definition: aics.h:255
Structure for initializing a Audio Input Control Service instance.
Definition: aics.h:67
Volume Control Service included services.
Definition: vcp.h:77
struct bt_vocs ** vocs
Definition: vcp.h:81
struct bt_aics ** aics
Definition: vcp.h:86
uint8_t vocs_cnt
Definition: vcp.h:79
uint8_t aics_cnt
Definition: vcp.h:84
Definition: vcp.h:223
struct bt_aics_cb aics_cb
Definition: vcp.h:354
void(* flags)(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t flags)
Callback function for Volume Control Profile volume flags.
Definition: vcp.h:255
void(* unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_unmute().
Definition: vcp.h:315
void(* vol_down_unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_vol_down_unmute().
Definition: vcp.h:326
void(* mute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_mute().
Definition: vcp.h:304
void(* vol_set)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_vol_set().
Definition: vcp.h:348
void(* vol_down)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_vol_down().
Definition: vcp.h:282
void(* discover)(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t vocs_count, uint8_t aics_count)
Callback function for bt_vcp_vol_ctlr_discover().
Definition: vcp.h:270
void(* vol_up)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_vol_up().
Definition: vcp.h:293
void(* vol_up_unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_vol_up_unmute().
Definition: vcp.h:337
struct bt_vocs_cb vocs_cb
Definition: vcp.h:351
Definition: vcp.h:115
void(* flags)(int err, uint8_t flags)
Callback function for Volume Control Service flags.
Definition: vcp.h:141
Definition: vcp.h:50
uint8_t step
Definition: vcp.h:52
struct bt_aics_register_param aics_param[0]
Definition: vcp.h:64
struct bt_vocs_register_param vocs_param[0]
Definition: vcp.h:61
uint8_t volume
Definition: vcp.h:58
uint8_t mute
Definition: vcp.h:55
struct bt_vcp_vol_rend_cb * cb
Definition: vcp.h:67
Definition: vocs.h:189
Structure for registering a Volume Offset Control Service instance.
Definition: vocs.h:47