Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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 <stdint.h>
23
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#if defined(CONFIG_BT_VCP_VOL_REND)
32#define BT_VCP_VOL_REND_VOCS_CNT CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT
33#define BT_VCP_VOL_REND_AICS_CNT CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT
34#else
35#define BT_VCP_VOL_REND_VOCS_CNT 0
36#define BT_VCP_VOL_REND_AICS_CNT 0
37#endif /* CONFIG_BT_VCP_VOL_REND */
38
40#define BT_VCP_ERR_INVALID_COUNTER 0x80
41#define BT_VCP_ERR_OP_NOT_SUPPORTED 0x81
42
44#define BT_VCP_STATE_UNMUTED 0x00
45#define BT_VCP_STATE_MUTED 0x01
46
48struct bt_vcp_vol_ctlr;
49
54
57
60
63
66
69};
70
82 struct bt_vocs **vocs;
83
87 struct bt_aics **aics;
88};
89
103
115
129 void (*state)(int err, uint8_t volume, uint8_t mute);
130
142 void (*flags)(int err, uint8_t flags);
143};
144
158
165
172
179
186
193
200
209
216
223
238 void (*state)(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t volume,
239 uint8_t mute);
240
256 void (*flags)(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t flags);
257
271 void (*discover)(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t vocs_count,
272 uint8_t aics_count);
273
283 void (*vol_down)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
284
294 void (*vol_up)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
295
305 void (*mute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
306
316 void (*unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
317
327 void (*vol_down_unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
328
338 void (*vol_up_unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
339
349 void (*vol_set)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
350
351 /* Volume Offset Control Service callbacks */
353
354 /* Audio Input Control Service callbacks */
356
358 sys_snode_t _node;
359};
360
371
382
399int bt_vcp_vol_ctlr_discover(struct bt_conn *conn,
400 struct bt_vcp_vol_ctlr **vol_ctlr);
401
414struct bt_vcp_vol_ctlr *bt_vcp_vol_ctlr_get_by_conn(const struct bt_conn *conn);
415
427int bt_vcp_vol_ctlr_conn_get(const struct bt_vcp_vol_ctlr *vol_ctlr,
428 struct bt_conn **conn);
429
446int bt_vcp_vol_ctlr_included_get(struct bt_vcp_vol_ctlr *vol_ctlr,
447 struct bt_vcp_included *included);
448
456int bt_vcp_vol_ctlr_read_state(struct bt_vcp_vol_ctlr *vol_ctlr);
457
465int bt_vcp_vol_ctlr_read_flags(struct bt_vcp_vol_ctlr *vol_ctlr);
466
474int bt_vcp_vol_ctlr_vol_down(struct bt_vcp_vol_ctlr *vol_ctlr);
475
483int bt_vcp_vol_ctlr_vol_up(struct bt_vcp_vol_ctlr *vol_ctlr);
484
492int bt_vcp_vol_ctlr_unmute_vol_down(struct bt_vcp_vol_ctlr *vol_ctlr);
493
501int bt_vcp_vol_ctlr_unmute_vol_up(struct bt_vcp_vol_ctlr *vol_ctlr);
502
511int bt_vcp_vol_ctlr_set_vol(struct bt_vcp_vol_ctlr *vol_ctlr, uint8_t volume);
512
520int bt_vcp_vol_ctlr_unmute(struct bt_vcp_vol_ctlr *vol_ctlr);
521
529int bt_vcp_vol_ctlr_mute(struct bt_vcp_vol_ctlr *vol_ctlr);
530
531#ifdef __cplusplus
532}
533#endif
534
539#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.
struct bt_vcp_vol_ctlr * bt_vcp_vol_ctlr_get_by_conn(const struct bt_conn *conn)
Get the volume controller from a connection pointer.
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:36
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.
int bt_vcp_vol_ctlr_cb_unregister(struct bt_vcp_vol_ctlr_cb *cb)
Unregisters the callbacks used by the Volume Controller.
#define BT_VCP_VOL_REND_VOCS_CNT
Definition: vcp.h:35
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.
struct _snode sys_snode_t
Single-linked list node structure.
Definition: slist.h:39
flags
Definition: parser.h:96
state
Definition: parser_state.h:29
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Definition: aics.h:256
Structure for initializing a Audio Input Control Service instance.
Definition: aics.h:68
Volume Control Service included services.
Definition: vcp.h:78
struct bt_vocs ** vocs
Array of pointers to Volume Offset Control Service instances.
Definition: vcp.h:82
struct bt_aics ** aics
Array of pointers to Audio Input Control Service instances.
Definition: vcp.h:87
uint8_t vocs_cnt
Number of Volume Offset Control Service instances.
Definition: vcp.h:80
uint8_t aics_cnt
Number of Audio Input Control Service instances.
Definition: vcp.h:85
Definition: vcp.h:224
struct bt_aics_cb aics_cb
Definition: vcp.h:355
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:256
void(* unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_unmute().
Definition: vcp.h:316
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:327
void(* mute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_mute().
Definition: vcp.h:305
void(* vol_set)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_vol_set().
Definition: vcp.h:349
void(* vol_down)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_vol_down().
Definition: vcp.h:283
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:271
void(* vol_up)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_vol_up().
Definition: vcp.h:294
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:338
struct bt_vocs_cb vocs_cb
Definition: vcp.h:352
Definition: vcp.h:116
void(* flags)(int err, uint8_t flags)
Callback function for Volume Control Service flags.
Definition: vcp.h:142
Register structure for Volume Control Service.
Definition: vcp.h:51
uint8_t step
Initial step size (1-255)
Definition: vcp.h:53
struct bt_aics_register_param aics_param[0]
Register parameters for Audio Input Control Services.
Definition: vcp.h:65
struct bt_vocs_register_param vocs_param[0]
Register parameters for Volume Offset Control Services.
Definition: vcp.h:62
uint8_t volume
Initial volume level (0-255)
Definition: vcp.h:59
uint8_t mute
Initial mute state (0-1)
Definition: vcp.h:56
struct bt_vcp_vol_rend_cb * cb
Volume Control Service callback structure.
Definition: vcp.h:68
Definition: vocs.h:193
Structure for registering a Volume Offset Control Service instance.
Definition: vocs.h:51