Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Volume Control Service (VCS) More...
Data Structures | |
struct | bt_vcs_register_param |
struct | bt_vcs_included |
Volume Control Service included services. More... | |
struct | bt_vcs_cb |
Macros | |
#define | BT_VCS_VOCS_CNT 0 |
#define | BT_VCS_AICS_CNT 0 |
#define | BT_VCS_ERR_INVALID_COUNTER 0x80 |
#define | BT_VCS_ERR_OP_NOT_SUPPORTED 0x81 |
#define | BT_VCS_STATE_UNMUTED 0x00 |
#define | BT_VCS_STATE_MUTED 0x01 |
Typedefs | |
typedef 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. More... | |
typedef 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. More... | |
typedef void(* | bt_vcs_flags_cb) (struct bt_vcs *vcs, int err, uint8_t flags) |
Callback function for Volume Control Service flags. More... | |
typedef void(* | bt_vcs_write_cb) (struct bt_vcs *vcs, int err) |
Callback function for writes. More... | |
Functions | |
int | bt_vcs_register (struct bt_vcs_register_param *param, struct bt_vcs **vcs) |
Register the Volume Control Service. More... | |
int | bt_vcs_included_get (struct bt_vcs *vcs, struct bt_vcs_included *included) |
Get Volume Control Service included services. More... | |
int | bt_vcs_client_conn_get (const struct bt_vcs *vcs, struct bt_conn **conn) |
Get the connection pointer of a client instance. More... | |
int | bt_vcs_discover (struct bt_conn *conn, struct bt_vcs **vcs) |
Discover Volume Control Service and included services. More... | |
int | bt_vcs_vol_step_set (uint8_t volume_step) |
Set the Volume Control Service volume step size. More... | |
int | bt_vcs_vol_get (struct bt_vcs *vcs) |
Read the Volume Control Service volume state. More... | |
int | bt_vcs_flags_get (struct bt_vcs *vcs) |
Read the Volume Control Service flags. More... | |
int | bt_vcs_vol_down (struct bt_vcs *vcs) |
Turn the volume down by one step on the server. More... | |
int | bt_vcs_vol_up (struct bt_vcs *vcs) |
Turn the volume up by one step on the server. More... | |
int | bt_vcs_unmute_vol_down (struct bt_vcs *vcs) |
Turn the volume down and unmute the server. More... | |
int | bt_vcs_unmute_vol_up (struct bt_vcs *vcs) |
Turn the volume up and unmute the server. More... | |
int | bt_vcs_vol_set (struct bt_vcs *vcs, uint8_t volume) |
Set the volume on the server. More... | |
int | bt_vcs_unmute (struct bt_vcs *vcs) |
Unmute the server. More... | |
int | bt_vcs_mute (struct bt_vcs *vcs) |
Mute the server. More... | |
int | bt_vcs_vocs_state_get (struct bt_vcs *vcs, struct bt_vocs *inst) |
Read the Volume Offset Control Service offset state. More... | |
int | bt_vcs_vocs_location_get (struct bt_vcs *vcs, struct bt_vocs *inst) |
Read the Volume Offset Control Service location. More... | |
int | bt_vcs_vocs_location_set (struct bt_vcs *vcs, struct bt_vocs *inst, uint8_t location) |
Set the Volume Offset Control Service location. More... | |
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. More... | |
int | bt_vcs_vocs_description_get (struct bt_vcs *vcs, struct bt_vocs *inst) |
Read the Volume Offset Control Service output description. More... | |
int | bt_vcs_vocs_description_set (struct bt_vcs *vcs, struct bt_vocs *inst, const char *description) |
Set the Volume Offset Control Service description. More... | |
int | bt_vcs_aics_deactivate (struct bt_vcs *vcs, struct bt_aics *inst) |
Deactivates an Audio Input Control Service instance. More... | |
int | bt_vcs_aics_activate (struct bt_vcs *vcs, struct bt_aics *inst) |
Activates an Audio Input Control Service instance. More... | |
int | bt_vcs_aics_state_get (struct bt_vcs *vcs, struct bt_aics *inst) |
Read the Audio Input Control Service input state. More... | |
int | bt_vcs_aics_gain_setting_get (struct bt_vcs *vcs, struct bt_aics *inst) |
Read the Audio Input Control Service gain settings. More... | |
int | bt_vcs_aics_type_get (struct bt_vcs *vcs, struct bt_aics *inst) |
Read the Audio Input Control Service input type. More... | |
int | bt_vcs_aics_status_get (struct bt_vcs *vcs, struct bt_aics *inst) |
Read the Audio Input Control Service input status. More... | |
int | bt_vcs_aics_mute (struct bt_vcs *vcs, struct bt_aics *inst) |
Mute the Audio Input Control Service input. More... | |
int | bt_vcs_aics_unmute (struct bt_vcs *vcs, struct bt_aics *inst) |
Unmute the Audio Input Control Service input. More... | |
int | bt_vcs_aics_manual_gain_set (struct bt_vcs *vcs, struct bt_aics *inst) |
Set input gain to manual. More... | |
int | bt_vcs_aics_automatic_gain_set (struct bt_vcs *vcs, struct bt_aics *inst) |
Set the input gain to automatic. More... | |
int | bt_vcs_aics_gain_set (struct bt_vcs *vcs, struct bt_aics *inst, int8_t gain) |
Set the input gain. More... | |
int | bt_vcs_aics_description_get (struct bt_vcs *vcs, struct bt_aics *inst) |
Read the Audio Input Control Service description. More... | |
int | bt_vcs_aics_description_set (struct bt_vcs *vcs, struct bt_aics *inst, const char *description) |
Set the Audio Input Control Service description. More... | |
int | bt_vcs_client_cb_register (struct bt_vcs_cb *cb) |
Registers the callbacks used by the Volume Control Service client. More... | |
Volume Control Service (VCS)
[Experimental] Users should note that the APIs can change as a part of ongoing development.
#define BT_VCS_AICS_CNT 0 |
#include <include/bluetooth/audio/vcs.h>
#define BT_VCS_ERR_INVALID_COUNTER 0x80 |
#include <include/bluetooth/audio/vcs.h>
Volume Control Service Error codes
#define BT_VCS_ERR_OP_NOT_SUPPORTED 0x81 |
#include <include/bluetooth/audio/vcs.h>
#define BT_VCS_STATE_MUTED 0x01 |
#include <include/bluetooth/audio/vcs.h>
#define BT_VCS_STATE_UNMUTED 0x00 |
#include <include/bluetooth/audio/vcs.h>
Volume Control Service Mute Values
#define BT_VCS_VOCS_CNT 0 |
#include <include/bluetooth/audio/vcs.h>
typedef void(* bt_vcs_discover_cb) (struct bt_vcs *vcs, int err, uint8_t vocs_count, uint8_t aics_count) |
#include <include/bluetooth/audio/vcs.h>
Callback function for bt_vcs_discover.
This callback is only used for the client.
vcs | Volume Control Service instance pointer. |
err | Error value. 0 on success, GATT error on positive value or errno on negative value. |
vocs_count | Number of Volume Offset Control Service instances on peer device. |
aics_count | Number of Audio Input Control Service instances on peer device. |
#include <include/bluetooth/audio/vcs.h>
Callback function for Volume Control Service flags.
Called when the value is locally read as the server. Called when the value is remotely read as the client. Called if the value is changed by either the server or client.
vcs | Volume Control Service instance pointer. |
err | Error value. 0 on success, GATT error on positive value or errno on negative value. |
flags | The flags of the Volume Control Service server. |
#include <include/bluetooth/audio/vcs.h>
Callback function for Volume Control Service volume state.
Called when the value is locally read as the server. Called when the value is remotely read as the client. Called if the value is changed by either the server or client.
vcs | Volume Control Service instance pointer. |
err | Error value. 0 on success, GATT error on positive value or errno on negative value. |
volume | The volume of the Volume Control Service server. |
mute | The mute setting of the Volume Control Service server. |
typedef void(* bt_vcs_write_cb) (struct bt_vcs *vcs, int err) |
#include <include/bluetooth/audio/vcs.h>
Callback function for writes.
This callback is only used for the client.
vcs | Volume Control Service instance pointer. |
err | Error value. 0 on success, GATT error on fail. |
int bt_vcs_aics_activate | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Activates an Audio Input Control Service instance.
Audio Input Control Services are activated by default, but this will allow the server to reactivate an Audio Input Control Service instance after it has been deactivated with bt_vcs_aics_deactivate.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
int bt_vcs_aics_automatic_gain_set | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Set the input gain to automatic.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
int bt_vcs_aics_deactivate | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Deactivates an Audio Input Control Service instance.
Audio Input Control Services are activated by default, but this will allow the server to deactivate an Audio Input Control Service.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
int bt_vcs_aics_description_get | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Read the Audio Input Control Service description.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
int bt_vcs_aics_description_set | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst, | ||
const char * | description | ||
) |
#include <include/bluetooth/audio/vcs.h>
Set the Audio Input Control Service description.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
description | The description to set. |
int bt_vcs_aics_gain_set | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst, | ||
int8_t | gain | ||
) |
#include <include/bluetooth/audio/vcs.h>
Set the input gain.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
gain | The gain in dB to set (-128 to 127). |
int bt_vcs_aics_gain_setting_get | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Read the Audio Input Control Service gain settings.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
int bt_vcs_aics_manual_gain_set | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Set input gain to manual.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
int bt_vcs_aics_mute | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Mute the Audio Input Control Service input.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
int bt_vcs_aics_state_get | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Read the Audio Input Control Service input state.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
int bt_vcs_aics_status_get | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Read the Audio Input Control Service input status.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
int bt_vcs_aics_type_get | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Read the Audio Input Control Service input type.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
int bt_vcs_aics_unmute | ( | struct bt_vcs * | vcs, |
struct bt_aics * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Unmute the Audio Input Control Service input.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Audio Input Control Service instance. |
int bt_vcs_client_cb_register | ( | struct bt_vcs_cb * | cb | ) |
#include <include/bluetooth/audio/vcs.h>
Registers the callbacks used by the Volume Control Service client.
cb | The callback structure. |
int bt_vcs_client_conn_get | ( | const struct bt_vcs * | vcs, |
struct bt_conn ** | conn | ||
) |
#include <include/bluetooth/audio/vcs.h>
Get the connection pointer of a client instance.
Get the Bluetooth connection pointer of a Volume Control Service client instance.
vcs | Volume Control Service client instance pointer. | |
[out] | conn | Connection pointer. |
int bt_vcs_discover | ( | struct bt_conn * | conn, |
struct bt_vcs ** | vcs | ||
) |
#include <include/bluetooth/audio/vcs.h>
Discover Volume Control Service and included services.
This will start a GATT discovery and setup handles and subscriptions. This shall be called once before any other actions can be executed for the peer device, and the bt_vcs_discover_cb callback will notify when it is possible to start remote operations.
This shall only be done as the client,
conn | The connection to discover Volume Control Service for. | |
[out] | vcs | Valid remote instance object on success. |
int bt_vcs_flags_get | ( | struct bt_vcs * | vcs | ) |
#include <include/bluetooth/audio/vcs.h>
Read the Volume Control Service flags.
vcs | Volume Control Service instance pointer. |
int bt_vcs_included_get | ( | struct bt_vcs * | vcs, |
struct bt_vcs_included * | included | ||
) |
#include <include/bluetooth/audio/vcs.h>
Get Volume Control Service included services.
Returns a pointer to a struct that contains information about the Volume Control Service included service instances, such as pointers to the Volume Offset Control Service (Volume Offset Control Service) or Audio Input Control Service (AICS) instances.
vcs | Volume Control Service instance pointer. | |
[out] | included | Pointer to store the result in. |
int bt_vcs_mute | ( | struct bt_vcs * | vcs | ) |
#include <include/bluetooth/audio/vcs.h>
Mute the server.
vcs | Volume Control Service instance pointer. |
int bt_vcs_register | ( | struct bt_vcs_register_param * | param, |
struct bt_vcs ** | vcs | ||
) |
#include <include/bluetooth/audio/vcs.h>
Register the Volume Control Service.
This will register and enable the service and make it discoverable by clients.
param | Volume Control Service register parameters. | |
[out] | vcs | Pointer to the registered Volume Control Service. This will still be valid if the return value is -EALREADY. |
int bt_vcs_unmute | ( | struct bt_vcs * | vcs | ) |
#include <include/bluetooth/audio/vcs.h>
Unmute the server.
vcs | Volume Control Service instance pointer. |
int bt_vcs_unmute_vol_down | ( | struct bt_vcs * | vcs | ) |
#include <include/bluetooth/audio/vcs.h>
Turn the volume down and unmute the server.
vcs | Volume Control Service instance pointer. |
int bt_vcs_unmute_vol_up | ( | struct bt_vcs * | vcs | ) |
#include <include/bluetooth/audio/vcs.h>
Turn the volume up and unmute the server.
vcs | Volume Control Service instance pointer. |
int bt_vcs_vocs_description_get | ( | struct bt_vcs * | vcs, |
struct bt_vocs * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Read the Volume Offset Control Service output description.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Volume Offset Control Service instance. |
int bt_vcs_vocs_description_set | ( | struct bt_vcs * | vcs, |
struct bt_vocs * | inst, | ||
const char * | description | ||
) |
#include <include/bluetooth/audio/vcs.h>
Set the Volume Offset Control Service description.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Volume Offset Control Service instance. |
description | The description to set. |
int bt_vcs_vocs_location_get | ( | struct bt_vcs * | vcs, |
struct bt_vocs * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Read the Volume Offset Control Service location.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Volume Offset Control Service instance. |
int bt_vcs_vocs_location_set | ( | struct bt_vcs * | vcs, |
struct bt_vocs * | inst, | ||
uint8_t | location | ||
) |
#include <include/bluetooth/audio/vcs.h>
Set the Volume Offset Control Service location.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Volume Offset Control Service instance. |
location | The location to set. |
int bt_vcs_vocs_state_get | ( | struct bt_vcs * | vcs, |
struct bt_vocs * | inst | ||
) |
#include <include/bluetooth/audio/vcs.h>
Read the Volume Offset Control Service offset state.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Volume Offset Control Service instance. |
int bt_vcs_vocs_state_set | ( | struct bt_vcs * | vcs, |
struct bt_vocs * | inst, | ||
int16_t | offset | ||
) |
#include <include/bluetooth/audio/vcs.h>
Set the Volume Offset Control Service offset state.
vcs | Volume Control Service instance pointer. |
inst | Pointer to the Volume Offset Control Service instance. |
offset | The offset to set (-255 to 255). |
int bt_vcs_vol_down | ( | struct bt_vcs * | vcs | ) |
#include <include/bluetooth/audio/vcs.h>
Turn the volume down by one step on the server.
vcs | Volume Control Service instance pointer. |
int bt_vcs_vol_get | ( | struct bt_vcs * | vcs | ) |
#include <include/bluetooth/audio/vcs.h>
Read the Volume Control Service volume state.
vcs | Volume Control Service instance pointer. |
int bt_vcs_vol_set | ( | struct bt_vcs * | vcs, |
uint8_t | volume | ||
) |
#include <include/bluetooth/audio/vcs.h>
Set the volume on the server.
vcs | Volume Control Service instance pointer. |
volume | The absolute volume to set. |
int bt_vcs_vol_step_set | ( | uint8_t | volume_step | ) |
#include <include/bluetooth/audio/vcs.h>
Set the Volume Control Service volume step size.
Set the value that the volume changes, when changed relatively with e.g. bt_vcs_vol_down or bt_vcs_vol_up.
This can only be done as the server.
volume_step | The volume step size (1-255). |
int bt_vcs_vol_up | ( | struct bt_vcs * | vcs | ) |
#include <include/bluetooth/audio/vcs.h>
Turn the volume up by one step on the server.
vcs | Volume Control Service instance pointer. |