Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
vcp.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_VCP_H_
13#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VCP_H_
14
30#include <stdint.h>
31
35#include <zephyr/sys/slist.h>
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
45#if defined(CONFIG_BT_VCP_VOL_REND)
46#define BT_VCP_VOL_REND_VOCS_CNT CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT
47#else
48#define BT_VCP_VOL_REND_VOCS_CNT 0
49#endif /* CONFIG_BT_VCP_VOL_REND */
50
55#if defined(CONFIG_BT_VCP_VOL_REND)
56#define BT_VCP_VOL_REND_AICS_CNT CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT
57#else
58#define BT_VCP_VOL_REND_AICS_CNT 0
59#endif /* CONFIG_BT_VCP_VOL_REND */
60
69#define BT_VCP_ERR_INVALID_COUNTER 0x80
71#define BT_VCP_ERR_OP_NOT_SUPPORTED 0x81
79#define BT_VCP_STATE_UNMUTED 0x00
81#define BT_VCP_STATE_MUTED 0x01
85struct bt_vcp_vol_ctlr;
86
107
119 struct bt_vocs **vocs;
120
124 struct bt_aics **aics;
125};
126
140
152
173 void (*state)(struct bt_conn *conn, int err, uint8_t volume, uint8_t mute);
174
188 void (*flags)(struct bt_conn *conn, int err, uint8_t flags);
189};
190
204
211
218
225
232
239
246
255
262
269
289 void (*state)(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t volume,
290 uint8_t mute);
291
307 void (*flags)(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t flags);
308
322 void (*discover)(struct bt_vcp_vol_ctlr *vol_ctlr, int err, uint8_t vocs_count,
323 uint8_t aics_count);
324
334 void (*vol_down)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
335
345 void (*vol_up)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
346
356 void (*mute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
357
367 void (*unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
368
378 void (*vol_down_unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
379
389 void (*vol_up_unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
390
400 void (*vol_set)(struct bt_vcp_vol_ctlr *vol_ctlr, int err);
401
404
407
409 sys_snode_t _node;
410};
411
422
433
450int bt_vcp_vol_ctlr_discover(struct bt_conn *conn,
451 struct bt_vcp_vol_ctlr **vol_ctlr);
452
465struct bt_vcp_vol_ctlr *bt_vcp_vol_ctlr_get_by_conn(const struct bt_conn *conn);
466
478int bt_vcp_vol_ctlr_conn_get(const struct bt_vcp_vol_ctlr *vol_ctlr,
479 struct bt_conn **conn);
480
497int bt_vcp_vol_ctlr_included_get(struct bt_vcp_vol_ctlr *vol_ctlr,
498 struct bt_vcp_included *included);
499
507int bt_vcp_vol_ctlr_read_state(struct bt_vcp_vol_ctlr *vol_ctlr);
508
516int bt_vcp_vol_ctlr_read_flags(struct bt_vcp_vol_ctlr *vol_ctlr);
517
525int bt_vcp_vol_ctlr_vol_down(struct bt_vcp_vol_ctlr *vol_ctlr);
526
534int bt_vcp_vol_ctlr_vol_up(struct bt_vcp_vol_ctlr *vol_ctlr);
535
543int bt_vcp_vol_ctlr_unmute_vol_down(struct bt_vcp_vol_ctlr *vol_ctlr);
544
552int bt_vcp_vol_ctlr_unmute_vol_up(struct bt_vcp_vol_ctlr *vol_ctlr);
553
562int bt_vcp_vol_ctlr_set_vol(struct bt_vcp_vol_ctlr *vol_ctlr, uint8_t volume);
563
571int bt_vcp_vol_ctlr_unmute(struct bt_vcp_vol_ctlr *vol_ctlr);
572
580int bt_vcp_vol_ctlr_mute(struct bt_vcp_vol_ctlr *vol_ctlr);
581
582#ifdef __cplusplus
583}
584#endif
585
590#endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VCP_H_ */
Bluetooth Audio Input Control Service APIs.
Bluetooth connection handling.
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
Defines the maximum number of Audio Input Control service instances for the Volume Control Profile Vo...
Definition vcp.h:58
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
Defines the maximum number of Volume Offset Control service instances for the Volume Control Profile ...
Definition vcp.h:48
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
Struct to hold callbacks for the Audio Input Control Service.
Definition aics.h:327
Structure for initializing a Audio Input Control Service instance.
Definition aics.h:132
Volume Control Service included services.
Definition vcp.h:115
struct bt_vocs ** vocs
Array of pointers to Volume Offset Control Service instances.
Definition vcp.h:119
struct bt_aics ** aics
Array of pointers to Audio Input Control Service instances.
Definition vcp.h:124
uint8_t vocs_cnt
Number of Volume Offset Control Service instances.
Definition vcp.h:117
uint8_t aics_cnt
Number of Audio Input Control Service instances.
Definition vcp.h:122
Struct to hold the Volume Controller callbacks.
Definition vcp.h:275
struct bt_aics_cb aics_cb
Audio Input Control Service callbacks.
Definition vcp.h:406
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:307
void(* unmute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_unmute().
Definition vcp.h:367
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:378
void(* mute)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_mute().
Definition vcp.h:356
void(* vol_set)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_vol_set().
Definition vcp.h:400
void(* vol_down)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_vol_down().
Definition vcp.h:334
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:322
void(* vol_up)(struct bt_vcp_vol_ctlr *vol_ctlr, int err)
Callback function for bt_vcp_vol_ctlr_vol_up().
Definition vcp.h:345
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:389
struct bt_vocs_cb vocs_cb
Volume Offset Control Service callbacks.
Definition vcp.h:403
Struct to hold the Volume Renderer callbacks.
Definition vcp.h:158
void(* flags)(struct bt_conn *conn, int err, uint8_t flags)
Callback function for Volume Control Service flags.
Definition vcp.h:188
Register structure for Volume Control Service.
Definition vcp.h:88
uint8_t step
Initial step size (1-255)
Definition vcp.h:90
struct bt_aics_register_param aics_param[0]
Register parameters for Audio Input Control Services.
Definition vcp.h:102
struct bt_vocs_register_param vocs_param[0]
Register parameters for Volume Offset Control Services.
Definition vcp.h:99
uint8_t volume
Initial volume level (0-255)
Definition vcp.h:96
uint8_t mute
Initial mute state (0-1)
Definition vcp.h:93
struct bt_vcp_vol_rend_cb * cb
Volume Control Service callback structure.
Definition vcp.h:105
Struct to hold the Volume Offset Control Service callbacks.
Definition vocs.h:221
Structure for registering a Volume Offset Control Service instance.
Definition vocs.h:73
Bluetooth Volume Offset Control Service (VOCS) APIs.