Bluetooth: Audio: Rename VCS to VCP

Renames almost all occurences of VCS to VCP, as we want to
use the profile as the namespace for volume control.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2022-10-09 12:26:55 +02:00 committed by Carles Cufí
commit ce2b8f9fe1
25 changed files with 2844 additions and 2816 deletions

View file

@ -7,4 +7,4 @@ Bluetooth Audio Volume Control
API Reference
*************
.. doxygengroup:: bt_gatt_vcs
.. doxygengroup:: bt_gatt_vcp

View file

@ -8,9 +8,9 @@
#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_VCP_H_
/**
* @brief Volume Control Service (VCS)
* @brief Volume Control Profile (VCP)
*
* @defgroup bt_gatt_vcs Volume Control Service (VCS)
* @defgroup bt_gatt_vcp Volume Control Profile (VCP)
*
* @ingroup bluetooth
* @{
@ -27,27 +27,27 @@
extern "C" {
#endif
#if defined(CONFIG_BT_VCS)
#define BT_VCS_VOCS_CNT CONFIG_BT_VCS_VOCS_INSTANCE_COUNT
#define BT_VCS_AICS_CNT CONFIG_BT_VCS_AICS_INSTANCE_COUNT
#if defined(CONFIG_BT_VCP)
#define BT_VCP_VOCS_CNT CONFIG_BT_VCP_VOCS_INSTANCE_COUNT
#define BT_VCP_AICS_CNT CONFIG_BT_VCP_AICS_INSTANCE_COUNT
#else
#define BT_VCS_VOCS_CNT 0
#define BT_VCS_AICS_CNT 0
#endif /* CONFIG_BT_VCS */
#define BT_VCP_VOCS_CNT 0
#define BT_VCP_AICS_CNT 0
#endif /* CONFIG_BT_VCP */
/** Volume Control Service Error codes */
#define BT_VCS_ERR_INVALID_COUNTER 0x80
#define BT_VCS_ERR_OP_NOT_SUPPORTED 0x81
#define BT_VCP_ERR_INVALID_COUNTER 0x80
#define BT_VCP_ERR_OP_NOT_SUPPORTED 0x81
/** Volume Control Service Mute Values */
#define BT_VCS_STATE_UNMUTED 0x00
#define BT_VCS_STATE_MUTED 0x01
#define BT_VCP_STATE_UNMUTED 0x00
#define BT_VCP_STATE_MUTED 0x01
/** @brief Opaque Volume Control Service instance. */
struct bt_vcs;
struct bt_vcp;
/** Register structure for Volume Control Service */
struct bt_vcs_register_param {
struct bt_vcp_register_param {
/** Initial step size (1-255) */
uint8_t step;
@ -58,13 +58,13 @@ struct bt_vcs_register_param {
uint8_t volume;
/** Register parameters for Volume Offset Control Services */
struct bt_vocs_register_param vocs_param[BT_VCS_VOCS_CNT];
struct bt_vocs_register_param vocs_param[BT_VCP_VOCS_CNT];
/** Register parameters for Audio Input Control Services */
struct bt_aics_register_param aics_param[BT_VCS_AICS_CNT];
struct bt_aics_register_param aics_param[BT_VCP_AICS_CNT];
/** Volume Control Service callback structure. */
struct bt_vcs_cb *cb;
struct bt_vcp_cb *cb;
};
/**
@ -74,7 +74,7 @@ struct bt_vcs_register_param {
* for either a client or a server. The instance pointers either represent
* local server instances, or remote service instances.
*/
struct bt_vcs_included {
struct bt_vcp_included {
/** Number of Volume Offset Control Service instances */
uint8_t vocs_cnt;
/** Array of pointers to Volume Offset Control Service instances */
@ -93,12 +93,12 @@ struct bt_vcs_included {
* clients.
*
* @param param Volume Control Service register parameters.
* @param[out] vcs Pointer to the registered Volume Control Service.
* @param[out] vcp Pointer to the registered Volume Control Service.
* This will still be valid if the return value is -EALREADY.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_register(struct bt_vcs_register_param *param, struct bt_vcs **vcs);
int bt_vcp_register(struct bt_vcp_register_param *param, struct bt_vcp **vcp);
/**
* @brief Get Volume Control Service included services.
@ -108,12 +108,12 @@ int bt_vcs_register(struct bt_vcs_register_param *param, struct bt_vcs **vcs);
* Volume Offset Control Service (Volume Offset Control Service) or
* Audio Input Control Service (AICS) instances.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param[out] included Pointer to store the result in.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_included_get(struct bt_vcs *vcs, struct bt_vcs_included *included);
int bt_vcp_included_get(struct bt_vcp *vcp, struct bt_vcp_included *included);
/**
* @brief Get the connection pointer of a client instance
@ -121,19 +121,19 @@ int bt_vcs_included_get(struct bt_vcs *vcs, struct bt_vcs_included *included);
* Get the Bluetooth connection pointer of a Volume Control Service
* client instance.
*
* @param vcs Volume Control Service client instance pointer.
* @param vcp Volume Control Service client instance pointer.
* @param[out] conn Connection pointer.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_client_conn_get(const struct bt_vcs *vcs, struct bt_conn **conn);
int bt_vcp_client_conn_get(const struct bt_vcp *vcp, struct bt_conn **conn);
/**
* @brief Callback function for bt_vcs_discover.
* @brief Callback function for bt_vcp_discover.
*
* This callback is only used for the client.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param err Error value. 0 on success, GATT error on positive value
* or errno on negative value.
* @param vocs_count Number of Volume Offset Control Service instances
@ -141,7 +141,7 @@ int bt_vcs_client_conn_get(const struct bt_vcs *vcs, struct bt_conn **conn);
* @param aics_count Number of Audio Input Control Service instances on
* peer device.
*/
typedef void (*bt_vcs_discover_cb)(struct bt_vcs *vcs, int err,
typedef void (*bt_vcp_discover_cb)(struct bt_vcp *vcp, int err,
uint8_t vocs_count, uint8_t aics_count);
/**
@ -151,13 +151,13 @@ typedef void (*bt_vcs_discover_cb)(struct bt_vcs *vcs, int err,
* Called when the value is remotely read as the client.
* Called if the value is changed by either the server or client.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param err Error value. 0 on success, GATT error on positive value
* or errno on negative value.
* @param volume The volume of the Volume Control Service server.
* @param mute The mute setting of the Volume Control Service server.
*/
typedef void (*bt_vcs_state_cb)(struct bt_vcs *vcs, int err, uint8_t volume,
typedef void (*bt_vcp_state_cb)(struct bt_vcp *vcp, int err, uint8_t volume,
uint8_t mute);
/**
@ -167,43 +167,43 @@ typedef void (*bt_vcs_state_cb)(struct bt_vcs *vcs, int err, uint8_t volume,
* Called when the value is remotely read as the client.
* Called if the value is changed by either the server or client.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param err Error value. 0 on success, GATT error on positive value
* or errno on negative value.
* @param flags The flags of the Volume Control Service server.
*/
typedef void (*bt_vcs_flags_cb)(struct bt_vcs *vcs, int err, uint8_t flags);
typedef void (*bt_vcp_flags_cb)(struct bt_vcp *vcp, int err, uint8_t flags);
/**
* @brief Callback function for writes.
*
* This callback is only used for the client.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param err Error value. 0 on success, GATT error on fail.
*/
typedef void (*bt_vcs_write_cb)(struct bt_vcs *vcs, int err);
typedef void (*bt_vcp_write_cb)(struct bt_vcp *vcp, int err);
struct bt_vcs_cb {
struct bt_vcp_cb {
/* Volume Control Service */
bt_vcs_state_cb state;
bt_vcs_flags_cb flags;
#if defined(CONFIG_BT_VCS_CLIENT)
bt_vcs_discover_cb discover;
bt_vcs_write_cb vol_down;
bt_vcs_write_cb vol_up;
bt_vcs_write_cb mute;
bt_vcs_write_cb unmute;
bt_vcs_write_cb vol_down_unmute;
bt_vcs_write_cb vol_up_unmute;
bt_vcs_write_cb vol_set;
bt_vcp_state_cb state;
bt_vcp_flags_cb flags;
#if defined(CONFIG_BT_VCP_CLIENT)
bt_vcp_discover_cb discover;
bt_vcp_write_cb vol_down;
bt_vcp_write_cb vol_up;
bt_vcp_write_cb mute;
bt_vcp_write_cb unmute;
bt_vcp_write_cb vol_down_unmute;
bt_vcp_write_cb vol_up_unmute;
bt_vcp_write_cb vol_set;
/* Volume Offset Control Service */
struct bt_vocs_cb vocs_cb;
/* Audio Input Control Service */
struct bt_aics_cb aics_cb;
#endif /* CONFIG_BT_VCS_CLIENT */
#endif /* CONFIG_BT_VCP_CLIENT */
};
/**
@ -211,23 +211,23 @@ struct bt_vcs_cb {
*
* 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 @ref bt_vcs_discover_cb callback
* executed for the peer device, and the @ref bt_vcp_discover_cb callback
* will notify when it is possible to start remote operations.
*
* This shall only be done as the client,
*
* @param conn The connection to discover Volume Control Service for.
* @param[out] vcs Valid remote instance object on success.
* @param[out] vcp Valid remote instance object on success.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_discover(struct bt_conn *conn, struct bt_vcs **vcs);
int bt_vcp_discover(struct bt_conn *conn, struct bt_vcp **vcp);
/**
* @brief Set the Volume Control Service volume step size.
*
* Set the value that the volume changes, when changed relatively with e.g.
* @ref bt_vcs_vol_down or @ref bt_vcs_vol_up.
* @ref bt_vcp_vol_down or @ref bt_vcp_vol_up.
*
* This can only be done as the server.
*
@ -235,154 +235,154 @@ int bt_vcs_discover(struct bt_conn *conn, struct bt_vcs **vcs);
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_vol_step_set(uint8_t volume_step);
int bt_vcp_vol_step_set(uint8_t volume_step);
/**
* @brief Read the Volume Control Service volume state.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_vol_get(struct bt_vcs *vcs);
int bt_vcp_vol_get(struct bt_vcp *vcp);
/**
* @brief Read the Volume Control Service flags.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_flags_get(struct bt_vcs *vcs);
int bt_vcp_flags_get(struct bt_vcp *vcp);
/**
* @brief Turn the volume down by one step on the server.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_vol_down(struct bt_vcs *vcs);
int bt_vcp_vol_down(struct bt_vcp *vcp);
/**
* @brief Turn the volume up by one step on the server.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_vol_up(struct bt_vcs *vcs);
int bt_vcp_vol_up(struct bt_vcp *vcp);
/**
* @brief Turn the volume down and unmute the server.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_unmute_vol_down(struct bt_vcs *vcs);
int bt_vcp_unmute_vol_down(struct bt_vcp *vcp);
/**
* @brief Turn the volume up and unmute the server.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_unmute_vol_up(struct bt_vcs *vcs);
int bt_vcp_unmute_vol_up(struct bt_vcp *vcp);
/**
* @brief Set the volume on the server
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param volume The absolute volume to set.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_vol_set(struct bt_vcs *vcs, uint8_t volume);
int bt_vcp_vol_set(struct bt_vcp *vcp, uint8_t volume);
/**
* @brief Unmute the server.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_unmute(struct bt_vcs *vcs);
int bt_vcp_unmute(struct bt_vcp *vcp);
/**
* @brief Mute the server.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_mute(struct bt_vcs *vcs);
int bt_vcp_mute(struct bt_vcp *vcp);
/**
* @brief Read the Volume Offset Control Service offset state.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Volume Offset Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_vocs_state_get(struct bt_vcs *vcs, struct bt_vocs *inst);
int bt_vcp_vocs_state_get(struct bt_vcp *vcp, struct bt_vocs *inst);
/**
* @brief Read the Volume Offset Control Service location.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Volume Offset Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_vocs_location_get(struct bt_vcs *vcs, struct bt_vocs *inst);
int bt_vcp_vocs_location_get(struct bt_vcp *vcp, struct bt_vocs *inst);
/**
* @brief Set the Volume Offset Control Service location.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Volume Offset Control Service instance.
* @param location The location to set.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_vocs_location_set(struct bt_vcs *vcs, struct bt_vocs *inst,
int bt_vcp_vocs_location_set(struct bt_vcp *vcp, struct bt_vocs *inst,
uint8_t location);
/**
* @brief Set the Volume Offset Control Service offset state.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Volume Offset Control Service instance.
* @param offset The offset to set (-255 to 255).
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_vocs_state_set(struct bt_vcs *vcs, struct bt_vocs *inst,
int bt_vcp_vocs_state_set(struct bt_vcp *vcp, struct bt_vocs *inst,
int16_t offset);
/**
* @brief Read the Volume Offset Control Service output description.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Volume Offset Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_vocs_description_get(struct bt_vcs *vcs, struct bt_vocs *inst);
int bt_vcp_vocs_description_get(struct bt_vcp *vcp, struct bt_vocs *inst);
/**
* @brief Set the Volume Offset Control Service description.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Volume Offset Control Service instance.
* @param description The description to set.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_vocs_description_set(struct bt_vcs *vcs, struct bt_vocs *inst,
int bt_vcp_vocs_description_set(struct bt_vcp *vcp, struct bt_vocs *inst,
const char *description);
/**
@ -391,139 +391,139 @@ int bt_vcs_vocs_description_set(struct bt_vcs *vcs, struct bt_vocs *inst,
* Audio Input Control Services are activated by default, but this will allow
* the server to deactivate an Audio Input Control Service.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_deactivate(struct bt_vcs *vcs, struct bt_aics *inst);
int bt_vcp_aics_deactivate(struct bt_vcp *vcp, struct bt_aics *inst);
/**
* @brief 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 @ref bt_vcs_aics_deactivate.
* been deactivated with @ref bt_vcp_aics_deactivate.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_activate(struct bt_vcs *vcs, struct bt_aics *inst);
int bt_vcp_aics_activate(struct bt_vcp *vcp, struct bt_aics *inst);
/**
* @brief Read the Audio Input Control Service input state.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_state_get(struct bt_vcs *vcs, struct bt_aics *inst);
int bt_vcp_aics_state_get(struct bt_vcp *vcp, struct bt_aics *inst);
/**
* @brief Read the Audio Input Control Service gain settings.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_gain_setting_get(struct bt_vcs *vcs, struct bt_aics *inst);
int bt_vcp_aics_gain_setting_get(struct bt_vcp *vcp, struct bt_aics *inst);
/**
* @brief Read the Audio Input Control Service input type.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_type_get(struct bt_vcs *vcs, struct bt_aics *inst);
int bt_vcp_aics_type_get(struct bt_vcp *vcp, struct bt_aics *inst);
/**
* @brief Read the Audio Input Control Service input status.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_status_get(struct bt_vcs *vcs, struct bt_aics *inst);
int bt_vcp_aics_status_get(struct bt_vcp *vcp, struct bt_aics *inst);
/**
* @brief Mute the Audio Input Control Service input.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_mute(struct bt_vcs *vcs, struct bt_aics *inst);
int bt_vcp_aics_mute(struct bt_vcp *vcp, struct bt_aics *inst);
/**
* @brief Unmute the Audio Input Control Service input.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_unmute(struct bt_vcs *vcs, struct bt_aics *inst);
int bt_vcp_aics_unmute(struct bt_vcp *vcp, struct bt_aics *inst);
/**
* @brief Set input gain to manual.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_manual_gain_set(struct bt_vcs *vcs, struct bt_aics *inst);
int bt_vcp_aics_manual_gain_set(struct bt_vcp *vcp, struct bt_aics *inst);
/**
* @brief Set the input gain to automatic.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_automatic_gain_set(struct bt_vcs *vcs, struct bt_aics *inst);
int bt_vcp_aics_automatic_gain_set(struct bt_vcp *vcp, struct bt_aics *inst);
/**
* @brief Set the input gain.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
* @param gain The gain in dB to set (-128 to 127).
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_gain_set(struct bt_vcs *vcs, struct bt_aics *inst,
int bt_vcp_aics_gain_set(struct bt_vcp *vcp, struct bt_aics *inst,
int8_t gain);
/**
* @brief Read the Audio Input Control Service description.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_description_get(struct bt_vcs *vcs, struct bt_aics *inst);
int bt_vcp_aics_description_get(struct bt_vcp *vcp, struct bt_aics *inst);
/**
* @brief Set the Audio Input Control Service description.
*
* @param vcs Volume Control Service instance pointer.
* @param vcp Volume Control Service instance pointer.
* @param inst Pointer to the Audio Input Control Service instance.
* @param description The description to set.
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_aics_description_set(struct bt_vcs *vcs, struct bt_aics *inst,
int bt_vcp_aics_description_set(struct bt_vcp *vcp, struct bt_aics *inst,
const char *description);
/**
@ -533,7 +533,7 @@ int bt_vcs_aics_description_set(struct bt_vcs *vcs, struct bt_aics *inst,
*
* @return 0 if success, errno on failure.
*/
int bt_vcs_client_cb_register(struct bt_vcs_cb *cb);
int bt_vcp_client_cb_register(struct bt_vcp_cb *cb);
#ifdef __cplusplus
}

View file

@ -3,4 +3,4 @@ CONFIG_BT_HAS_HEARING_AID_BANDED=y
# If the HA supports the Volume Balance feature (see Section 3.1) and the HA
# is a Banded Hearing Aid, the HA shall instantiate two instances of VOCS.
CONFIG_BT_VOCS_MAX_INSTANCE_COUNT=2
CONFIG_BT_VCS_VOCS_INSTANCE_COUNT=2
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT=2

View file

@ -26,7 +26,7 @@ CONFIG_BT_PACS_SRC_CONTEXT=0x0003
CONFIG_BT_PAC_SNK_LOC=y
CONFIG_BT_PAC_SRC_LOC=y
CONFIG_BT_VCS=y
CONFIG_BT_VCP=y
CONFIG_BT_MICP_MIC_DEV=y
CONFIG_BT_HAS=y
CONFIG_BT_HAS_HEARING_AID_MONAURAL=y
@ -37,7 +37,7 @@ CONFIG_BT_CAP_ACCEPTOR=y
CONFIG_BT_AICS_MAX_INSTANCE_COUNT=2
# The HA may expose an instance of MICS and an instance of AICS to control
# the capture of ambient sound.
CONFIG_BT_VCS_AICS_INSTANCE_COUNT=1
CONFIG_BT_VCP_AICS_INSTANCE_COUNT=1
# An HA may instantiate one or more instances of Audio Input Control Service
# (AICS) to expose control of the gain of its inputs to a Volume Controller.
CONFIG_BT_MICP_MIC_DEV_AICS_INSTANCE_COUNT=1
@ -46,7 +46,7 @@ CONFIG_BT_MICP_MIC_DEV_AICS_INSTANCE_COUNT=1
# is part of a Binaural Hearing Aid Set, the HA shall instantiate one instance
# of Volume Offset Control Service (VOCS).
CONFIG_BT_VOCS_MAX_INSTANCE_COUNT=1
CONFIG_BT_VCS_VOCS_INSTANCE_COUNT=1
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT=1
CONFIG_BT_BAS=y
CONFIG_BT_IAS=y

View file

@ -16,10 +16,10 @@
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/audio/vcp.h>
static struct bt_vcs *vcs;
static struct bt_vcs_included vcs_included;
static struct bt_vcp *vcp;
static struct bt_vcp_included vcp_included;
static void vcs_state_cb(struct bt_vcs *vcs, int err, uint8_t volume, uint8_t mute)
static void vcs_state_cb(struct bt_vcp *vcp, int err, uint8_t volume, uint8_t mute)
{
if (err) {
printk("VCS state get failed (%d)\n", err);
@ -28,7 +28,7 @@ static void vcs_state_cb(struct bt_vcs *vcs, int err, uint8_t volume, uint8_t mu
}
}
static void vcs_flags_cb(struct bt_vcs *vcs, int err, uint8_t flags)
static void vcs_flags_cb(struct bt_vcp *vcp, int err, uint8_t flags)
{
if (err) {
printk("VCS flags get failed (%d)\n", err);
@ -111,7 +111,7 @@ static void vocs_description_cb(struct bt_vocs *inst, int err, char *description
}
}
static struct bt_vcs_cb vcs_cbs = {
static struct bt_vcp_cb vcs_cbs = {
.state = vcs_state_cb,
.flags = vcs_flags_cb,
};
@ -133,9 +133,9 @@ static struct bt_vocs_cb vocs_cbs = {
int vcp_vol_renderer_init(void)
{
int err;
struct bt_vcs_register_param vcs_param;
char input_desc[CONFIG_BT_VCS_AICS_INSTANCE_COUNT][16];
char output_desc[CONFIG_BT_VCS_VOCS_INSTANCE_COUNT][16];
struct bt_vcp_register_param vcs_param;
char input_desc[CONFIG_BT_VCP_AICS_INSTANCE_COUNT][16];
char output_desc[CONFIG_BT_VCP_VOCS_INSTANCE_COUNT][16];
memset(&vcs_param, 0, sizeof(vcs_param));
@ -161,16 +161,16 @@ int vcp_vol_renderer_init(void)
}
vcs_param.step = 1;
vcs_param.mute = BT_VCS_STATE_UNMUTED;
vcs_param.mute = BT_VCP_STATE_UNMUTED;
vcs_param.volume = 100;
vcs_param.cb = &vcs_cbs;
err = bt_vcs_register(&vcs_param, &vcs);
err = bt_vcp_register(&vcs_param, &vcs);
if (err) {
return err;
}
err = bt_vcs_included_get(vcs, &vcs_included);
err = bt_vcp_included_get(vcs, &vcp_included);
if (err != 0) {
return err;
}

View file

@ -16,10 +16,10 @@ if (CONFIG_BT_AICS OR CONFIG_BT_AICS_CLIENT)
endif()
zephyr_library_sources_ifdef(CONFIG_BT_AICS_CLIENT aics_client.c)
if (CONFIG_BT_VCS OR CONFIG_BT_VCS_CLIENT)
zephyr_library_sources(vcs.c)
if (CONFIG_BT_VCP OR CONFIG_BT_VCP_CLIENT)
zephyr_library_sources(vcp.c)
endif()
zephyr_library_sources_ifdef(CONFIG_BT_VCS_CLIENT vcs_client.c)
zephyr_library_sources_ifdef(CONFIG_BT_VCP_CLIENT vcp_client.c)
if (CONFIG_BT_MICP_MIC_DEV)
zephyr_library_sources(micp_mic_dev.c)

View file

@ -8,14 +8,14 @@
##################### Volume Control Service #####################
config BT_VCS
bool "Volume Control Service Support [EXPERIMENTAL]"
config BT_VCP
bool "Volume Control Profile Support [EXPERIMENTAL]"
select EXPERIMENTAL
help
This option enables support for Volume Control Service.
if BT_VCS
config BT_VCS_VOCS_INSTANCE_COUNT
if BT_VCP
config BT_VCP_VOCS_INSTANCE_COUNT
int "Volume Offset Control Service instance count"
default 0
range 0 BT_VOCS_MAX_INSTANCE_COUNT
@ -23,14 +23,14 @@ config BT_VCS_VOCS_INSTANCE_COUNT
This option sets the number of instances of Volume Offset Control
Services.
config BT_VCS_VOCS
config BT_VCP_VOCS
bool # Hidden
default y if BT_VCS_VOCS_INSTANCE_COUNT > 0
default y if BT_VCP_VOCS_INSTANCE_COUNT > 0
help
This hidden option makes it possible to easily check if VOCS is
enabled for VCS.
config BT_VCS_AICS_INSTANCE_COUNT
config BT_VCP_AICS_INSTANCE_COUNT
int "Audio Input Control Service instance count for VCS"
default 0
range 0 BT_AICS_MAX_INSTANCE_COUNT
@ -38,42 +38,42 @@ config BT_VCS_AICS_INSTANCE_COUNT
This option sets the number of instances of Audio Input Control
Services for VCS.
config BT_VCS_AICS
config BT_VCP_AICS
bool # Hidden
default y if BT_VCS_AICS_INSTANCE_COUNT > 0
default y if BT_VCP_AICS_INSTANCE_COUNT > 0
help
This hidden option makes it possible to easily check if AICS is
enabled for VCS.
############# DEBUG #############
config BT_DEBUG_VCS
bool "Volume Control Service debug"
config BT_DEBUG_VCP
bool "Volume Control Profile debug"
select DEPRECATED
help
Use this option to enable Volume Control Service debug logs for the
Use this option to enable Volume Control Profile debug logs for the
Bluetooth Audio functionality.
module = BT_VCS
legacy-debug-sym = BT_DEBUG_VCS
module-str = "Volume Control Service"
legacy-debug-sym = BT_DEBUG_VCP
module-str = "Volume Control Profile"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
endif # BT_VCS
##################### Volume Control Profile Client #####################
config BT_VCS_CLIENT
bool "Volume Control Profile Support [EXPERIMENTAL]"
config BT_VCP_CLIENT
bool "Volume Control Profile Client Support [EXPERIMENTAL]"
select BT_GATT_CLIENT
select BT_GATT_AUTO_DISCOVER_CCC
select EXPERIMENTAL
help
This option enables support for Volume Control Profile.
if BT_VCS_CLIENT
if BT_VCP_CLIENT
config BT_VCS_CLIENT_MAX_VOCS_INST
config BT_VCP_CLIENT_MAX_VOCS_INST
int "Maximum number of VOCS instances to setup"
default 0
range 0 BT_VOCS_CLIENT_MAX_INSTANCE_COUNT
@ -81,14 +81,14 @@ config BT_VCS_CLIENT_MAX_VOCS_INST
Sets the maximum number of Volume Offset Control Service (VOCS)
instances to setup and use.
config BT_VCS_CLIENT_VOCS
config BT_VCP_CLIENT_VOCS
bool # Hidden
default y if BT_VCS_CLIENT_MAX_VOCS_INST > 0
default y if BT_VCP_CLIENT_MAX_VOCS_INST > 0
help
This hidden option makes it possible to easily check if VOCS is
enabled for VCS client.
config BT_VCS_CLIENT_MAX_AICS_INST
config BT_VCP_CLIENT_MAX_AICS_INST
int "Maximum number of AICS instances to setup"
default 0
range 0 3
@ -96,25 +96,25 @@ config BT_VCS_CLIENT_MAX_AICS_INST
Sets the maximum number of Audio Input Control Service (AICS)
instances to setup and use.
config BT_VCS_CLIENT_AICS
config BT_VCP_CLIENT_AICS
bool # Hidden
default y if BT_VCS_CLIENT_MAX_AICS_INST > 0
default y if BT_VCP_CLIENT_MAX_AICS_INST > 0
help
This hidden option makes it possible to easily check if AICS is
enabled for VCS client.
############# DEBUG #############
config BT_DEBUG_VCS_CLIENT
config BT_DEBUG_VCP_CLIENT
bool "Volume Control Profile debug"
select DEPRECATED
help
Use this option to enable Volume Control Profile debug logs for the
Bluetooth Audio functionality.
module = BT_VCS_CLIENT
legacy-debug-sym = BT_DEBUG_VCS_CLIENT
module-str = "Volume Control Profile"
module = BT_VCP_CLIENT
legacy-debug-sym = BT_DEBUG_VCP_CLIENT
module-str = "Volume Control Profile Client"
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
endif # BT_VCS_CLIENT
endif # BT_VCP_CLIENT

1046
subsys/bluetooth/audio/vcp.c Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,110 @@
/**
* @file
* @brief Internal Header for Bluetooth Volume Control Service (VCS).
*
* Copyright (c) 2020 Bose Corporation
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_VCP_INTERNAL_
#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_VCP_INTERNAL_
/* VCS opcodes */
#define BT_VCP_OPCODE_REL_VOL_DOWN 0x00
#define BT_VCP_OPCODE_REL_VOL_UP 0x01
#define BT_VCP_OPCODE_UNMUTE_REL_VOL_DOWN 0x02
#define BT_VCP_OPCODE_UNMUTE_REL_VOL_UP 0x03
#define BT_VCP_OPCODE_SET_ABS_VOL 0x04
#define BT_VCP_OPCODE_UNMUTE 0x05
#define BT_VCP_OPCODE_MUTE 0x06
struct vcs_state {
uint8_t volume;
uint8_t mute;
uint8_t change_counter;
} __packed;
struct vcs_control {
uint8_t opcode;
uint8_t counter;
} __packed;
struct vcs_control_vol {
struct vcs_control cp;
uint8_t volume;
} __packed;
#if defined(CONFIG_BT_VCP_CLIENT)
struct bt_vcp_client {
struct vcs_state state;
uint8_t flags;
uint16_t start_handle;
uint16_t end_handle;
uint16_t state_handle;
uint16_t control_handle;
uint16_t flag_handle;
struct bt_gatt_subscribe_params state_sub_params;
struct bt_gatt_discover_params state_sub_disc_params;
struct bt_gatt_subscribe_params flag_sub_params;
struct bt_gatt_discover_params flag_sub_disc_params;
bool cp_retried;
bool busy;
struct vcs_control_vol cp_val;
struct bt_gatt_write_params write_params;
struct bt_gatt_read_params read_params;
struct bt_gatt_discover_params discover_params;
struct bt_uuid_16 uuid;
struct bt_conn *conn;
uint8_t vocs_inst_cnt;
struct bt_vocs *vocs[CONFIG_BT_VCP_CLIENT_MAX_VOCS_INST];
uint8_t aics_inst_cnt;
struct bt_aics *aics[CONFIG_BT_VCP_CLIENT_MAX_AICS_INST];
};
#endif /* CONFIG_BT_VCP_CLIENT */
#if defined(CONFIG_BT_VCP)
struct bt_vcp_server {
struct vcs_state state;
uint8_t flags;
struct bt_vcp_cb *cb;
uint8_t volume_step;
struct bt_gatt_service *service_p;
struct bt_vocs *vocs_insts[CONFIG_BT_VCP_VOCS_INSTANCE_COUNT];
struct bt_aics *aics_insts[CONFIG_BT_VCP_AICS_INSTANCE_COUNT];
};
#endif /* CONFIG_BT_VCP */
/* Struct used as a common type for the api */
struct bt_vcp {
bool client_instance;
union {
#if defined(CONFIG_BT_VCP)
struct bt_vcp_server srv;
#endif /* CONFIG_BT_VCP */
#if defined(CONFIG_BT_VCP_CLIENT)
struct bt_vcp_client cli;
#endif /* CONFIG_BT_VCP_CLIENT */
};
};
int bt_vcp_client_included_get(struct bt_vcp *vcp,
struct bt_vcp_included *included);
int bt_vcp_client_read_vol_state(struct bt_vcp *vcp);
int bt_vcp_client_read_flags(struct bt_vcp *vcp);
int bt_vcp_client_vol_down(struct bt_vcp *vcp);
int bt_vcp_client_vol_up(struct bt_vcp *vcp);
int bt_vcp_client_unmute_vol_down(struct bt_vcp *vcp);
int bt_vcp_client_unmute_vol_up(struct bt_vcp *vcp);
int bt_vcp_client_set_volume(struct bt_vcp *vcp, uint8_t volume);
int bt_vcp_client_unmute(struct bt_vcp *vcp);
int bt_vcp_client_mute(struct bt_vcp *vcp);
bool bt_vcp_client_valid_vocs_inst(struct bt_vcp *vcp, struct bt_vocs *vocs);
bool bt_vcp_client_valid_aics_inst(struct bt_vcp *vcp, struct bt_aics *aics);
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_VCP_INTERNAL_*/

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,110 +0,0 @@
/**
* @file
* @brief Internal Header for Bluetooth Volume Control Service (VCS).
*
* Copyright (c) 2020 Bose Corporation
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_VCP_INTERNAL_
#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_VCP_INTERNAL_
/* VCS opcodes */
#define BT_VCS_OPCODE_REL_VOL_DOWN 0x00
#define BT_VCS_OPCODE_REL_VOL_UP 0x01
#define BT_VCS_OPCODE_UNMUTE_REL_VOL_DOWN 0x02
#define BT_VCS_OPCODE_UNMUTE_REL_VOL_UP 0x03
#define BT_VCS_OPCODE_SET_ABS_VOL 0x04
#define BT_VCS_OPCODE_UNMUTE 0x05
#define BT_VCS_OPCODE_MUTE 0x06
struct vcs_state {
uint8_t volume;
uint8_t mute;
uint8_t change_counter;
} __packed;
struct vcs_control {
uint8_t opcode;
uint8_t counter;
} __packed;
struct vcs_control_vol {
struct vcs_control cp;
uint8_t volume;
} __packed;
#if defined(CONFIG_BT_VCS_CLIENT)
struct bt_vcs_client {
struct vcs_state state;
uint8_t flags;
uint16_t start_handle;
uint16_t end_handle;
uint16_t state_handle;
uint16_t control_handle;
uint16_t flag_handle;
struct bt_gatt_subscribe_params state_sub_params;
struct bt_gatt_discover_params state_sub_disc_params;
struct bt_gatt_subscribe_params flag_sub_params;
struct bt_gatt_discover_params flag_sub_disc_params;
bool cp_retried;
bool busy;
struct vcs_control_vol cp_val;
struct bt_gatt_write_params write_params;
struct bt_gatt_read_params read_params;
struct bt_gatt_discover_params discover_params;
struct bt_uuid_16 uuid;
struct bt_conn *conn;
uint8_t vocs_inst_cnt;
struct bt_vocs *vocs[CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST];
uint8_t aics_inst_cnt;
struct bt_aics *aics[CONFIG_BT_VCS_CLIENT_MAX_AICS_INST];
};
#endif /* CONFIG_BT_VCS_CLIENT */
#if defined(CONFIG_BT_VCS)
struct bt_vcs_server {
struct vcs_state state;
uint8_t flags;
struct bt_vcs_cb *cb;
uint8_t volume_step;
struct bt_gatt_service *service_p;
struct bt_vocs *vocs_insts[CONFIG_BT_VCS_VOCS_INSTANCE_COUNT];
struct bt_aics *aics_insts[CONFIG_BT_VCS_AICS_INSTANCE_COUNT];
};
#endif /* CONFIG_BT_VCS */
/* Struct used as a common type for the api */
struct bt_vcs {
bool client_instance;
union {
#if defined(CONFIG_BT_VCS)
struct bt_vcs_server srv;
#endif /* CONFIG_BT_VCS */
#if defined(CONFIG_BT_VCS_CLIENT)
struct bt_vcs_client cli;
#endif /* CONFIG_BT_VCS_CLIENT */
};
};
int bt_vcs_client_included_get(struct bt_vcs *vcs,
struct bt_vcs_included *included);
int bt_vcs_client_read_vol_state(struct bt_vcs *vcs);
int bt_vcs_client_read_flags(struct bt_vcs *vcs);
int bt_vcs_client_vol_down(struct bt_vcs *vcs);
int bt_vcs_client_vol_up(struct bt_vcs *vcs);
int bt_vcs_client_unmute_vol_down(struct bt_vcs *vcs);
int bt_vcs_client_unmute_vol_up(struct bt_vcs *vcs);
int bt_vcs_client_set_volume(struct bt_vcs *vcs, uint8_t volume);
int bt_vcs_client_unmute(struct bt_vcs *vcs);
int bt_vcs_client_mute(struct bt_vcs *vcs);
bool bt_vcs_client_valid_vocs_inst(struct bt_vcs *vcs, struct bt_vocs *vocs);
bool bt_vcs_client_valid_aics_inst(struct bt_vcs *vcs, struct bt_aics *aics);
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_VCP_INTERNAL_*/

View file

@ -1,7 +1,7 @@
/* Bluetooth VOCS - Volume Offset Control Service - Client */
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
* Copyright (c) 2021-2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -244,7 +244,7 @@ static uint8_t internal_read_volume_offset_state_cb(struct bt_conn *conn, uint8_
return BT_GATT_ITER_STOP;
}
static void vcs_client_write_vocs_cp_cb(struct bt_conn *conn, uint8_t err,
static void vocs_client_write_vocs_cp_cb(struct bt_conn *conn, uint8_t err,
struct bt_gatt_write_params *params)
{
int cb_err = err;
@ -291,7 +291,7 @@ static void vcs_client_write_vocs_cp_cb(struct bt_conn *conn, uint8_t err,
}
}
static uint8_t vcs_client_read_output_desc_cb(struct bt_conn *conn, uint8_t err,
static uint8_t vocs_client_read_output_desc_cb(struct bt_conn *conn, uint8_t err,
struct bt_gatt_read_params *params,
const void *data, uint16_t length)
{
@ -554,7 +554,7 @@ int bt_vocs_client_state_set(struct bt_vocs *inst, int16_t offset)
inst->cli.write_params.data = &inst->cli.cp;
inst->cli.write_params.length = sizeof(inst->cli.cp);
inst->cli.write_params.handle = inst->cli.control_handle;
inst->cli.write_params.func = vcs_client_write_vocs_cp_cb;
inst->cli.write_params.func = vocs_client_write_vocs_cp_cb;
err = bt_gatt_write(inst->cli.conn, &inst->cli.write_params);
if (!err) {
@ -585,7 +585,7 @@ int bt_vocs_client_description_get(struct bt_vocs *inst)
return -EBUSY;
}
inst->cli.read_params.func = vcs_client_read_output_desc_cb;
inst->cli.read_params.func = vocs_client_read_output_desc_cb;
inst->cli.read_params.handle_count = 1;
inst->cli.read_params.single.handle = inst->cli.desc_handle;
inst->cli.read_params.single.offset = 0U;

View file

@ -26,12 +26,12 @@ zephyr_library_sources_ifdef(
iso.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_VCS
vcs.c
CONFIG_BT_VCP
vcp.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_VCS_CLIENT
vcs_client.c
CONFIG_BT_VCP_CLIENT
vcp_client.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_MICP_MIC_DEV

View file

@ -2005,7 +2005,7 @@ ssize_t audio_ad_data_add(struct bt_data *data_array, const size_t data_array_si
IF_ENABLED(CONFIG_BT_PACS, (BT_UUID_16_ENCODE(BT_UUID_PACS_VAL),))
IF_ENABLED(CONFIG_BT_GTBS, (BT_UUID_16_ENCODE(BT_UUID_GTBS_VAL),))
IF_ENABLED(CONFIG_BT_TBS, (BT_UUID_16_ENCODE(BT_UUID_TBS_VAL),))
IF_ENABLED(CONFIG_BT_VCS, (BT_UUID_16_ENCODE(BT_UUID_VCS_VAL),))
IF_ENABLED(CONFIG_BT_VCP, (BT_UUID_16_ENCODE(BT_UUID_VCS_VAL),))
IF_ENABLED(CONFIG_BT_HAS, (BT_UUID_16_ENCODE(BT_UUID_HAS_VAL),))
};
size_t ad_len = 0;

View file

@ -1,5 +1,5 @@
/** @file
* @brief Bluetooth VCS server shell.
* @brief Bluetooth VCP server shell.
*
* Copyright (c) 2020 Bose Corporation
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
@ -17,25 +17,25 @@
#include "bt.h"
static struct bt_vcs *vcs;
static struct bt_vcs_included vcs_included;
static struct bt_vcp *vcp;
static struct bt_vcp_included vcp_included;
static void vcs_state_cb(struct bt_vcs *vcs, int err, uint8_t volume,
static void vcs_state_cb(struct bt_vcp *vcp, int err, uint8_t volume,
uint8_t mute)
{
if (err) {
shell_error(ctx_shell, "VCS state get failed (%d)", err);
shell_error(ctx_shell, "VCP state get failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS volume %u, mute %u", volume, mute);
shell_print(ctx_shell, "VCP volume %u, mute %u", volume, mute);
}
}
static void vcs_flags_cb(struct bt_vcs *vcs, int err, uint8_t flags)
static void vcs_flags_cb(struct bt_vcp *vcp, int err, uint8_t flags)
{
if (err) {
shell_error(ctx_shell, "VCS flags get failed (%d)", err);
shell_error(ctx_shell, "VCP flags get failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS flags 0x%02X", flags);
shell_print(ctx_shell, "VCP flags 0x%02X", flags);
}
}
@ -139,7 +139,7 @@ static void vocs_description_cb(struct bt_vocs *inst, int err,
}
}
static struct bt_vcs_cb vcs_cbs = {
static struct bt_vcp_cb vcs_cbs = {
.state = vcs_state_cb,
.flags = vcs_flags_cb,
};
@ -161,9 +161,9 @@ static struct bt_vocs_cb vocs_cbs = {
static int cmd_vcs_init(const struct shell *sh, size_t argc, char **argv)
{
int result = 0;
struct bt_vcs_register_param vcs_param;
char input_desc[CONFIG_BT_VCS_AICS_INSTANCE_COUNT][16];
char output_desc[CONFIG_BT_VCS_VOCS_INSTANCE_COUNT][16];
struct bt_vcp_register_param vcs_param;
char input_desc[CONFIG_BT_VCP_AICS_INSTANCE_COUNT][16];
char output_desc[CONFIG_BT_VCP_VOCS_INSTANCE_COUNT][16];
static const char assignment_operator[] = "=";
if (!ctx_shell) {
@ -197,7 +197,7 @@ static int cmd_vcs_init(const struct shell *sh, size_t argc, char **argv)
/* Default values */
vcs_param.step = 1;
vcs_param.mute = BT_VCS_STATE_UNMUTED;
vcs_param.mute = BT_VCP_STATE_UNMUTED;
vcs_param.volume = 100;
for (int i = 1; i < argc; i++) {
@ -228,13 +228,13 @@ static int cmd_vcs_init(const struct shell *sh, size_t argc, char **argv)
vcs_param.cb = &vcs_cbs;
result = bt_vcs_register(&vcs_param, &vcs);
result = bt_vcp_register(&vcs_param, &vcp);
if (result) {
shell_print(sh, "Fail: %d", result);
return result;
}
result = bt_vcs_included_get(vcs, &vcs_included);
result = bt_vcp_included_get(vcp, &vcp_included);
if (result != 0) {
shell_error(sh, "Failed to get included services: %d", result);
return result;
@ -255,7 +255,7 @@ static int cmd_vcs_volume_step(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_vol_step_set(step);
result = bt_vcp_vol_step_set(step);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -266,7 +266,7 @@ static int cmd_vcs_volume_step(const struct shell *sh, size_t argc,
static int cmd_vcs_state_get(const struct shell *sh, size_t argc,
char **argv)
{
int result = bt_vcs_vol_get(vcs);
int result = bt_vcp_vol_get(vcp);
if (result) {
shell_print(sh, "Fail: %d", result);
@ -278,7 +278,7 @@ static int cmd_vcs_state_get(const struct shell *sh, size_t argc,
static int cmd_vcs_flags_get(const struct shell *sh, size_t argc,
char **argv)
{
int result = bt_vcs_flags_get(vcs);
int result = bt_vcp_flags_get(vcp);
if (result) {
shell_print(sh, "Fail: %d", result);
@ -290,7 +290,7 @@ static int cmd_vcs_flags_get(const struct shell *sh, size_t argc,
static int cmd_vcs_volume_down(const struct shell *sh, size_t argc,
char **argv)
{
int result = bt_vcs_vol_down(vcs);
int result = bt_vcp_vol_down(vcp);
if (result) {
shell_print(sh, "Fail: %d", result);
@ -303,7 +303,7 @@ static int cmd_vcs_volume_up(const struct shell *sh, size_t argc,
char **argv)
{
int result = bt_vcs_vol_up(vcs);
int result = bt_vcp_vol_up(vcp);
if (result) {
shell_print(sh, "Fail: %d", result);
@ -315,7 +315,7 @@ static int cmd_vcs_volume_up(const struct shell *sh, size_t argc,
static int cmd_vcs_unmute_volume_down(const struct shell *sh, size_t argc,
char **argv)
{
int result = bt_vcs_unmute_vol_down(vcs);
int result = bt_vcp_unmute_vol_down(vcp);
if (result) {
shell_print(sh, "Fail: %d", result);
@ -327,7 +327,7 @@ static int cmd_vcs_unmute_volume_down(const struct shell *sh, size_t argc,
static int cmd_vcs_unmute_volume_up(const struct shell *sh, size_t argc,
char **argv)
{
int result = bt_vcs_unmute_vol_up(vcs);
int result = bt_vcp_unmute_vol_up(vcp);
if (result) {
shell_print(sh, "Fail: %d", result);
@ -348,7 +348,7 @@ static int cmd_vcs_volume_set(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_vol_set(vcs, volume);
result = bt_vcp_vol_set(vcp, volume);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -358,7 +358,7 @@ static int cmd_vcs_volume_set(const struct shell *sh, size_t argc,
static int cmd_vcs_unmute(const struct shell *sh, size_t argc, char **argv)
{
int result = bt_vcs_unmute(vcs);
int result = bt_vcp_unmute(vcp);
if (result) {
shell_print(sh, "Fail: %d", result);
@ -369,7 +369,7 @@ static int cmd_vcs_unmute(const struct shell *sh, size_t argc, char **argv)
static int cmd_vcs_mute(const struct shell *sh, size_t argc, char **argv)
{
int result = bt_vcs_mute(vcs);
int result = bt_vcp_mute(vcp);
if (result) {
shell_print(sh, "Fail: %d", result);
@ -386,13 +386,13 @@ static int cmd_vcs_vocs_state_get(const struct shell *sh, size_t argc,
/* TODO: For here, and the following VOCS and AICS, default index to 0 */
if (index > CONFIG_BT_VCS_VOCS_INSTANCE_COUNT) {
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
shell_error(sh, "Index out of range; 0-%u, was %u",
CONFIG_BT_VCS_VOCS_INSTANCE_COUNT, index);
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
return -ENOEXEC;
}
result = bt_vcs_vocs_state_get(NULL, vcs_included.vocs[index]);
result = bt_vcp_vocs_state_get(NULL, vcp_included.vocs[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -406,13 +406,13 @@ static int cmd_vcs_vocs_location_get(const struct shell *sh, size_t argc,
int result;
int index = strtol(argv[1], NULL, 0);
if (index > CONFIG_BT_VCS_VOCS_INSTANCE_COUNT) {
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
shell_error(sh, "Index out of range; 0-%u, was %u",
CONFIG_BT_VCS_VOCS_INSTANCE_COUNT, index);
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
return -ENOEXEC;
}
result = bt_vcs_vocs_location_get(NULL, vcs_included.vocs[index]);
result = bt_vcp_vocs_location_get(NULL, vcp_included.vocs[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -427,9 +427,9 @@ static int cmd_vcs_vocs_location_set(const struct shell *sh, size_t argc,
int index = strtol(argv[1], NULL, 0);
int location = strtol(argv[2], NULL, 0);
if (index > CONFIG_BT_VCS_VOCS_INSTANCE_COUNT) {
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
shell_error(sh, "Index out of range; 0-%u, was %u",
CONFIG_BT_VCS_VOCS_INSTANCE_COUNT, index);
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
return -ENOEXEC;
}
if (location > UINT16_MAX || location < 0) {
@ -439,7 +439,7 @@ static int cmd_vcs_vocs_location_set(const struct shell *sh, size_t argc,
}
result = bt_vcs_vocs_location_set(NULL, vcs_included.vocs[index],
result = bt_vcp_vocs_location_set(NULL, vcp_included.vocs[index],
location);
if (result) {
shell_print(sh, "Fail: %d", result);
@ -455,9 +455,9 @@ static int cmd_vcs_vocs_offset_set(const struct shell *sh, size_t argc,
int index = strtol(argv[1], NULL, 0);
int offset = strtol(argv[2], NULL, 0);
if (index > CONFIG_BT_VCS_VOCS_INSTANCE_COUNT) {
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
shell_error(sh, "Index out of range; 0-%u, was %u",
CONFIG_BT_VCS_VOCS_INSTANCE_COUNT, index);
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
return -ENOEXEC;
}
@ -467,7 +467,7 @@ static int cmd_vcs_vocs_offset_set(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_vocs_state_set(NULL, vcs_included.vocs[index], offset);
result = bt_vcp_vocs_state_set(NULL, vcp_included.vocs[index], offset);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -481,13 +481,13 @@ static int cmd_vcs_vocs_output_description_get(const struct shell *sh,
int result;
int index = strtol(argv[1], NULL, 0);
if (index > CONFIG_BT_VCS_VOCS_INSTANCE_COUNT) {
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
shell_error(sh, "Index out of range; 0-%u, was %u",
CONFIG_BT_VCS_VOCS_INSTANCE_COUNT, index);
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
return -ENOEXEC;
}
result = bt_vcs_vocs_description_get(NULL, vcs_included.vocs[index]);
result = bt_vcp_vocs_description_get(NULL, vcp_included.vocs[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -502,13 +502,13 @@ static int cmd_vcs_vocs_output_description_set(const struct shell *sh,
int index = strtol(argv[1], NULL, 0);
char *description = argv[2];
if (index > CONFIG_BT_VCS_VOCS_INSTANCE_COUNT) {
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
shell_error(sh, "Index out of range; 0-%u, was %u",
CONFIG_BT_VCS_VOCS_INSTANCE_COUNT, index);
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
return -ENOEXEC;
}
result = bt_vcs_vocs_description_set(NULL, vcs_included.vocs[index],
result = bt_vcp_vocs_description_set(NULL, vcp_included.vocs[index],
description);
if (result) {
shell_print(sh, "Fail: %d", result);
@ -523,13 +523,13 @@ static int cmd_vcs_aics_input_state_get(const struct shell *sh, size_t argc,
int result;
int index = strtol(argv[1], NULL, 0);
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_state_get(NULL, vcs_included.aics[index]);
result = bt_vcp_aics_state_get(NULL, vcp_included.aics[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -543,13 +543,13 @@ static int cmd_vcs_aics_gain_setting_get(const struct shell *sh, size_t argc,
int result;
int index = strtol(argv[1], NULL, 0);
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_gain_setting_get(NULL, vcs_included.aics[index]);
result = bt_vcp_aics_gain_setting_get(NULL, vcp_included.aics[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -563,13 +563,13 @@ static int cmd_vcs_aics_input_type_get(const struct shell *sh, size_t argc,
int result;
int index = strtol(argv[1], NULL, 0);
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_type_get(NULL, vcs_included.aics[index]);
result = bt_vcp_aics_type_get(NULL, vcp_included.aics[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -583,13 +583,13 @@ static int cmd_vcs_aics_input_status_get(const struct shell *sh, size_t argc,
int result;
int index = strtol(argv[1], NULL, 0);
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_status_get(NULL, vcs_included.aics[index]);
result = bt_vcp_aics_status_get(NULL, vcp_included.aics[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -603,13 +603,13 @@ static int cmd_vcs_aics_input_unmute(const struct shell *sh, size_t argc,
int result;
int index = strtol(argv[1], NULL, 0);
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_unmute(NULL, vcs_included.aics[index]);
result = bt_vcp_aics_unmute(NULL, vcp_included.aics[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -623,13 +623,13 @@ static int cmd_vcs_aics_input_mute(const struct shell *sh, size_t argc,
int result;
int index = strtol(argv[1], NULL, 0);
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_mute(NULL, vcs_included.aics[index]);
result = bt_vcp_aics_mute(NULL, vcp_included.aics[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -643,13 +643,13 @@ static int cmd_vcs_aics_manual_input_gain_set(const struct shell *sh,
int result;
int index = strtol(argv[1], NULL, 0);
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_manual_gain_set(NULL, vcs_included.aics[index]);
result = bt_vcp_aics_manual_gain_set(NULL, vcp_included.aics[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -663,13 +663,13 @@ static int cmd_vcs_aics_automatic_input_gain_set(const struct shell *sh,
int result;
int index = strtol(argv[1], NULL, 0);
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_automatic_gain_set(NULL, vcs_included.aics[index]);
result = bt_vcp_aics_automatic_gain_set(NULL, vcp_included.aics[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -684,9 +684,9 @@ static int cmd_vcs_aics_gain_set(const struct shell *sh, size_t argc,
int index = strtol(argv[1], NULL, 0);
int gain = strtol(argv[2], NULL, 0);
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
@ -696,7 +696,7 @@ static int cmd_vcs_aics_gain_set(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_aics_gain_set(NULL, vcs_included.aics[index], gain);
result = bt_vcp_aics_gain_set(NULL, vcp_included.aics[index], gain);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -710,13 +710,13 @@ static int cmd_vcs_aics_input_description_get(const struct shell *sh,
int result;
int index = strtol(argv[1], NULL, 0);
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_description_get(NULL, vcs_included.aics[index]);
result = bt_vcp_aics_description_get(NULL, vcp_included.aics[index]);
if (result) {
shell_print(sh, "Fail: %d", result);
}
@ -731,13 +731,13 @@ static int cmd_vcs_aics_input_description_set(const struct shell *sh,
int index = strtol(argv[1], NULL, 0);
char *description = argv[2];
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_description_set(NULL, vcs_included.aics[index],
result = bt_vcp_aics_description_set(NULL, vcp_included.aics[index],
description);
if (result) {
shell_print(sh, "Fail: %d", result);
@ -764,7 +764,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(vcs_cmds,
"[step=<uint>] [mute=<bool>] [volume=<uint>]",
cmd_vcs_init, 1, 3),
SHELL_CMD_ARG(state_get, NULL,
"Get volume state of the VCS server. Should be done "
"Get volume state of the VCP server. Should be done "
"before sending any control messages",
cmd_vcs_state_get, 1, 0),
SHELL_CMD_ARG(flags_get, NULL,
@ -857,5 +857,5 @@ SHELL_STATIC_SUBCMD_SET_CREATE(vcs_cmds,
SHELL_SUBCMD_SET_END
);
SHELL_CMD_ARG_REGISTER(vcs, &vcs_cmds, "Bluetooth VCS shell commands",
SHELL_CMD_ARG_REGISTER(vcp, &vcs_cmds, "Bluetooth VCP shell commands",
cmd_vcs, 1, 1);

View file

@ -1,5 +1,5 @@
/** @file
* @brief Bluetooth VCS client shell.
* @brief Bluetooth VCP client shell.
*
* Copyright (c) 2020 Bose Corporation
* Copyright (c) 2020-2022 Nordic Semiconductor ASA
@ -15,107 +15,107 @@
#include "bt.h"
static struct bt_vcs *vcs;
static struct bt_vcs_included vcs_included;
static struct bt_vcp *vcp;
static struct bt_vcp_included vcp_included;
static void vcs_discover_cb(struct bt_vcs *vcs, int err, uint8_t vocs_count,
static void vcs_discover_cb(struct bt_vcp *vcp, int err, uint8_t vocs_count,
uint8_t aics_count)
{
if (err != 0) {
shell_error(ctx_shell, "VCS discover failed (%d)", err);
shell_error(ctx_shell, "VCP discover failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS discover done with %u AICS",
shell_print(ctx_shell, "VCP discover done with %u AICS",
aics_count);
if (bt_vcs_included_get(vcs, &vcs_included)) {
shell_error(ctx_shell, "Could not get VCS context");
if (bt_vcp_included_get(vcp, &vcp_included)) {
shell_error(ctx_shell, "Could not get VCP context");
}
}
}
static void vcs_vol_down_cb(struct bt_vcs *vcs, int err)
static void vcs_vol_down_cb(struct bt_vcp *vcp, int err)
{
if (err != 0) {
shell_error(ctx_shell, "VCS vol_down failed (%d)", err);
shell_error(ctx_shell, "VCP vol_down failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS vol_down done");
shell_print(ctx_shell, "VCP vol_down done");
}
}
static void vcs_vol_up_cb(struct bt_vcs *vcs, int err)
static void vcs_vol_up_cb(struct bt_vcp *vcp, int err)
{
if (err != 0) {
shell_error(ctx_shell, "VCS vol_up failed (%d)", err);
shell_error(ctx_shell, "VCP vol_up failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS vol_up done");
shell_print(ctx_shell, "VCP vol_up done");
}
}
static void vcs_mute_cb(struct bt_vcs *vcs, int err)
static void vcs_mute_cb(struct bt_vcp *vcp, int err)
{
if (err != 0) {
shell_error(ctx_shell, "VCS mute failed (%d)", err);
shell_error(ctx_shell, "VCP mute failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS mute done");
shell_print(ctx_shell, "VCP mute done");
}
}
static void vcs_unmute_cb(struct bt_vcs *vcs, int err)
static void vcs_unmute_cb(struct bt_vcp *vcp, int err)
{
if (err != 0) {
shell_error(ctx_shell, "VCS unmute failed (%d)", err);
shell_error(ctx_shell, "VCP unmute failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS unmute done");
shell_print(ctx_shell, "VCP unmute done");
}
}
static void vcs_vol_down_unmute_cb(struct bt_vcs *vcs, int err)
static void vcs_vol_down_unmute_cb(struct bt_vcp *vcp, int err)
{
if (err != 0) {
shell_error(ctx_shell, "VCS vol_down_unmute failed (%d)", err);
shell_error(ctx_shell, "VCP vol_down_unmute failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS vol_down_unmute done");
shell_print(ctx_shell, "VCP vol_down_unmute done");
}
}
static void vcs_vol_up_unmute_cb(struct bt_vcs *vcs, int err)
static void vcs_vol_up_unmute_cb(struct bt_vcp *vcp, int err)
{
if (err != 0) {
shell_error(ctx_shell, "VCS vol_up_unmute failed (%d)", err);
shell_error(ctx_shell, "VCP vol_up_unmute failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS vol_up_unmute done");
shell_print(ctx_shell, "VCP vol_up_unmute done");
}
}
static void vcs_vol_set_cb(struct bt_vcs *vcs, int err)
static void vcs_vol_set_cb(struct bt_vcp *vcp, int err)
{
if (err != 0) {
shell_error(ctx_shell, "VCS vol_set failed (%d)", err);
shell_error(ctx_shell, "VCP vol_set failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS vol_set done");
shell_print(ctx_shell, "VCP vol_set done");
}
}
static void vcs_state_cb(struct bt_vcs *vcs, int err, uint8_t volume,
static void vcs_state_cb(struct bt_vcp *vcp, int err, uint8_t volume,
uint8_t mute)
{
if (err != 0) {
shell_error(ctx_shell, "VCS state get failed (%d)", err);
shell_error(ctx_shell, "VCP state get failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS volume %u, mute %u", volume, mute);
shell_print(ctx_shell, "VCP volume %u, mute %u", volume, mute);
}
}
static void vcs_flags_cb(struct bt_vcs *vcs, int err, uint8_t flags)
static void vcs_flags_cb(struct bt_vcp *vcp, int err, uint8_t flags)
{
if (err != 0) {
shell_error(ctx_shell, "VCS flags get failed (%d)", err);
shell_error(ctx_shell, "VCP flags get failed (%d)", err);
} else {
shell_print(ctx_shell, "VCS flags 0x%02X", flags);
shell_print(ctx_shell, "VCP flags 0x%02X", flags);
}
}
#if CONFIG_BT_VCS_CLIENT_MAX_AICS_INST > 0
#if CONFIG_BT_VCP_CLIENT_MAX_AICS_INST > 0
static void vcs_aics_set_gain_cb(struct bt_aics *inst, int err)
{
if (err != 0) {
@ -234,9 +234,9 @@ static void vcs_aics_description_cb(struct bt_aics *inst, int err,
inst, description);
}
}
#endif /* CONFIG_BT_VCS_CLIENT_MAX_AICS_INST > 0 */
#endif /* CONFIG_BT_VCP_CLIENT_MAX_AICS_INST > 0 */
#if CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST > 0
#if CONFIG_BT_VCP_CLIENT_MAX_VOCS_INST > 0
static void vcs_vocs_set_offset_cb(struct bt_vocs *inst, int err)
{
if (err != 0) {
@ -282,9 +282,9 @@ static void vcs_vocs_description_cb(struct bt_vocs *inst, int err,
inst, description);
}
}
#endif /* CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST > 0 */
#endif /* CONFIG_BT_VCP_CLIENT_MAX_VOCS_INST > 0 */
static struct bt_vcs_cb vcs_cbs = {
static struct bt_vcp_cb vcs_cbs = {
.discover = vcs_discover_cb,
.vol_down = vcs_vol_down_cb,
.vol_up = vcs_vol_up_cb,
@ -298,7 +298,7 @@ static struct bt_vcs_cb vcs_cbs = {
.flags = vcs_flags_cb,
/* Audio Input Control Service */
#if CONFIG_BT_VCS_CLIENT_MAX_AICS_INST > 0
#if CONFIG_BT_VCP_CLIENT_MAX_AICS_INST > 0
.aics_cb = {
.state = vcs_aics_state_cb,
.gain_setting = vcs_aics_gain_setting_cb,
@ -311,18 +311,18 @@ static struct bt_vcs_cb vcs_cbs = {
.set_manual_mode = vcs_aics_set_manual_mode_cb,
.set_auto_mode = vcs_aics_automatic_mode_cb,
},
#endif /* CONFIG_BT_VCS_CLIENT_MAX_AICS_INST > 0 */
#if CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST > 0
#endif /* CONFIG_BT_VCP_CLIENT_MAX_AICS_INST > 0 */
#if CONFIG_BT_VCP_CLIENT_MAX_VOCS_INST > 0
.vocs_cb = {
.state = vcs_vocs_state_cb,
.location = vcs_vocs_location_cb,
.description = vcs_vocs_description_cb,
.set_offset = vcs_vocs_set_offset_cb,
}
#endif /* CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST > 0 */
#endif /* CONFIG_BT_VCP_CLIENT_MAX_VOCS_INST > 0 */
};
static int cmd_vcs_client_discover(const struct shell *sh, size_t argc,
static int cmd_vcp_client_discover(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@ -331,7 +331,7 @@ static int cmd_vcs_client_discover(const struct shell *sh, size_t argc,
ctx_shell = sh;
}
result = bt_vcs_client_cb_register(&vcs_cbs);
result = bt_vcp_client_cb_register(&vcs_cbs);
if (result != 0) {
shell_print(sh, "CB register failed: %d", result);
return result;
@ -342,7 +342,7 @@ static int cmd_vcs_client_discover(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_discover(default_conn, &vcs);
result = bt_vcp_discover(default_conn, &vcp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -350,7 +350,7 @@ static int cmd_vcs_client_discover(const struct shell *sh, size_t argc,
return result;
}
static int cmd_vcs_client_state_get(const struct shell *sh, size_t argc,
static int cmd_vcp_client_state_get(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@ -360,7 +360,7 @@ static int cmd_vcs_client_state_get(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_vol_get(vcs);
result = bt_vcp_vol_get(vcp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -368,7 +368,7 @@ static int cmd_vcs_client_state_get(const struct shell *sh, size_t argc,
return result;
}
static int cmd_vcs_client_flags_get(const struct shell *sh, size_t argc,
static int cmd_vcp_client_flags_get(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@ -378,7 +378,7 @@ static int cmd_vcs_client_flags_get(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_flags_get(vcs);
result = bt_vcp_flags_get(vcp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -386,7 +386,7 @@ static int cmd_vcs_client_flags_get(const struct shell *sh, size_t argc,
return result;
}
static int cmd_vcs_client_volume_down(const struct shell *sh, size_t argc,
static int cmd_vcp_client_volume_down(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@ -396,7 +396,7 @@ static int cmd_vcs_client_volume_down(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_vol_down(vcs);
result = bt_vcp_vol_down(vcp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -404,7 +404,7 @@ static int cmd_vcs_client_volume_down(const struct shell *sh, size_t argc,
return result;
}
static int cmd_vcs_client_volume_up(const struct shell *sh, size_t argc,
static int cmd_vcp_client_volume_up(const struct shell *sh, size_t argc,
char **argv)
{
@ -415,7 +415,7 @@ static int cmd_vcs_client_volume_up(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_vol_up(vcs);
result = bt_vcp_vol_up(vcp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -423,7 +423,7 @@ static int cmd_vcs_client_volume_up(const struct shell *sh, size_t argc,
return result;
}
static int cmd_vcs_client_unmute_volume_down(const struct shell *sh,
static int cmd_vcp_client_unmute_volume_down(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -433,7 +433,7 @@ static int cmd_vcs_client_unmute_volume_down(const struct shell *sh,
return -ENOEXEC;
}
result = bt_vcs_unmute_vol_down(vcs);
result = bt_vcp_unmute_vol_down(vcp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -441,7 +441,7 @@ static int cmd_vcs_client_unmute_volume_down(const struct shell *sh,
return result;
}
static int cmd_vcs_client_unmute_volume_up(const struct shell *sh,
static int cmd_vcp_client_unmute_volume_up(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -451,7 +451,7 @@ static int cmd_vcs_client_unmute_volume_up(const struct shell *sh,
return -ENOEXEC;
}
result = bt_vcs_unmute_vol_up(vcs);
result = bt_vcp_unmute_vol_up(vcp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -459,7 +459,7 @@ static int cmd_vcs_client_unmute_volume_up(const struct shell *sh,
return result;
}
static int cmd_vcs_client_volume_set(const struct shell *sh, size_t argc,
static int cmd_vcp_client_volume_set(const struct shell *sh, size_t argc,
char **argv)
{
@ -476,7 +476,7 @@ static int cmd_vcs_client_volume_set(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_vol_set(vcs, volume);
result = bt_vcp_vol_set(vcp, volume);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -485,7 +485,7 @@ static int cmd_vcs_client_volume_set(const struct shell *sh, size_t argc,
}
static int cmd_vcs_client_unmute(const struct shell *sh, size_t argc,
static int cmd_vcp_client_unmute(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@ -495,7 +495,7 @@ static int cmd_vcs_client_unmute(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_unmute(vcs);
result = bt_vcp_unmute(vcp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -503,7 +503,7 @@ static int cmd_vcs_client_unmute(const struct shell *sh, size_t argc,
return result;
}
static int cmd_vcs_client_mute(const struct shell *sh, size_t argc, char **argv)
static int cmd_vcp_client_mute(const struct shell *sh, size_t argc, char **argv)
{
int result;
@ -512,7 +512,7 @@ static int cmd_vcs_client_mute(const struct shell *sh, size_t argc, char **argv)
return -ENOEXEC;
}
result = bt_vcs_mute(vcs);
result = bt_vcp_mute(vcp);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -520,7 +520,7 @@ static int cmd_vcs_client_mute(const struct shell *sh, size_t argc, char **argv)
return result;
}
static int cmd_vcs_client_vocs_state_get(const struct shell *sh, size_t argc,
static int cmd_vcp_client_vocs_state_get(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@ -531,13 +531,13 @@ static int cmd_vcs_client_vocs_state_get(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
if (index >= vcs_included.vocs_cnt) {
if (index >= vcp_included.vocs_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.vocs_cnt, index);
vcp_included.vocs_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_vocs_state_get(vcs, vcs_included.vocs[index]);
result = bt_vcp_vocs_state_get(vcp, vcp_included.vocs[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -545,7 +545,7 @@ static int cmd_vcs_client_vocs_state_get(const struct shell *sh, size_t argc,
return result;
}
static int cmd_vcs_client_vocs_location_get(const struct shell *sh,
static int cmd_vcp_client_vocs_location_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -556,13 +556,13 @@ static int cmd_vcs_client_vocs_location_get(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.vocs_cnt) {
if (index >= vcp_included.vocs_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.vocs_cnt, index);
vcp_included.vocs_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_vocs_location_get(vcs, vcs_included.vocs[index]);
result = bt_vcp_vocs_location_get(vcp, vcp_included.vocs[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -570,7 +570,7 @@ static int cmd_vcs_client_vocs_location_get(const struct shell *sh,
return result;
}
static int cmd_vcs_client_vocs_location_set(const struct shell *sh,
static int cmd_vcp_client_vocs_location_set(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -582,9 +582,9 @@ static int cmd_vcs_client_vocs_location_set(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.vocs_cnt) {
if (index >= vcp_included.vocs_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.vocs_cnt, index);
vcp_included.vocs_cnt, index);
return -ENOEXEC;
}
@ -595,7 +595,7 @@ static int cmd_vcs_client_vocs_location_set(const struct shell *sh,
}
result = bt_vcs_vocs_location_set(vcs, vcs_included.vocs[index],
result = bt_vcp_vocs_location_set(vcp, vcp_included.vocs[index],
location);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
@ -604,7 +604,7 @@ static int cmd_vcs_client_vocs_location_set(const struct shell *sh,
return result;
}
static int cmd_vcs_client_vocs_offset_set(const struct shell *sh,
static int cmd_vcp_client_vocs_offset_set(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -616,9 +616,9 @@ static int cmd_vcs_client_vocs_offset_set(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.vocs_cnt) {
if (index >= vcp_included.vocs_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.vocs_cnt, index);
vcp_included.vocs_cnt, index);
return -ENOEXEC;
}
@ -628,7 +628,7 @@ static int cmd_vcs_client_vocs_offset_set(const struct shell *sh,
return -ENOEXEC;
}
result = bt_vcs_vocs_state_set(vcs, vcs_included.vocs[index],
result = bt_vcp_vocs_state_set(vcp, vcp_included.vocs[index],
offset);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
@ -637,7 +637,7 @@ static int cmd_vcs_client_vocs_offset_set(const struct shell *sh,
return result;
}
static int cmd_vcs_client_vocs_output_description_get(const struct shell *sh,
static int cmd_vcp_client_vocs_output_description_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -648,13 +648,13 @@ static int cmd_vcs_client_vocs_output_description_get(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.vocs_cnt) {
if (index >= vcp_included.vocs_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.vocs_cnt, index);
vcp_included.vocs_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_vocs_description_get(vcs, vcs_included.vocs[index]);
result = bt_vcp_vocs_description_get(vcp, vcp_included.vocs[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -662,7 +662,7 @@ static int cmd_vcs_client_vocs_output_description_get(const struct shell *sh,
return result;
}
static int cmd_vcs_client_vocs_output_description_set(const struct shell *sh,
static int cmd_vcp_client_vocs_output_description_set(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -674,13 +674,13 @@ static int cmd_vcs_client_vocs_output_description_set(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.vocs_cnt) {
if (index >= vcp_included.vocs_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.vocs_cnt, index);
vcp_included.vocs_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_vocs_description_set(vcs, vcs_included.vocs[index],
result = bt_vcp_vocs_description_set(vcp, vcp_included.vocs[index],
description);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
@ -689,7 +689,7 @@ static int cmd_vcs_client_vocs_output_description_set(const struct shell *sh,
return result;
}
static int cmd_vcs_client_aics_input_state_get(const struct shell *sh,
static int cmd_vcp_client_aics_input_state_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -700,13 +700,13 @@ static int cmd_vcs_client_aics_input_state_get(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_state_get(vcs, vcs_included.aics[index]);
result = bt_vcp_aics_state_get(vcp, vcp_included.aics[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -714,7 +714,7 @@ static int cmd_vcs_client_aics_input_state_get(const struct shell *sh,
return result;
}
static int cmd_vcs_client_aics_gain_setting_get(const struct shell *sh,
static int cmd_vcp_client_aics_gain_setting_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -725,13 +725,13 @@ static int cmd_vcs_client_aics_gain_setting_get(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_gain_setting_get(vcs, vcs_included.aics[index]);
result = bt_vcp_aics_gain_setting_get(vcp, vcp_included.aics[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -739,7 +739,7 @@ static int cmd_vcs_client_aics_gain_setting_get(const struct shell *sh,
return result;
}
static int cmd_vcs_client_aics_input_type_get(const struct shell *sh,
static int cmd_vcp_client_aics_input_type_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -750,13 +750,13 @@ static int cmd_vcs_client_aics_input_type_get(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_type_get(vcs, vcs_included.aics[index]);
result = bt_vcp_aics_type_get(vcp, vcp_included.aics[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -764,7 +764,7 @@ static int cmd_vcs_client_aics_input_type_get(const struct shell *sh,
return result;
}
static int cmd_vcs_client_aics_input_status_get(const struct shell *sh,
static int cmd_vcp_client_aics_input_status_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -775,13 +775,13 @@ static int cmd_vcs_client_aics_input_status_get(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_status_get(vcs, vcs_included.aics[index]);
result = bt_vcp_aics_status_get(vcp, vcp_included.aics[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -789,7 +789,7 @@ static int cmd_vcs_client_aics_input_status_get(const struct shell *sh,
return result;
}
static int cmd_vcs_client_aics_input_unmute(const struct shell *sh,
static int cmd_vcp_client_aics_input_unmute(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -800,13 +800,13 @@ static int cmd_vcs_client_aics_input_unmute(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_unmute(vcs, vcs_included.aics[index]);
result = bt_vcp_aics_unmute(vcp, vcp_included.aics[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -814,7 +814,7 @@ static int cmd_vcs_client_aics_input_unmute(const struct shell *sh,
return result;
}
static int cmd_vcs_client_aics_input_mute(const struct shell *sh,
static int cmd_vcp_client_aics_input_mute(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -825,13 +825,13 @@ static int cmd_vcs_client_aics_input_mute(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_mute(vcs, vcs_included.aics[index]);
result = bt_vcp_aics_mute(vcp, vcp_included.aics[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -839,7 +839,7 @@ static int cmd_vcs_client_aics_input_mute(const struct shell *sh,
return result;
}
static int cmd_vcs_client_aics_manual_input_gain_set(const struct shell *sh,
static int cmd_vcp_client_aics_manual_input_gain_set(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -850,13 +850,13 @@ static int cmd_vcs_client_aics_manual_input_gain_set(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_manual_gain_set(vcs, vcs_included.aics[index]);
result = bt_vcp_aics_manual_gain_set(vcp, vcp_included.aics[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -864,7 +864,7 @@ static int cmd_vcs_client_aics_manual_input_gain_set(const struct shell *sh,
return result;
}
static int cmd_vcs_client_aics_auto_input_gain_set(const struct shell *sh,
static int cmd_vcp_client_aics_auto_input_gain_set(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -875,13 +875,13 @@ static int cmd_vcs_client_aics_auto_input_gain_set(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_automatic_gain_set(vcs, vcs_included.aics[index]);
result = bt_vcp_aics_automatic_gain_set(vcp, vcp_included.aics[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -889,7 +889,7 @@ static int cmd_vcs_client_aics_auto_input_gain_set(const struct shell *sh,
return result;
}
static int cmd_vcs_client_aics_gain_set(const struct shell *sh, size_t argc,
static int cmd_vcp_client_aics_gain_set(const struct shell *sh, size_t argc,
char **argv)
{
int result;
@ -901,9 +901,9 @@ static int cmd_vcs_client_aics_gain_set(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
@ -913,7 +913,7 @@ static int cmd_vcs_client_aics_gain_set(const struct shell *sh, size_t argc,
return -ENOEXEC;
}
result = bt_vcs_aics_gain_set(vcs, vcs_included.aics[index], gain);
result = bt_vcp_aics_gain_set(vcp, vcp_included.aics[index], gain);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -921,7 +921,7 @@ static int cmd_vcs_client_aics_gain_set(const struct shell *sh, size_t argc,
return result;
}
static int cmd_vcs_client_aics_input_description_get(const struct shell *sh,
static int cmd_vcp_client_aics_input_description_get(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -932,13 +932,13 @@ static int cmd_vcs_client_aics_input_description_get(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_description_get(vcs, vcs_included.aics[index]);
result = bt_vcp_aics_description_get(vcp, vcp_included.aics[index]);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
}
@ -946,7 +946,7 @@ static int cmd_vcs_client_aics_input_description_get(const struct shell *sh,
return result;
}
static int cmd_vcs_client_aics_input_description_set(const struct shell *sh,
static int cmd_vcp_client_aics_input_description_set(const struct shell *sh,
size_t argc, char **argv)
{
int result;
@ -958,13 +958,13 @@ static int cmd_vcs_client_aics_input_description_set(const struct shell *sh,
return -ENOEXEC;
}
if (index >= vcs_included.aics_cnt) {
if (index >= vcp_included.aics_cnt) {
shell_error(sh, "Index shall be less than %u, was %u",
vcs_included.aics_cnt, index);
vcp_included.aics_cnt, index);
return -ENOEXEC;
}
result = bt_vcs_aics_description_set(vcs, vcs_included.aics[index],
result = bt_vcp_aics_description_set(vcp, vcp_included.aics[index],
description);
if (result != 0) {
shell_print(sh, "Fail: %d", result);
@ -973,7 +973,7 @@ static int cmd_vcs_client_aics_input_description_set(const struct shell *sh,
return result;
}
static int cmd_vcs_client(const struct shell *sh, size_t argc, char **argv)
static int cmd_vcp_client(const struct shell *sh, size_t argc, char **argv)
{
if (argc > 1) {
shell_error(sh, "%s unknown parameter: %s",
@ -985,101 +985,101 @@ static int cmd_vcs_client(const struct shell *sh, size_t argc, char **argv)
return -ENOEXEC;
}
SHELL_STATIC_SUBCMD_SET_CREATE(vcs_client_cmds,
SHELL_STATIC_SUBCMD_SET_CREATE(vcp_client_cmds,
SHELL_CMD_ARG(discover, NULL,
"Discover VCS and included services for current "
"Discover VCP and included services for current "
"connection",
cmd_vcs_client_discover, 1, 0),
cmd_vcp_client_discover, 1, 0),
SHELL_CMD_ARG(state_get, NULL,
"Get volume state of the VCS server. Should be done "
"Get volume state of the VCP server. Should be done "
"before sending any control messages",
cmd_vcs_client_state_get, 1, 0),
cmd_vcp_client_state_get, 1, 0),
SHELL_CMD_ARG(flags_get, NULL,
"Read volume flags",
cmd_vcs_client_flags_get, 1, 0),
cmd_vcp_client_flags_get, 1, 0),
SHELL_CMD_ARG(volume_down, NULL,
"Turn the volume down",
cmd_vcs_client_volume_down, 1, 0),
cmd_vcp_client_volume_down, 1, 0),
SHELL_CMD_ARG(volume_up, NULL,
"Turn the volume up",
cmd_vcs_client_volume_up, 1, 0),
cmd_vcp_client_volume_up, 1, 0),
SHELL_CMD_ARG(unmute_volume_down, NULL,
"Turn the volume down, and unmute",
cmd_vcs_client_unmute_volume_down, 1, 0),
cmd_vcp_client_unmute_volume_down, 1, 0),
SHELL_CMD_ARG(unmute_volume_up, NULL,
"Turn the volume up, and unmute",
cmd_vcs_client_unmute_volume_up, 1, 0),
cmd_vcp_client_unmute_volume_up, 1, 0),
SHELL_CMD_ARG(volume_set, NULL,
"Set an absolute volume <volume>",
cmd_vcs_client_volume_set, 2, 0),
cmd_vcp_client_volume_set, 2, 0),
SHELL_CMD_ARG(unmute, NULL,
"Unmute",
cmd_vcs_client_unmute, 1, 0),
cmd_vcp_client_unmute, 1, 0),
SHELL_CMD_ARG(mute, NULL,
"Mute",
cmd_vcs_client_mute, 1, 0),
cmd_vcp_client_mute, 1, 0),
SHELL_CMD_ARG(vocs_state_get, NULL,
"Get the offset state of a VOCS instance <inst_index>",
cmd_vcs_client_vocs_state_get, 2, 0),
cmd_vcp_client_vocs_state_get, 2, 0),
SHELL_CMD_ARG(vocs_location_get, NULL,
"Get the location of a VOCS instance <inst_index>",
cmd_vcs_client_vocs_location_get, 2, 0),
cmd_vcp_client_vocs_location_get, 2, 0),
SHELL_CMD_ARG(vocs_location_set, NULL,
"Set the location of a VOCS instance <inst_index> "
"<location>",
cmd_vcs_client_vocs_location_set, 3, 0),
cmd_vcp_client_vocs_location_set, 3, 0),
SHELL_CMD_ARG(vocs_offset_set, NULL,
"Set the offset for a VOCS instance <inst_index> "
"<offset>",
cmd_vcs_client_vocs_offset_set, 3, 0),
cmd_vcp_client_vocs_offset_set, 3, 0),
SHELL_CMD_ARG(vocs_output_description_get, NULL,
"Get the output description of a VOCS instance "
"<inst_index>",
cmd_vcs_client_vocs_output_description_get, 2, 0),
cmd_vcp_client_vocs_output_description_get, 2, 0),
SHELL_CMD_ARG(vocs_output_description_set, NULL,
"Set the output description of a VOCS instance "
"<inst_index> <description>",
cmd_vcs_client_vocs_output_description_set, 3, 0),
cmd_vcp_client_vocs_output_description_set, 3, 0),
SHELL_CMD_ARG(aics_input_state_get, NULL,
"Get the input state of a AICS instance <inst_index>",
cmd_vcs_client_aics_input_state_get, 2, 0),
cmd_vcp_client_aics_input_state_get, 2, 0),
SHELL_CMD_ARG(aics_gain_setting_get, NULL,
"Get the gain settings of a AICS instance <inst_index>",
cmd_vcs_client_aics_gain_setting_get, 2, 0),
cmd_vcp_client_aics_gain_setting_get, 2, 0),
SHELL_CMD_ARG(aics_input_type_get, NULL,
"Get the input type of a AICS instance <inst_index>",
cmd_vcs_client_aics_input_type_get, 2, 0),
cmd_vcp_client_aics_input_type_get, 2, 0),
SHELL_CMD_ARG(aics_input_status_get, NULL,
"Get the input status of a AICS instance <inst_index>",
cmd_vcs_client_aics_input_status_get, 2, 0),
cmd_vcp_client_aics_input_status_get, 2, 0),
SHELL_CMD_ARG(aics_input_unmute, NULL,
"Unmute the input of a AICS instance <inst_index>",
cmd_vcs_client_aics_input_unmute, 2, 0),
cmd_vcp_client_aics_input_unmute, 2, 0),
SHELL_CMD_ARG(aics_input_mute, NULL,
"Mute the input of a AICS instance <inst_index>",
cmd_vcs_client_aics_input_mute, 2, 0),
cmd_vcp_client_aics_input_mute, 2, 0),
SHELL_CMD_ARG(aics_manual_input_gain_set, NULL,
"Set the gain mode of a AICS instance to manual "
"<inst_index>",
cmd_vcs_client_aics_manual_input_gain_set, 2, 0),
cmd_vcp_client_aics_manual_input_gain_set, 2, 0),
SHELL_CMD_ARG(aics_automatic_input_gain_set, NULL,
"Set the gain mode of a AICS instance to automatic "
"<inst_index>",
cmd_vcs_client_aics_auto_input_gain_set, 2, 0),
cmd_vcp_client_aics_auto_input_gain_set, 2, 0),
SHELL_CMD_ARG(aics_gain_set, NULL,
"Set the gain of a AICS instance <inst_index> <gain>",
cmd_vcs_client_aics_gain_set, 3, 0),
cmd_vcp_client_aics_gain_set, 3, 0),
SHELL_CMD_ARG(aics_input_description_get, NULL,
"Read the input description of a AICS instance "
"<inst_index>",
cmd_vcs_client_aics_input_description_get, 2, 0),
cmd_vcp_client_aics_input_description_get, 2, 0),
SHELL_CMD_ARG(aics_input_description_set, NULL,
"Set the input description of a AICS instance "
"<inst_index> <description>",
cmd_vcs_client_aics_input_description_set, 3, 0),
cmd_vcp_client_aics_input_description_set, 3, 0),
SHELL_SUBCMD_SET_END
);
SHELL_CMD_ARG_REGISTER(vcs_client, &vcs_client_cmds,
"Bluetooth VCS client shell commands",
cmd_vcs_client, 1, 1);
SHELL_CMD_ARG_REGISTER(vcp_client, &vcp_client_cmds,
"Bluetooth VCP client shell commands",
cmd_vcp_client, 1, 1);

View file

@ -47,12 +47,12 @@ CONFIG_BT_AICS_MAX_INSTANCE_COUNT=4
CONFIG_BT_AICS_CLIENT_MAX_INSTANCE_COUNT=4
#Volume Control
CONFIG_BT_VCS=y
CONFIG_BT_VCS_VOCS_INSTANCE_COUNT=2
CONFIG_BT_VCS_AICS_INSTANCE_COUNT=2
CONFIG_BT_VCS_CLIENT=y
CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST=2
CONFIG_BT_VCS_CLIENT_MAX_AICS_INST=2
CONFIG_BT_VCP=y
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT=2
CONFIG_BT_VCP_AICS_INSTANCE_COUNT=2
CONFIG_BT_VCP_CLIENT=y
CONFIG_BT_VCP_CLIENT_MAX_VOCS_INST=2
CONFIG_BT_VCP_CLIENT_MAX_AICS_INST=2
CONFIG_BT_MICP_MIC_DEV=y
CONFIG_BT_MICP_MIC_DEV_AICS_INSTANCE_COUNT=2
@ -116,6 +116,7 @@ CONFIG_BT_CAP_INITIATOR=y
# DEBUGGING
CONFIG_BT_DEBUG_LOG=y
<<<<<<< HEAD
CONFIG_BT_VCS_LOG_LEVEL_DBG=y
CONFIG_BT_VCS_CLIENT_LOG_LEVEL_DBG=y
CONFIG_BT_AICS_LOG_LEVEL_DBG=y
@ -129,6 +130,21 @@ CONFIG_BT_TBS_LOG_LEVEL_DBG=y
CONFIG_BT_TBS_CLIENT_LOG_LEVEL_DBG=y
CONFIG_BT_MCS_LOG_LEVEL_DBG=y
CONFIG_BT_MCC_LOG_LEVEL_DBG=y
=======
CONFIG_BT_DEBUG_VCP=y
CONFIG_BT_DEBUG_VCP_CLIENT=y
CONFIG_BT_DEBUG_AICS=y
CONFIG_BT_DEBUG_AICS_CLIENT=y
CONFIG_BT_DEBUG_VOCS=y
CONFIG_BT_DEBUG_VOCS_CLIENT=y
CONFIG_BT_DEBUG_MICP_MIC_DEV=y
CONFIG_BT_DEBUG_MICP_MIC_CTLR=y
CONFIG_BT_DEBUG_MPL=y
CONFIG_BT_DEBUG_TBS=y
CONFIG_BT_DEBUG_TBS_CLIENT=y
CONFIG_BT_DEBUG_MCS=y
CONFIG_BT_DEBUG_MCC=y
>>>>>>> 11ca5c474e (Bluetooth: Audio: Rename VCS to VCP)
CONFIG_BT_OTS_LOG_LEVEL_DBG=y
CONFIG_BT_OTS_CLIENT_LOG_LEVEL_DBG=y
CONFIG_MCTL_LOG_LEVEL_DBG=y

View file

@ -6,8 +6,8 @@
#include "bstests.h"
extern struct bst_test_list *test_vcs_install(struct bst_test_list *tests);
extern struct bst_test_list *test_vcs_client_install(struct bst_test_list *tests);
extern struct bst_test_list *test_vcp_install(struct bst_test_list *tests);
extern struct bst_test_list *test_vcp_client_install(struct bst_test_list *tests);
extern struct bst_test_list *test_micp_install(struct bst_test_list *tests);
extern struct bst_test_list *test_micp_mic_ctlr_install(struct bst_test_list *tests);
extern struct bst_test_list *test_csip_set_member_install(struct bst_test_list *tests);
@ -32,8 +32,8 @@ extern struct bst_test_list *test_ias_install(struct bst_test_list *tests);
extern struct bst_test_list *test_ias_client_install(struct bst_test_list *tests);
bst_test_install_t test_installers[] = {
test_vcs_install,
test_vcs_client_install,
test_vcp_install,
test_vcp_client_install,
test_micp_install,
test_micp_mic_ctlr_install,
test_csip_set_member_install,

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#ifdef CONFIG_BT_VCS_CLIENT
#ifdef CONFIG_BT_VCP_CLIENT
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/audio/vcp.h>
@ -17,8 +17,8 @@
extern enum bst_result_t bst_result;
static struct bt_vcs *vcs;
static struct bt_vcs_included vcs_included;
static struct bt_vcp *vcp;
static struct bt_vcp_included vcp_included;
static volatile bool g_bt_init;
static volatile bool g_is_connected;
static volatile bool g_discovery_complete;
@ -41,11 +41,11 @@ static volatile bool g_aics_active = 1;
static char g_aics_desc[AICS_DESC_SIZE];
static volatile bool g_cb;
static void vcs_state_cb(struct bt_vcs *vcs, int err, uint8_t volume,
static void vcs_state_cb(struct bt_vcp *vcp, int err, uint8_t volume,
uint8_t mute)
{
if (err) {
FAIL("VCS state cb err (%d)", err);
FAIL("VCP state cb err (%d)", err);
return;
}
@ -55,10 +55,10 @@ static void vcs_state_cb(struct bt_vcs *vcs, int err, uint8_t volume,
g_cb = true;
}
static void vcs_flags_cb(struct bt_vcs *vcs, int err, uint8_t flags)
static void vcs_flags_cb(struct bt_vcp *vcp, int err, uint8_t flags)
{
if (err) {
FAIL("VCS flags cb err (%d)", err);
FAIL("VCP flags cb err (%d)", err);
return;
}
@ -204,28 +204,28 @@ static void aics_write_cb(struct bt_aics *inst, int err)
g_write_complete = true;
}
static void vcs_discover_cb(struct bt_vcs *vcs, int err, uint8_t vocs_count,
static void vcs_discover_cb(struct bt_vcp *vcp, int err, uint8_t vocs_count,
uint8_t aics_count)
{
if (err) {
FAIL("VCS could not be discovered (%d)\n", err);
FAIL("VCP could not be discovered (%d)\n", err);
return;
}
g_discovery_complete = true;
}
static void vcs_write_cb(struct bt_vcs *vcs, int err)
static void vcs_write_cb(struct bt_vcp *vcp, int err)
{
if (err) {
FAIL("VCS write failed (%d)\n", err);
FAIL("VCP write failed (%d)\n", err);
return;
}
g_write_complete = true;
}
static struct bt_vcs_cb vcs_cbs = {
static struct bt_vcp_cb vcs_cbs = {
.discover = vcs_discover_cb,
.vol_down = vcs_write_cb,
.vol_up = vcs_write_cb,
@ -298,7 +298,7 @@ static int test_aics(void)
struct bt_conn *cached_conn;
printk("Getting AICS client conn\n");
err = bt_aics_client_conn_get(vcs_included.aics[0], &cached_conn);
err = bt_aics_client_conn_get(vcp_included.aics[0], &cached_conn);
if (err != 0) {
FAIL("Could not get AICS client conn (err %d)\n", err);
return err;
@ -310,7 +310,7 @@ static int test_aics(void)
printk("Getting AICS state\n");
g_cb = false;
err = bt_vcs_aics_state_get(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_state_get(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not get AICS state (err %d)\n", err);
return err;
@ -320,7 +320,7 @@ static int test_aics(void)
printk("Getting AICS gain setting\n");
g_cb = false;
err = bt_vcs_aics_gain_setting_get(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_gain_setting_get(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not get AICS gain setting (err %d)\n", err);
return err;
@ -331,7 +331,7 @@ static int test_aics(void)
printk("Getting AICS input type\n");
expected_input_type = BT_AICS_INPUT_TYPE_DIGITAL;
g_cb = false;
err = bt_vcs_aics_type_get(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_type_get(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not get AICS input type (err %d)\n", err);
return err;
@ -342,7 +342,7 @@ static int test_aics(void)
printk("Getting AICS status\n");
g_cb = false;
err = bt_vcs_aics_status_get(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_status_get(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not get AICS status (err %d)\n", err);
return err;
@ -352,7 +352,7 @@ static int test_aics(void)
printk("Getting AICS description\n");
g_cb = false;
err = bt_vcs_aics_description_get(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_description_get(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not get AICS description (err %d)\n", err);
return err;
@ -363,7 +363,7 @@ static int test_aics(void)
printk("Setting AICS mute\n");
expected_input_mute = BT_AICS_STATE_MUTED;
g_write_complete = g_cb = false;
err = bt_vcs_aics_mute(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_mute(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not set AICS mute (err %d)\n", err);
return err;
@ -375,7 +375,7 @@ static int test_aics(void)
printk("Setting AICS unmute\n");
expected_input_mute = BT_AICS_STATE_UNMUTED;
g_write_complete = g_cb = false;
err = bt_vcs_aics_unmute(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_unmute(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not set AICS unmute (err %d)\n", err);
return err;
@ -387,7 +387,7 @@ static int test_aics(void)
printk("Setting AICS auto mode\n");
expected_mode = BT_AICS_MODE_AUTO;
g_write_complete = g_cb = false;
err = bt_vcs_aics_automatic_gain_set(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_automatic_gain_set(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not set AICS auto mode (err %d)\n", err);
return err;
@ -398,7 +398,7 @@ static int test_aics(void)
printk("Setting AICS manual mode\n");
expected_mode = BT_AICS_MODE_MANUAL;
g_write_complete = g_cb = false;
err = bt_vcs_aics_manual_gain_set(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_manual_gain_set(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not set AICS manual mode (err %d)\n", err);
return err;
@ -409,7 +409,7 @@ static int test_aics(void)
printk("Setting AICS gain\n");
expected_gain = g_aics_gain_max - 1;
g_write_complete = g_cb = false;
err = bt_vcs_aics_gain_set(vcs, vcs_included.aics[0], expected_gain);
err = bt_vcp_aics_gain_set(vcp, vcp_included.aics[0], expected_gain);
if (err) {
FAIL("Could not set AICS gain (err %d)\n", err);
return err;
@ -422,7 +422,7 @@ static int test_aics(void)
sizeof(expected_aics_desc));
expected_aics_desc[sizeof(expected_aics_desc) - 1] = '\0';
g_cb = false;
err = bt_vcs_aics_description_set(vcs, vcs_included.aics[0],
err = bt_vcp_aics_description_set(vcp, vcp_included.aics[0],
expected_aics_desc);
if (err) {
FAIL("Could not set AICS Description (err %d)\n", err);
@ -446,7 +446,7 @@ static int test_vocs(void)
struct bt_conn *cached_conn;
printk("Getting VOCS client conn\n");
err = bt_vocs_client_conn_get(vcs_included.vocs[0], &cached_conn);
err = bt_vocs_client_conn_get(vcp_included.vocs[0], &cached_conn);
if (err != 0) {
FAIL("Could not get VOCS client conn (err %d)\n", err);
return err;
@ -458,7 +458,7 @@ static int test_vocs(void)
printk("Getting VOCS state\n");
g_cb = false;
err = bt_vcs_vocs_state_get(vcs, vcs_included.vocs[0]);
err = bt_vcp_vocs_state_get(vcp, vcp_included.vocs[0]);
if (err) {
FAIL("Could not get VOCS state (err %d)\n", err);
return err;
@ -468,7 +468,7 @@ static int test_vocs(void)
printk("Getting VOCS location\n");
g_cb = false;
err = bt_vcs_vocs_location_get(vcs, vcs_included.vocs[0]);
err = bt_vcp_vocs_location_get(vcp, vcp_included.vocs[0]);
if (err) {
FAIL("Could not get VOCS location (err %d)\n", err);
return err;
@ -478,7 +478,7 @@ static int test_vocs(void)
printk("Getting VOCS description\n");
g_cb = false;
err = bt_vcs_vocs_description_get(vcs, vcs_included.vocs[0]);
err = bt_vcp_vocs_description_get(vcp, vcp_included.vocs[0]);
if (err) {
FAIL("Could not get VOCS description (err %d)\n", err);
return err;
@ -489,7 +489,7 @@ static int test_vocs(void)
printk("Setting VOCS location\n");
expected_location = g_vocs_location + 1;
g_cb = false;
err = bt_vcs_vocs_location_set(vcs, vcs_included.vocs[0],
err = bt_vcp_vocs_location_set(vcp, vcp_included.vocs[0],
expected_location);
if (err) {
FAIL("Could not set VOCS location (err %d)\n", err);
@ -501,7 +501,7 @@ static int test_vocs(void)
printk("Setting VOCS state\n");
expected_offset = g_vocs_offset + 1;
g_write_complete = g_cb = false;
err = bt_vcs_vocs_state_set(vcs, vcs_included.vocs[0], expected_offset);
err = bt_vcp_vocs_state_set(vcp, vcp_included.vocs[0], expected_offset);
if (err) {
FAIL("Could not set VOCS state (err %d)\n", err);
return err;
@ -514,7 +514,7 @@ static int test_vocs(void)
sizeof(expected_description));
expected_description[sizeof(expected_description) - 1] = '\0';
g_cb = false;
err = bt_vcs_vocs_description_set(vcs, vcs_included.vocs[0],
err = bt_vcp_vocs_description_set(vcp, vcp_included.vocs[0],
expected_description);
if (err) {
FAIL("Could not set VOCS description (err %d)\n", err);
@ -544,7 +544,7 @@ static void test_main(void)
return;
}
err = bt_vcs_client_cb_register(&vcs_cbs);
err = bt_vcp_client_cb_register(&vcs_cbs);
if (err) {
FAIL("CB register failed (err %d)\n", err);
return;
@ -562,23 +562,23 @@ static void test_main(void)
WAIT_FOR_COND(g_is_connected);
err = bt_vcs_discover(default_conn, &vcs);
err = bt_vcp_discover(default_conn, &vcp);
if (err) {
FAIL("Failed to discover VCS %d", err);
FAIL("Failed to discover VCP %d", err);
}
WAIT_FOR_COND(g_discovery_complete);
err = bt_vcs_included_get(vcs, &vcs_included);
err = bt_vcp_included_get(vcp, &vcp_included);
if (err) {
FAIL("Failed to get VCS included services (err %d)\n", err);
FAIL("Failed to get VCP included services (err %d)\n", err);
return;
}
printk("Getting VCS client conn\n");
err = bt_vcs_client_conn_get(vcs, &cached_conn);
printk("Getting VCP client conn\n");
err = bt_vcp_client_conn_get(vcp, &cached_conn);
if (err != 0) {
FAIL("Could not get VCS client conn (err %d)\n", err);
FAIL("Could not get VCP client conn (err %d)\n", err);
return;
}
if (cached_conn != default_conn) {
@ -586,146 +586,146 @@ static void test_main(void)
return;
}
printk("Getting VCS volume state\n");
printk("Getting VCP volume state\n");
g_cb = false;
err = bt_vcs_vol_get(vcs);
err = bt_vcp_vol_get(vcp);
if (err) {
FAIL("Could not get VCS volume (err %d)\n", err);
FAIL("Could not get VCP volume (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_cb);
printk("VCS volume get\n");
printk("VCP volume get\n");
printk("Getting VCS flags\n");
printk("Getting VCP flags\n");
g_cb = false;
err = bt_vcs_flags_get(vcs);
err = bt_vcp_flags_get(vcp);
if (err) {
FAIL("Could not get VCS flags (err %d)\n", err);
FAIL("Could not get VCP flags (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_cb);
printk("VCS flags get\n");
printk("VCP flags get\n");
expected_volume = g_volume != 100 ? 100 : 101; /* ensure change */
g_write_complete = g_cb = false;
err = bt_vcs_vol_set(vcs, expected_volume);
err = bt_vcp_vol_set(vcp, expected_volume);
if (err) {
FAIL("Could not set VCS volume (err %d)\n", err);
FAIL("Could not set VCP volume (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_volume == expected_volume && g_cb && g_write_complete);
printk("VCS volume set\n");
printk("VCP volume set\n");
printk("Downing VCS volume\n");
printk("Downing VCP volume\n");
previous_volume = g_volume;
g_write_complete = g_cb = false;
err = bt_vcs_vol_down(vcs);
err = bt_vcp_vol_down(vcp);
if (err) {
FAIL("Could not get down VCS volume (err %d)\n", err);
FAIL("Could not get down VCP volume (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_volume < previous_volume && g_cb && g_write_complete);
printk("VCS volume downed\n");
printk("VCP volume downed\n");
printk("Upping VCS volume\n");
printk("Upping VCP volume\n");
previous_volume = g_volume;
g_write_complete = g_cb = false;
err = bt_vcs_vol_up(vcs);
err = bt_vcp_vol_up(vcp);
if (err) {
FAIL("Could not up VCS volume (err %d)\n", err);
FAIL("Could not up VCP volume (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_volume > previous_volume && g_cb && g_write_complete);
printk("VCS volume upped\n");
printk("VCP volume upped\n");
printk("Muting VCS\n");
printk("Muting VCP\n");
expected_mute = 1;
g_write_complete = g_cb = false;
err = bt_vcs_mute(vcs);
err = bt_vcp_mute(vcp);
if (err) {
FAIL("Could not mute VCS (err %d)\n", err);
FAIL("Could not mute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_mute == expected_mute && g_cb && g_write_complete);
printk("VCS muted\n");
printk("VCP muted\n");
printk("Downing and unmuting VCS\n");
printk("Downing and unmuting VCP\n");
previous_volume = g_volume;
expected_mute = 0;
g_write_complete = g_cb = false;
err = bt_vcs_unmute_vol_down(vcs);
err = bt_vcp_unmute_vol_down(vcp);
if (err) {
FAIL("Could not down and unmute VCS (err %d)\n", err);
FAIL("Could not down and unmute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_volume < previous_volume && expected_mute == g_mute &&
g_cb && g_write_complete);
printk("VCS volume downed and unmuted\n");
printk("VCP volume downed and unmuted\n");
printk("Muting VCS\n");
printk("Muting VCP\n");
expected_mute = 1;
g_write_complete = g_cb = false;
err = bt_vcs_mute(vcs);
err = bt_vcp_mute(vcp);
if (err) {
FAIL("Could not mute VCS (err %d)\n", err);
FAIL("Could not mute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_mute == expected_mute && g_cb && g_write_complete);
printk("VCS muted\n");
printk("VCP muted\n");
printk("Upping and unmuting VCS\n");
printk("Upping and unmuting VCP\n");
previous_volume = g_volume;
expected_mute = 0;
g_write_complete = g_cb = false;
err = bt_vcs_unmute_vol_up(vcs);
err = bt_vcp_unmute_vol_up(vcp);
if (err) {
FAIL("Could not up and unmute VCS (err %d)\n", err);
FAIL("Could not up and unmute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_volume > previous_volume && g_mute == expected_mute &&
g_cb && g_write_complete);
printk("VCS volume upped and unmuted\n");
printk("VCP volume upped and unmuted\n");
printk("Muting VCS\n");
printk("Muting VCP\n");
expected_mute = 1;
g_write_complete = g_cb = false;
err = bt_vcs_mute(vcs);
err = bt_vcp_mute(vcp);
if (err) {
FAIL("Could not mute VCS (err %d)\n", err);
FAIL("Could not mute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_mute == expected_mute && g_cb && g_write_complete);
printk("VCS muted\n");
printk("VCP muted\n");
printk("Unmuting VCS\n");
printk("Unmuting VCP\n");
expected_mute = 0;
g_write_complete = g_cb = false;
err = bt_vcs_unmute(vcs);
err = bt_vcp_unmute(vcp);
if (err) {
FAIL("Could not unmute VCS (err %d)\n", err);
FAIL("Could not unmute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_mute == expected_mute && g_cb && g_write_complete);
printk("VCS volume unmuted\n");
printk("VCP volume unmuted\n");
if (CONFIG_BT_VCS_CLIENT_VOCS > 0) {
if (CONFIG_BT_VCP_CLIENT_VOCS > 0) {
if (test_vocs()) {
return;
}
}
if (CONFIG_BT_VCS_CLIENT_MAX_AICS_INST > 0) {
if (CONFIG_BT_VCP_CLIENT_MAX_AICS_INST > 0) {
if (test_aics()) {
return;
}
}
PASS("VCS client Passed\n");
PASS("VCP client Passed\n");
}
static const struct bst_test_instance test_vcs[] = {
{
.test_id = "vcs_client",
.test_id = "vcp_client",
.test_post_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main
@ -733,16 +733,16 @@ static const struct bst_test_instance test_vcs[] = {
BSTEST_END_MARKER
};
struct bst_test_list *test_vcs_client_install(struct bst_test_list *tests)
struct bst_test_list *test_vcp_client_install(struct bst_test_list *tests)
{
return bst_add_tests(tests, test_vcs);
}
#else
struct bst_test_list *test_vcs_client_install(struct bst_test_list *tests)
struct bst_test_list *test_vcp_client_install(struct bst_test_list *tests)
{
return tests;
}
#endif /* CONFIG_BT_VCS_CLIENT */
#endif /* CONFIG_BT_VCP_CLIENT */

View file

@ -5,7 +5,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#ifdef CONFIG_BT_VCS
#ifdef CONFIG_BT_VCP
#include <zephyr/bluetooth/audio/vcp.h>
#include "common.h"
@ -23,8 +23,8 @@ extern enum bst_result_t bst_result;
#define AICS_DESC_SIZE 0
#endif /* CONFIG_BT_AICS */
static struct bt_vcs *vcs;
static struct bt_vcs_included vcs_included;
static struct bt_vcp *vcp;
static struct bt_vcp_included vcp_included;
static volatile uint8_t g_volume;
static volatile uint8_t g_mute;
@ -44,11 +44,11 @@ static char g_aics_desc[AICS_DESC_SIZE];
static volatile bool g_cb;
static bool g_is_connected;
static void vcs_state_cb(struct bt_vcs *vcs, int err, uint8_t volume,
static void vcs_state_cb(struct bt_vcp *vcp, int err, uint8_t volume,
uint8_t mute)
{
if (err) {
FAIL("VCS state cb err (%d)", err);
FAIL("VCP state cb err (%d)", err);
return;
}
@ -57,10 +57,10 @@ static void vcs_state_cb(struct bt_vcs *vcs, int err, uint8_t volume,
g_cb = true;
}
static void vcs_flags_cb(struct bt_vcs *vcs, int err, uint8_t flags)
static void vcs_flags_cb(struct bt_vcp *vcp, int err, uint8_t flags)
{
if (err) {
FAIL("VCS flags cb err (%d)", err);
FAIL("VCP flags cb err (%d)", err);
return;
}
@ -167,7 +167,7 @@ static void aics_description_cb(struct bt_aics *inst, int err,
g_cb = true;
}
static struct bt_vcs_cb vcs_cb = {
static struct bt_vcp_cb vcs_cb = {
.state = vcs_state_cb,
.flags = vcs_flags_cb,
};
@ -218,7 +218,7 @@ static int test_aics_standalone(void)
printk("Deactivating AICS\n");
expected_aics_active = false;
err = bt_vcs_aics_deactivate(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_deactivate(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not deactivate AICS (err %d)\n", err);
return err;
@ -228,7 +228,7 @@ static int test_aics_standalone(void)
printk("Activating AICS\n");
expected_aics_active = true;
err = bt_vcs_aics_activate(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_activate(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not activate AICS (err %d)\n", err);
return err;
@ -238,7 +238,7 @@ static int test_aics_standalone(void)
printk("Getting AICS state\n");
g_cb = false;
err = bt_vcs_aics_state_get(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_state_get(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not get AICS state (err %d)\n", err);
return err;
@ -248,7 +248,7 @@ static int test_aics_standalone(void)
printk("Getting AICS gain setting\n");
g_cb = false;
err = bt_vcs_aics_gain_setting_get(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_gain_setting_get(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not get AICS gain setting (err %d)\n", err);
return err;
@ -258,7 +258,7 @@ static int test_aics_standalone(void)
printk("Getting AICS input type\n");
expected_input_type = BT_AICS_INPUT_TYPE_DIGITAL;
err = bt_vcs_aics_type_get(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_type_get(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not get AICS input type (err %d)\n", err);
return err;
@ -269,7 +269,7 @@ static int test_aics_standalone(void)
printk("Getting AICS status\n");
g_cb = false;
err = bt_vcs_aics_status_get(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_status_get(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not get AICS status (err %d)\n", err);
return err;
@ -279,7 +279,7 @@ static int test_aics_standalone(void)
printk("Getting AICS description\n");
g_cb = false;
err = bt_vcs_aics_description_get(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_description_get(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not get AICS description (err %d)\n", err);
return err;
@ -289,7 +289,7 @@ static int test_aics_standalone(void)
printk("Setting AICS mute\n");
expected_input_mute = BT_AICS_STATE_MUTED;
err = bt_vcs_aics_mute(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_mute(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not set AICS mute (err %d)\n", err);
return err;
@ -299,7 +299,7 @@ static int test_aics_standalone(void)
printk("Setting AICS unmute\n");
expected_input_mute = BT_AICS_STATE_UNMUTED;
err = bt_vcs_aics_unmute(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_unmute(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not set AICS unmute (err %d)\n", err);
return err;
@ -309,7 +309,7 @@ static int test_aics_standalone(void)
printk("Setting AICS auto mode\n");
expected_mode = BT_AICS_MODE_AUTO;
err = bt_vcs_aics_automatic_gain_set(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_automatic_gain_set(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not set AICS auto mode (err %d)\n", err);
return err;
@ -319,7 +319,7 @@ static int test_aics_standalone(void)
printk("Setting AICS manual mode\n");
expected_mode = BT_AICS_MODE_MANUAL;
err = bt_vcs_aics_manual_gain_set(vcs, vcs_included.aics[0]);
err = bt_vcp_aics_manual_gain_set(vcp, vcp_included.aics[0]);
if (err) {
FAIL("Could not set AICS manual mode (err %d)\n", err);
return err;
@ -329,7 +329,7 @@ static int test_aics_standalone(void)
printk("Setting AICS gain\n");
expected_gain = g_aics_gain_max - 1;
err = bt_vcs_aics_gain_set(vcs, vcs_included.aics[0], expected_gain);
err = bt_vcp_aics_gain_set(vcp, vcp_included.aics[0], expected_gain);
if (err) {
FAIL("Could not set AICS gain (err %d)\n", err);
return err;
@ -342,7 +342,7 @@ static int test_aics_standalone(void)
sizeof(expected_aics_desc));
expected_aics_desc[sizeof(expected_aics_desc) - 1] = '\0';
g_cb = false;
err = bt_vcs_aics_description_set(vcs, vcs_included.aics[0],
err = bt_vcp_aics_description_set(vcp, vcp_included.aics[0],
expected_aics_desc);
if (err) {
FAIL("Could not set AICS Description (err %d)\n", err);
@ -364,7 +364,7 @@ static int test_vocs_standalone(void)
printk("Getting VOCS state\n");
g_cb = false;
err = bt_vcs_vocs_state_get(vcs, vcs_included.vocs[0]);
err = bt_vcp_vocs_state_get(vcp, vcp_included.vocs[0]);
if (err) {
FAIL("Could not get VOCS state (err %d)\n", err);
return err;
@ -374,7 +374,7 @@ static int test_vocs_standalone(void)
printk("Getting VOCS location\n");
g_cb = false;
err = bt_vcs_vocs_location_get(vcs, vcs_included.vocs[0]);
err = bt_vcp_vocs_location_get(vcp, vcp_included.vocs[0]);
if (err) {
FAIL("Could not get VOCS location (err %d)\n", err);
return err;
@ -384,7 +384,7 @@ static int test_vocs_standalone(void)
printk("Getting VOCS description\n");
g_cb = false;
err = bt_vcs_vocs_description_get(vcs, vcs_included.vocs[0]);
err = bt_vcp_vocs_description_get(vcp, vcp_included.vocs[0]);
if (err) {
FAIL("Could not get VOCS description (err %d)\n", err);
return err;
@ -394,7 +394,7 @@ static int test_vocs_standalone(void)
printk("Setting VOCS location\n");
expected_location = g_vocs_location + 1;
err = bt_vcs_vocs_location_set(vcs, vcs_included.vocs[0],
err = bt_vcp_vocs_location_set(vcp, vcp_included.vocs[0],
expected_location);
if (err) {
FAIL("Could not set VOCS location (err %d)\n", err);
@ -405,7 +405,7 @@ static int test_vocs_standalone(void)
printk("Setting VOCS state\n");
expected_offset = g_vocs_offset + 1;
err = bt_vcs_vocs_state_set(vcs, vcs_included.vocs[0], expected_offset);
err = bt_vcp_vocs_state_set(vcp, vcp_included.vocs[0], expected_offset);
if (err) {
FAIL("Could not set VOCS state (err %d)\n", err);
return err;
@ -418,7 +418,7 @@ static int test_vocs_standalone(void)
sizeof(expected_description) - 1);
expected_description[sizeof(expected_description) - 1] = '\0';
g_cb = false;
err = bt_vcs_vocs_description_set(vcs, vcs_included.vocs[0],
err = bt_vcp_vocs_description_set(vcp, vcp_included.vocs[0],
expected_description);
if (err) {
FAIL("Could not set VOCS description (err %d)\n", err);
@ -434,9 +434,9 @@ static int test_vocs_standalone(void)
static void test_standalone(void)
{
int err;
struct bt_vcs_register_param vcs_param;
char input_desc[CONFIG_BT_VCS_AICS_INSTANCE_COUNT][16];
char output_desc[CONFIG_BT_VCS_VOCS_INSTANCE_COUNT][16];
struct bt_vcp_register_param vcs_param;
char input_desc[CONFIG_BT_VCP_AICS_INSTANCE_COUNT][16];
char output_desc[CONFIG_BT_VCP_VOCS_INSTANCE_COUNT][16];
const uint8_t volume_step = 5;
uint8_t expected_volume;
uint8_t expected_mute;
@ -475,167 +475,167 @@ static void test_standalone(void)
}
vcs_param.step = 1;
vcs_param.mute = BT_VCS_STATE_UNMUTED;
vcs_param.mute = BT_VCP_STATE_UNMUTED;
vcs_param.volume = 100;
vcs_param.cb = &vcs_cb;
err = bt_vcs_register(&vcs_param, &vcs);
err = bt_vcp_register(&vcs_param, &vcp);
if (err) {
FAIL("VCS register failed (err %d)\n", err);
FAIL("VCP register failed (err %d)\n", err);
return;
}
err = bt_vcs_included_get(vcs, &vcs_included);
err = bt_vcp_included_get(vcp, &vcp_included);
if (err) {
FAIL("VCS included get failed (err %d)\n", err);
FAIL("VCP included get failed (err %d)\n", err);
return;
}
printk("VCS initialized\n");
printk("VCP initialized\n");
printk("Setting VCS step\n");
err = bt_vcs_vol_step_set(volume_step);
printk("Setting VCP step\n");
err = bt_vcp_vol_step_set(volume_step);
if (err) {
FAIL("VCS step set failed (err %d)\n", err);
FAIL("VCP step set failed (err %d)\n", err);
return;
}
printk("VCS step set\n");
printk("VCP step set\n");
printk("Getting VCS volume state\n");
printk("Getting VCP volume state\n");
g_cb = false;
err = bt_vcs_vol_get(vcs);
err = bt_vcp_vol_get(vcp);
if (err) {
FAIL("Could not get VCS volume (err %d)\n", err);
FAIL("Could not get VCP volume (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_cb);
printk("VCS volume get\n");
printk("VCP volume get\n");
printk("Getting VCS flags\n");
printk("Getting VCP flags\n");
g_cb = false;
err = bt_vcs_flags_get(vcs);
err = bt_vcp_flags_get(vcp);
if (err) {
FAIL("Could not get VCS flags (err %d)\n", err);
FAIL("Could not get VCP flags (err %d)\n", err);
return;
}
WAIT_FOR_COND(g_cb);
printk("VCS flags get\n");
printk("VCP flags get\n");
printk("Downing VCS volume\n");
printk("Downing VCP volume\n");
expected_volume = g_volume - volume_step;
err = bt_vcs_vol_down(vcs);
err = bt_vcp_vol_down(vcp);
if (err) {
FAIL("Could not get down VCS volume (err %d)\n", err);
FAIL("Could not get down VCP volume (err %d)\n", err);
return;
}
WAIT_FOR_COND(expected_volume == g_volume || g_volume == 0);
printk("VCS volume downed\n");
printk("VCP volume downed\n");
printk("Upping VCS volume\n");
printk("Upping VCP volume\n");
expected_volume = g_volume + volume_step;
err = bt_vcs_vol_up(vcs);
err = bt_vcp_vol_up(vcp);
if (err) {
FAIL("Could not up VCS volume (err %d)\n", err);
FAIL("Could not up VCP volume (err %d)\n", err);
return;
}
WAIT_FOR_COND(expected_volume == g_volume || g_volume == UINT8_MAX);
printk("VCS volume upped\n");
printk("VCP volume upped\n");
printk("Muting VCS\n");
printk("Muting VCP\n");
expected_mute = 1;
err = bt_vcs_mute(vcs);
err = bt_vcp_mute(vcp);
if (err) {
FAIL("Could not mute VCS (err %d)\n", err);
FAIL("Could not mute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND(expected_mute == g_mute);
printk("VCS muted\n");
printk("VCP muted\n");
printk("Downing and unmuting VCS\n");
printk("Downing and unmuting VCP\n");
expected_volume = g_volume - volume_step;
expected_mute = 0;
err = bt_vcs_unmute_vol_down(vcs);
err = bt_vcp_unmute_vol_down(vcp);
if (err) {
FAIL("Could not down and unmute VCS (err %d)\n", err);
FAIL("Could not down and unmute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND((expected_volume == g_volume || g_volume == 0) &&
expected_mute == g_mute);
printk("VCS volume downed and unmuted\n");
printk("VCP volume downed and unmuted\n");
printk("Muting VCS\n");
printk("Muting VCP\n");
expected_mute = 1;
err = bt_vcs_mute(vcs);
err = bt_vcp_mute(vcp);
if (err) {
FAIL("Could not mute VCS (err %d)\n", err);
FAIL("Could not mute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND(expected_mute == g_mute);
printk("VCS muted\n");
printk("VCP muted\n");
printk("Upping and unmuting VCS\n");
printk("Upping and unmuting VCP\n");
expected_volume = g_volume + volume_step;
expected_mute = 0;
err = bt_vcs_unmute_vol_up(vcs);
err = bt_vcp_unmute_vol_up(vcp);
if (err) {
FAIL("Could not up and unmute VCS (err %d)\n", err);
FAIL("Could not up and unmute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND((expected_volume == g_volume || g_volume == UINT8_MAX) &&
expected_mute == g_mute);
printk("VCS volume upped and unmuted\n");
printk("VCP volume upped and unmuted\n");
printk("Muting VCS\n");
printk("Muting VCP\n");
expected_mute = 1;
err = bt_vcs_mute(vcs);
err = bt_vcp_mute(vcp);
if (err) {
FAIL("Could not mute VCS (err %d)\n", err);
FAIL("Could not mute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND(expected_mute == g_mute);
printk("VCS volume upped\n");
printk("VCP volume upped\n");
printk("Unmuting VCS\n");
printk("Unmuting VCP\n");
expected_mute = 0;
err = bt_vcs_unmute(vcs);
err = bt_vcp_unmute(vcp);
if (err) {
FAIL("Could not unmute VCS (err %d)\n", err);
FAIL("Could not unmute VCP (err %d)\n", err);
return;
}
WAIT_FOR_COND(expected_mute == g_mute);
printk("VCS volume unmuted\n");
printk("VCP volume unmuted\n");
expected_volume = g_volume - 5;
err = bt_vcs_vol_set(vcs, expected_volume);
err = bt_vcp_vol_set(vcp, expected_volume);
if (err) {
FAIL("Could not set VCS volume (err %d)\n", err);
FAIL("Could not set VCP volume (err %d)\n", err);
return;
}
WAIT_FOR_COND(expected_volume == g_volume);
printk("VCS volume set\n");
printk("VCP volume set\n");
if (CONFIG_BT_VCS_VOCS_INSTANCE_COUNT > 0) {
if (CONFIG_BT_VCP_VOCS_INSTANCE_COUNT > 0) {
if (test_vocs_standalone()) {
return;
}
}
if (CONFIG_BT_VCS_AICS_INSTANCE_COUNT > 0) {
if (CONFIG_BT_VCP_AICS_INSTANCE_COUNT > 0) {
if (test_aics_standalone()) {
return;
}
}
PASS("VCS passed\n");
PASS("VCP passed\n");
}
static void test_main(void)
{
int err;
struct bt_vcs_register_param vcs_param;
char input_desc[CONFIG_BT_VCS_AICS_INSTANCE_COUNT][16];
char output_desc[CONFIG_BT_VCS_VOCS_INSTANCE_COUNT][16];
struct bt_vcp_register_param vcs_param;
char input_desc[CONFIG_BT_VCP_AICS_INSTANCE_COUNT][16];
char output_desc[CONFIG_BT_VCP_VOCS_INSTANCE_COUNT][16];
err = bt_enable(NULL);
if (err) {
@ -671,23 +671,23 @@ static void test_main(void)
}
vcs_param.step = 1;
vcs_param.mute = BT_VCS_STATE_UNMUTED;
vcs_param.mute = BT_VCP_STATE_UNMUTED;
vcs_param.volume = 100;
vcs_param.cb = &vcs_cb;
err = bt_vcs_register(&vcs_param, &vcs);
err = bt_vcp_register(&vcs_param, &vcp);
if (err) {
FAIL("VCS register failed (err %d)\n", err);
FAIL("VCP register failed (err %d)\n", err);
return;
}
err = bt_vcs_included_get(vcs, &vcs_included);
err = bt_vcp_included_get(vcp, &vcp_included);
if (err) {
FAIL("VCS included get failed (err %d)\n", err);
FAIL("VCP included get failed (err %d)\n", err);
return;
}
printk("VCS initialized\n");
printk("VCP initialized\n");
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, AD_SIZE, NULL, 0);
if (err) {
@ -699,7 +699,7 @@ static void test_main(void)
WAIT_FOR_COND(g_is_connected);
PASS("VCS passed\n");
PASS("VCP passed\n");
}
static const struct bst_test_instance test_vcs[] = {
@ -710,7 +710,7 @@ static const struct bst_test_instance test_vcs[] = {
.test_main_f = test_standalone
},
{
.test_id = "vcs",
.test_id = "vcp",
.test_post_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main
@ -718,14 +718,14 @@ static const struct bst_test_instance test_vcs[] = {
BSTEST_END_MARKER
};
struct bst_test_list *test_vcs_install(struct bst_test_list *tests)
struct bst_test_list *test_vcp_install(struct bst_test_list *tests)
{
return bst_add_tests(tests, test_vcs);
}
#else
struct bst_test_list *test_vcs_install(struct bst_test_list *tests)
struct bst_test_list *test_vcp_install(struct bst_test_list *tests)
{
return tests;
}
#endif /* CONFIG_BT_VCS */
#endif /* CONFIG_BT_VCP */

View file

@ -4,7 +4,7 @@
#
# SPDX-License-Identifier: Apache-2.0
SIMULATION_ID="vcs"
SIMULATION_ID="vcp"
VERBOSITY_LEVEL=2
PROCESS_IDS=""; EXIT_CODE=0
@ -24,7 +24,7 @@ BOARD="${BOARD:-nrf52_bsim}"
cd ${BSIM_OUT_PATH}/bin
printf "\n\n======== Running VCS standalone (API) test =========\n\n"
printf "\n\n======== Running VCP standalone (API) test =========\n\n"
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=vcs_standalone -rs=23
@ -37,13 +37,13 @@ for PROCESS_ID in $PROCESS_IDS; do
wait $PROCESS_ID || let "EXIT_CODE=$?"
done
printf "\n\n======== Running VCS and VCS client test =========\n\n"
printf "\n\n======== Running VCP and VCP client test =========\n\n"
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=vcs -rs=23
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=vcp -rs=23
Execute ./bs_${BOARD}_tests_bluetooth_bsim_bt_bsim_test_audio_prj_conf \
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=vcs_client -rs=46
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=vcp_client -rs=46
# Simulation time should be larger than the WAIT_TIME in common.h
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \

View file

@ -70,12 +70,12 @@ CONFIG_BT_VOCS_CLIENT_MAX_INSTANCE_COUNT=1
CONFIG_BT_AICS_MAX_INSTANCE_COUNT=2
CONFIG_BT_AICS_CLIENT_MAX_INSTANCE_COUNT=2
CONFIG_BT_VCS=y
CONFIG_BT_VCS_VOCS_INSTANCE_COUNT=1
CONFIG_BT_VCS_AICS_INSTANCE_COUNT=1
CONFIG_BT_VCS_CLIENT=y
CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST=1
CONFIG_BT_VCS_CLIENT_MAX_AICS_INST=1
CONFIG_BT_VCP=y
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT=1
CONFIG_BT_VCP_AICS_INSTANCE_COUNT=1
CONFIG_BT_VCP_CLIENT=y
CONFIG_BT_VCP_CLIENT_MAX_VOCS_INST=1
CONFIG_BT_VCP_CLIENT_MAX_AICS_INST=1
CONFIG_BT_MICP_MIC_DEV=y
CONFIG_BT_MICP_MIC_DEV_AICS_INSTANCE_COUNT=1
@ -153,8 +153,8 @@ CONFIG_BT_AUDIO_BROADCAST_SINK_LOG_LEVEL_DBG=y
CONFIG_BT_HAS_LOG_LEVEL_DBG=y
CONFIG_BT_HAS_CLIENT_LOG_LEVEL_DBG=y
CONFIG_BT_TBS_LOG_LEVEL_DBG=y
CONFIG_BT_VCS_CLIENT_LOG_LEVEL_DBG=y
CONFIG_BT_VCS_LOG_LEVEL_DBG=y
CONFIG_BT_VCP_CLIENT_LOG_LEVEL_DBG=y
CONFIG_BT_VCP_LOG_LEVEL_DBG=y
CONFIG_BT_MICP_MIC_CTLR_LOG_LEVEL_DBG=y
CONFIG_BT_MICP_MIC_DEV_LOG_LEVEL_DBG=y
CONFIG_BT_AICS_CLIENT_LOG_LEVEL_DBG=y

View file

@ -46,7 +46,7 @@ tests:
build_only: true
platform_allow: native_posix
extra_configs:
- CONFIG_BT_VCS=n
- CONFIG_BT_VCP=n
tags: bluetooth
bluetooth.shell.audio.no_vocs:
extra_args: CONF_FILE="audio.conf"
@ -54,7 +54,7 @@ tests:
platform_allow: native_posix
extra_configs:
- CONFIG_BT_VOCS_MAX_INSTANCE_COUNT=0
- CONFIG_BT_VCS_VOCS_INSTANCE_COUNT=0
- CONFIG_BT_VCP_VOCS_INSTANCE_COUNT=0
tags: bluetooth
bluetooth.shell.audio.no_aics:
extra_args: CONF_FILE="audio.conf"
@ -62,7 +62,7 @@ tests:
platform_allow: native_posix
extra_configs:
- CONFIG_BT_AICS_MAX_INSTANCE_COUNT=0
- CONFIG_BT_VCS_AICS_INSTANCE_COUNT=0
- CONFIG_BT_VCP_AICS_INSTANCE_COUNT=0
- CONFIG_BT_MICP_MIC_DEV_AICS_INSTANCE_COUNT=0
tags: bluetooth
bluetooth.shell.audio.no_aics_vocs:
@ -71,39 +71,39 @@ tests:
platform_allow: native_posix
extra_configs:
- CONFIG_BT_VOCS_MAX_INSTANCE_COUNT=0
- CONFIG_BT_VCS_VOCS_INSTANCE_COUNT=0
- CONFIG_BT_VCP_VOCS_INSTANCE_COUNT=0
- CONFIG_BT_AICS_MAX_INSTANCE_COUNT=0
- CONFIG_BT_VCS_AICS_INSTANCE_COUNT=0
- CONFIG_BT_VCP_AICS_INSTANCE_COUNT=0
- CONFIG_BT_MICP_MIC_DEV_AICS_INSTANCE_COUNT=0
tags: bluetooth
bluetooth.shell.audio.no_vcs_client:
bluetooth.shell.audio.no_vcp_client:
extra_args: CONF_FILE="audio.conf"
build_only: true
platform_allow: native_posix
extra_configs:
- CONFIG_BT_VCS_CLIENT=n
- CONFIG_BT_VCP_CLIENT=n
tags: bluetooth
bluetooth.shell.audio.no_vcs_vcs_client:
bluetooth.shell.audio.no_vcs_vcp_client:
extra_args: CONF_FILE="audio.conf"
build_only: true
platform_allow: native_posix
extra_configs:
- CONFIG_BT_VCS=n
- CONFIG_BT_VCS_CLIENT=n
- CONFIG_BT_VCP=n
- CONFIG_BT_VCP_CLIENT=n
tags: bluetooth
bluetooth.shell.audio.vcs_client_no_aics_client:
bluetooth.shell.audio.vcp_client_no_aics_client:
extra_args: CONF_FILE="audio.conf"
build_only: true
platform_allow: native_posix
extra_configs:
- CONFIG_BT_VCS_CLIENT_MAX_AICS_INST=0
- CONFIG_BT_VCP_CLIENT_MAX_AICS_INST=0
tags: bluetooth
bluetooth.shell.audio.vcs_client_no_vocs_client:
bluetooth.shell.audio.vcp_client_no_vocs_client:
extra_args: CONF_FILE="audio.conf"
build_only: true
platform_allow: native_posix
extra_configs:
- CONFIG_BT_VCS_CLIENT_MAX_VOCS_INST=0
- CONFIG_BT_VCP_CLIENT_MAX_VOCS_INST=0
tags: bluetooth
bluetooth.shell.audio.no_micp_mic_dev:
extra_args: CONF_FILE="audio.conf"