Bluetooth: Audio: Specify bt_vcp_vol_rend API
The VCP server, known as the volume renderer, has a more explicity bt_vcp_vol_rend API naming scheme now. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
71bd487cc4
commit
7f69b866f0
17 changed files with 400 additions and 387 deletions
|
@ -16,7 +16,7 @@ if (CONFIG_BT_AICS OR CONFIG_BT_AICS_CLIENT)
|
|||
endif()
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_AICS_CLIENT aics_client.c)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_VCP vcp.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_VCP_VOL_REND vcp_vol_rend.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_BT_VCP_VOL_CTLR vcp_vol_ctlr.c)
|
||||
|
||||
if (CONFIG_BT_MICP_MIC_DEV)
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
# Bluetooth Audio - Call control configuration options
|
||||
# Bluetooth Audio - Volume Control Profile configuration options
|
||||
#
|
||||
# Copyright (c) 2020 Bose Corporation
|
||||
# Copyright (c) 2020-2021 Nordic Semiconductor ASA
|
||||
# Copyright (c) 2020-2022 Nordic Semiconductor ASA
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##################### Volume Control Service #####################
|
||||
################### Volume Control Profile Volume Renderer ###################
|
||||
|
||||
config BT_VCP
|
||||
bool "Volume Control Profile Support [EXPERIMENTAL]"
|
||||
config BT_VCP_VOL_REND
|
||||
bool "Volume Control Profile Volume Renderer Support [EXPERIMENTAL]"
|
||||
select EXPERIMENTAL
|
||||
help
|
||||
This option enables support for Volume Control Service.
|
||||
This option enables support for Volume Control Profile Volume Renderer
|
||||
role and the Volume Control Service.
|
||||
|
||||
if BT_VCP
|
||||
config BT_VCP_VOCS_INSTANCE_COUNT
|
||||
if BT_VCP_VOL_REND
|
||||
config BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT
|
||||
int "Volume Offset Control Service instance count"
|
||||
default 0
|
||||
range 0 BT_VOCS_MAX_INSTANCE_COUNT
|
||||
|
@ -23,14 +24,14 @@ config BT_VCP_VOCS_INSTANCE_COUNT
|
|||
This option sets the number of instances of Volume Offset Control
|
||||
Services.
|
||||
|
||||
config BT_VCP_VOCS
|
||||
config BT_VCP_VOL_REND_VOCS
|
||||
bool # Hidden
|
||||
default y if BT_VCP_VOCS_INSTANCE_COUNT > 0
|
||||
default y if BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT > 0
|
||||
help
|
||||
This hidden option makes it possible to easily check if VOCS is
|
||||
enabled for VCS.
|
||||
|
||||
config BT_VCP_AICS_INSTANCE_COUNT
|
||||
config BT_VCP_VOL_REND_AICS_INSTANCE_COUNT
|
||||
int "Audio Input Control Service instance count for VCS"
|
||||
default 0
|
||||
range 0 BT_AICS_MAX_INSTANCE_COUNT
|
||||
|
@ -38,30 +39,30 @@ config BT_VCP_AICS_INSTANCE_COUNT
|
|||
This option sets the number of instances of Audio Input Control
|
||||
Services for VCS.
|
||||
|
||||
config BT_VCP_AICS
|
||||
config BT_VCP_VOL_REND_AICS
|
||||
bool # Hidden
|
||||
default y if BT_VCP_AICS_INSTANCE_COUNT > 0
|
||||
default y if BT_VCP_VOL_REND_AICS_INSTANCE_COUNT > 0
|
||||
help
|
||||
This hidden option makes it possible to easily check if AICS is
|
||||
enabled for VCS.
|
||||
|
||||
############# DEBUG #############
|
||||
|
||||
config BT_DEBUG_VCP
|
||||
bool "Volume Control Profile debug"
|
||||
config BT_DEBUG_VCP_VOL_REND
|
||||
bool "Volume Control Profile Volume Renderer debug"
|
||||
select DEPRECATED
|
||||
help
|
||||
Use this option to enable Volume Control Profile debug logs for the
|
||||
Bluetooth Audio functionality.
|
||||
|
||||
module = BT_VCS
|
||||
legacy-debug-sym = BT_DEBUG_VCP
|
||||
module-str = "Volume Control Profile"
|
||||
module = BT_VCP_VOL_REND
|
||||
legacy-debug-sym = BT_DEBUG_VCP_VOL_REND
|
||||
module-str = "Volume Control Profile Voluem Renderer"
|
||||
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
||||
|
||||
endif # BT_VCS
|
||||
endif # BT_VCP_VOL_REND
|
||||
|
||||
##################### Volume Control Profile Client #####################
|
||||
################### Volume Control Profile Volume Controller ###################
|
||||
|
||||
config BT_VCP_VOL_CTLR
|
||||
bool "Volume Control Profile Volume Controller Support [EXPERIMENTAL]"
|
||||
|
|
|
@ -67,7 +67,7 @@ struct bt_vcp_vol_ctlr {
|
|||
};
|
||||
#endif /* CONFIG_BT_VCP_VOL_CTLR */
|
||||
|
||||
#if defined(CONFIG_BT_VCP)
|
||||
#if defined(CONFIG_BT_VCP_VOL_REND)
|
||||
struct bt_vcp_server {
|
||||
struct vcs_state state;
|
||||
uint8_t flags;
|
||||
|
@ -75,18 +75,18 @@ struct bt_vcp_server {
|
|||
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];
|
||||
struct bt_vocs *vocs_insts[CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT];
|
||||
struct bt_aics *aics_insts[CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT];
|
||||
};
|
||||
#endif /* CONFIG_BT_VCP */
|
||||
#endif /* CONFIG_BT_VCP_VOL_REND */
|
||||
|
||||
/* Struct used as a common type for the api */
|
||||
struct bt_vcp {
|
||||
bool client_instance;
|
||||
union {
|
||||
#if defined(CONFIG_BT_VCP)
|
||||
#if defined(CONFIG_BT_VCP_VOL_REND)
|
||||
struct bt_vcp_server srv;
|
||||
#endif /* CONFIG_BT_VCP */
|
||||
#endif /* CONFIG_BT_VCP_VOL_REND */
|
||||
#if defined(CONFIG_BT_VCP_VOL_CTLR)
|
||||
struct bt_vcp_vol_ctlr cli;
|
||||
#endif /* CONFIG_BT_VCP_VOL_CTLR */
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
#include "audio_internal.h"
|
||||
#include "vcp_internal.h"
|
||||
|
||||
#define LOG_LEVEL CONFIG_BT_VCP_LOG_LEVEL
|
||||
#define LOG_LEVEL CONFIG_BT_VCP_VOL_REND_LOG_LEVEL
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(bt_vcp);
|
||||
LOG_MODULE_REGISTER(bt_vcp_vol_rend);
|
||||
|
||||
#define VOLUME_DOWN(current_vol) \
|
||||
((uint8_t)MAX(0, (int)current_vol - vcp_inst.srv.volume_step))
|
||||
|
@ -212,8 +212,8 @@ static ssize_t read_flags(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
|
||||
#define BT_VCS_DEFINITION \
|
||||
BT_GATT_PRIMARY_SERVICE(BT_UUID_VCS), \
|
||||
VOCS_INCLUDES(CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) \
|
||||
AICS_INCLUDES(CONFIG_BT_VCP_AICS_INSTANCE_COUNT) \
|
||||
VOCS_INCLUDES(CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT) \
|
||||
AICS_INCLUDES(CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT) \
|
||||
BT_AUDIO_CHRC(BT_UUID_VCS_STATE, \
|
||||
BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \
|
||||
BT_GATT_PERM_READ_ENCRYPT, \
|
||||
|
@ -232,7 +232,7 @@ static ssize_t read_flags(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
static struct bt_gatt_attr vcs_attrs[] = { BT_VCS_DEFINITION };
|
||||
static struct bt_gatt_service vcs_svc;
|
||||
|
||||
static int prepare_vocs_inst(struct bt_vcp_register_param *param)
|
||||
static int prepare_vocs_inst(struct bt_vcp_vol_rend_register_param *param)
|
||||
{
|
||||
int err;
|
||||
int j;
|
||||
|
@ -263,19 +263,19 @@ static int prepare_vocs_inst(struct bt_vcp_register_param *param)
|
|||
vcs_attrs[i].user_data = bt_vocs_svc_decl_get(vcp_inst.srv.vocs_insts[j]);
|
||||
j++;
|
||||
|
||||
if (j == CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
|
||||
if (j == CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__ASSERT(j == CONFIG_BT_VCP_VOCS_INSTANCE_COUNT,
|
||||
__ASSERT(j == CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT,
|
||||
"Invalid VOCS instance count");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int prepare_aics_inst(struct bt_vcp_register_param *param)
|
||||
static int prepare_aics_inst(struct bt_vcp_vol_rend_register_param *param)
|
||||
{
|
||||
int err;
|
||||
int j;
|
||||
|
@ -307,20 +307,21 @@ static int prepare_aics_inst(struct bt_vcp_register_param *param)
|
|||
|
||||
LOG_DBG("AICS P %p", vcs_attrs[i].user_data);
|
||||
|
||||
if (j == CONFIG_BT_VCP_AICS_INSTANCE_COUNT) {
|
||||
if (j == CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__ASSERT(j == CONFIG_BT_VCP_AICS_INSTANCE_COUNT,
|
||||
__ASSERT(j == CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT,
|
||||
"Invalid AICS instance count");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************** PUBLIC API ******************************/
|
||||
int bt_vcp_register(struct bt_vcp_register_param *param, struct bt_vcp **vcp)
|
||||
int bt_vcp_vol_rend_register(struct bt_vcp_vol_rend_register_param *param,
|
||||
struct bt_vcp **vcp)
|
||||
{
|
||||
static bool registered;
|
||||
int err;
|
||||
|
@ -347,7 +348,7 @@ int bt_vcp_register(struct bt_vcp_register_param *param, struct bt_vcp **vcp)
|
|||
|
||||
vcs_svc = (struct bt_gatt_service)BT_GATT_SERVICE(vcs_attrs);
|
||||
|
||||
if (CONFIG_BT_VCP_VOCS_INSTANCE_COUNT > 0) {
|
||||
if (CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT > 0) {
|
||||
err = prepare_vocs_inst(param);
|
||||
|
||||
if (err != 0) {
|
||||
|
@ -355,7 +356,7 @@ int bt_vcp_register(struct bt_vcp_register_param *param, struct bt_vcp **vcp)
|
|||
}
|
||||
}
|
||||
|
||||
if (CONFIG_BT_VCP_AICS_INSTANCE_COUNT > 0) {
|
||||
if (CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT > 0) {
|
||||
err = prepare_aics_inst(param);
|
||||
|
||||
if (err != 0) {
|
||||
|
@ -382,7 +383,7 @@ int bt_vcp_register(struct bt_vcp_register_param *param, struct bt_vcp **vcp)
|
|||
return err;
|
||||
}
|
||||
|
||||
int bt_vcp_included_get(struct bt_vcp *vcp, struct bt_vcp_included *included)
|
||||
int bt_vcp_vol_rend_included_get(struct bt_vcp *vcp, struct bt_vcp_included *included)
|
||||
{
|
||||
CHECKIF(vcp == NULL) {
|
||||
LOG_DBG("NULL vcp instance");
|
||||
|
@ -402,7 +403,7 @@ int bt_vcp_included_get(struct bt_vcp *vcp, struct bt_vcp_included *included)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_vcp_vol_step_set(uint8_t volume_step)
|
||||
int bt_vcp_vol_rend_set_step(uint8_t volume_step)
|
||||
{
|
||||
if (volume_step > 0) {
|
||||
vcp_inst.srv.volume_step = volume_step;
|
||||
|
@ -412,7 +413,7 @@ int bt_vcp_vol_step_set(uint8_t volume_step)
|
|||
}
|
||||
}
|
||||
|
||||
int bt_vcp_vol_get(struct bt_vcp *vcp)
|
||||
int bt_vcp_vol_rend_get_state(struct bt_vcp *vcp)
|
||||
{
|
||||
CHECKIF(vcp == NULL) {
|
||||
LOG_DBG("NULL vcp instance");
|
||||
|
@ -427,7 +428,7 @@ int bt_vcp_vol_get(struct bt_vcp *vcp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_vcp_flags_get(struct bt_vcp *vcp)
|
||||
int bt_vcp_vol_rend_get_flags(struct bt_vcp *vcp)
|
||||
{
|
||||
CHECKIF(vcp == NULL) {
|
||||
LOG_DBG("NULL vcp instance");
|
||||
|
@ -441,7 +442,7 @@ int bt_vcp_flags_get(struct bt_vcp *vcp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_vcp_vol_down(struct bt_vcp *vcp)
|
||||
int bt_vcp_vol_rend_vol_down(struct bt_vcp *vcp)
|
||||
{
|
||||
const struct vcs_control cp = {
|
||||
.opcode = BT_VCP_OPCODE_REL_VOL_DOWN,
|
||||
|
@ -459,7 +460,7 @@ int bt_vcp_vol_down(struct bt_vcp *vcp)
|
|||
return err > 0 ? 0 : err;
|
||||
}
|
||||
|
||||
int bt_vcp_vol_up(struct bt_vcp *vcp)
|
||||
int bt_vcp_vol_rend_vol_up(struct bt_vcp *vcp)
|
||||
{
|
||||
const struct vcs_control cp = {
|
||||
.opcode = BT_VCP_OPCODE_REL_VOL_UP,
|
||||
|
@ -477,7 +478,7 @@ int bt_vcp_vol_up(struct bt_vcp *vcp)
|
|||
return err > 0 ? 0 : err;
|
||||
}
|
||||
|
||||
int bt_vcp_unmute_vol_down(struct bt_vcp *vcp)
|
||||
int bt_vcp_vol_rend_unmute_vol_down(struct bt_vcp *vcp)
|
||||
{
|
||||
const struct vcs_control cp = {
|
||||
.opcode = BT_VCP_OPCODE_UNMUTE_REL_VOL_DOWN,
|
||||
|
@ -495,7 +496,7 @@ int bt_vcp_unmute_vol_down(struct bt_vcp *vcp)
|
|||
return err > 0 ? 0 : err;
|
||||
}
|
||||
|
||||
int bt_vcp_unmute_vol_up(struct bt_vcp *vcp)
|
||||
int bt_vcp_vol_rend_unmute_vol_up(struct bt_vcp *vcp)
|
||||
{
|
||||
const struct vcs_control cp = {
|
||||
.opcode = BT_VCP_OPCODE_UNMUTE_REL_VOL_UP,
|
||||
|
@ -513,7 +514,7 @@ int bt_vcp_unmute_vol_up(struct bt_vcp *vcp)
|
|||
return err > 0 ? 0 : err;
|
||||
}
|
||||
|
||||
int bt_vcp_vol_set(struct bt_vcp *vcp, uint8_t volume)
|
||||
int bt_vcp_vol_rend_set_vol(struct bt_vcp *vcp, uint8_t volume)
|
||||
{
|
||||
|
||||
const struct vcs_control_vol cp = {
|
||||
|
@ -535,7 +536,7 @@ int bt_vcp_vol_set(struct bt_vcp *vcp, uint8_t volume)
|
|||
return err > 0 ? 0 : err;
|
||||
}
|
||||
|
||||
int bt_vcp_unmute(struct bt_vcp *vcp)
|
||||
int bt_vcp_vol_rend_unmute(struct bt_vcp *vcp)
|
||||
{
|
||||
const struct vcs_control cp = {
|
||||
.opcode = BT_VCP_OPCODE_UNMUTE,
|
||||
|
@ -553,7 +554,7 @@ int bt_vcp_unmute(struct bt_vcp *vcp)
|
|||
return err > 0 ? 0 : err;
|
||||
}
|
||||
|
||||
int bt_vcp_mute(struct bt_vcp *vcp)
|
||||
int bt_vcp_vol_rend_mute(struct bt_vcp *vcp)
|
||||
{
|
||||
const struct vcs_control cp = {
|
||||
.opcode = BT_VCP_OPCODE_MUTE,
|
|
@ -26,8 +26,8 @@ zephyr_library_sources_ifdef(
|
|||
iso.c
|
||||
)
|
||||
zephyr_library_sources_ifdef(
|
||||
CONFIG_BT_VCP
|
||||
vcp.c
|
||||
CONFIG_BT_VCP_VOL_REND
|
||||
vcp_vol_rend.c
|
||||
)
|
||||
zephyr_library_sources_ifdef(
|
||||
CONFIG_BT_VCP_VOL_CTLR
|
||||
|
|
|
@ -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_VCP, (BT_UUID_16_ENCODE(BT_UUID_VCS_VAL),))
|
||||
IF_ENABLED(CONFIG_BT_VCP_VOL_REND, (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;
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
static struct bt_vcp *vcp;
|
||||
static struct bt_vcp_included vcp_included;
|
||||
|
||||
static void vcs_state_cb(struct bt_vcp *vcp, int err, uint8_t volume,
|
||||
uint8_t mute)
|
||||
static void vcp_vol_rend_state_cb(struct bt_vcp *vcp, int err, uint8_t volume,
|
||||
uint8_t mute)
|
||||
{
|
||||
if (err) {
|
||||
shell_error(ctx_shell, "VCP state get failed (%d)", err);
|
||||
|
@ -30,7 +30,7 @@ static void vcs_state_cb(struct bt_vcp *vcp, int err, uint8_t volume,
|
|||
}
|
||||
}
|
||||
|
||||
static void vcs_flags_cb(struct bt_vcp *vcp, int err, uint8_t flags)
|
||||
static void vcp_vol_rend_flags_cb(struct bt_vcp *vcp, int err, uint8_t flags)
|
||||
{
|
||||
if (err) {
|
||||
shell_error(ctx_shell, "VCP flags get failed (%d)", err);
|
||||
|
@ -139,9 +139,9 @@ static void vocs_description_cb(struct bt_vocs *inst, int err,
|
|||
}
|
||||
}
|
||||
|
||||
static struct bt_vcp_cb vcs_cbs = {
|
||||
.state = vcs_state_cb,
|
||||
.flags = vcs_flags_cb,
|
||||
static struct bt_vcp_cb vcp_vol_rend_cbs = {
|
||||
.state = vcp_vol_rend_state_cb,
|
||||
.flags = vcp_vol_rend_flags_cb,
|
||||
};
|
||||
|
||||
static struct bt_aics_cb aics_cbs = {
|
||||
|
@ -158,47 +158,48 @@ static struct bt_vocs_cb vocs_cbs = {
|
|||
.description = vocs_description_cb
|
||||
};
|
||||
|
||||
static int cmd_vcs_init(const struct shell *sh, size_t argc, char **argv)
|
||||
static int cmd_vcp_vol_rend_init(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result = 0;
|
||||
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];
|
||||
struct bt_vcp_vol_rend_register_param vcp_register_param;
|
||||
char input_desc[CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT][16];
|
||||
char output_desc[CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT][16];
|
||||
static const char assignment_operator[] = "=";
|
||||
|
||||
if (!ctx_shell) {
|
||||
ctx_shell = sh;
|
||||
}
|
||||
|
||||
memset(&vcs_param, 0, sizeof(vcs_param));
|
||||
memset(&vcp_register_param, 0, sizeof(vcp_register_param));
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(vcs_param.vocs_param); i++) {
|
||||
vcs_param.vocs_param[i].location_writable = true;
|
||||
vcs_param.vocs_param[i].desc_writable = true;
|
||||
for (int i = 0; i < ARRAY_SIZE(vcp_register_param.vocs_param); i++) {
|
||||
vcp_register_param.vocs_param[i].location_writable = true;
|
||||
vcp_register_param.vocs_param[i].desc_writable = true;
|
||||
snprintf(output_desc[i], sizeof(output_desc[i]),
|
||||
"Output %d", i + 1);
|
||||
vcs_param.vocs_param[i].output_desc = output_desc[i];
|
||||
vcs_param.vocs_param[i].cb = &vocs_cbs;
|
||||
vcp_register_param.vocs_param[i].output_desc = output_desc[i];
|
||||
vcp_register_param.vocs_param[i].cb = &vocs_cbs;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(vcs_param.aics_param); i++) {
|
||||
vcs_param.aics_param[i].desc_writable = true;
|
||||
for (int i = 0; i < ARRAY_SIZE(vcp_register_param.aics_param); i++) {
|
||||
vcp_register_param.aics_param[i].desc_writable = true;
|
||||
snprintf(input_desc[i], sizeof(input_desc[i]),
|
||||
"Input %d", i + 1);
|
||||
vcs_param.aics_param[i].description = input_desc[i];
|
||||
vcs_param.aics_param[i].type = BT_AICS_INPUT_TYPE_UNSPECIFIED;
|
||||
vcs_param.aics_param[i].status = true;
|
||||
vcs_param.aics_param[i].gain_mode = BT_AICS_MODE_MANUAL;
|
||||
vcs_param.aics_param[i].units = 1;
|
||||
vcs_param.aics_param[i].min_gain = -100;
|
||||
vcs_param.aics_param[i].max_gain = 100;
|
||||
vcs_param.aics_param[i].cb = &aics_cbs;
|
||||
vcp_register_param.aics_param[i].description = input_desc[i];
|
||||
vcp_register_param.aics_param[i].type = BT_AICS_INPUT_TYPE_UNSPECIFIED;
|
||||
vcp_register_param.aics_param[i].status = true;
|
||||
vcp_register_param.aics_param[i].gain_mode = BT_AICS_MODE_MANUAL;
|
||||
vcp_register_param.aics_param[i].units = 1;
|
||||
vcp_register_param.aics_param[i].min_gain = -100;
|
||||
vcp_register_param.aics_param[i].max_gain = 100;
|
||||
vcp_register_param.aics_param[i].cb = &aics_cbs;
|
||||
}
|
||||
|
||||
/* Default values */
|
||||
vcs_param.step = 1;
|
||||
vcs_param.mute = BT_VCP_STATE_UNMUTED;
|
||||
vcs_param.volume = 100;
|
||||
vcp_register_param.step = 1;
|
||||
vcp_register_param.mute = BT_VCP_STATE_UNMUTED;
|
||||
vcp_register_param.volume = 100;
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
const char *operator = strstr(argv[i], assignment_operator);
|
||||
|
@ -206,11 +207,11 @@ static int cmd_vcs_init(const struct shell *sh, size_t argc, char **argv)
|
|||
|
||||
if (kwarg) {
|
||||
if (!strncmp(argv[i], "step", 4)) {
|
||||
vcs_param.step = shell_strtoul(kwarg, 10, &result);
|
||||
vcp_register_param.step = shell_strtoul(kwarg, 10, &result);
|
||||
} else if (!strncmp(argv[i], "mute", 4)) {
|
||||
vcs_param.mute = shell_strtobool(kwarg, 10, &result);
|
||||
vcp_register_param.mute = shell_strtobool(kwarg, 10, &result);
|
||||
} else if (!strncmp(argv[i], "volume", 6)) {
|
||||
vcs_param.volume = shell_strtoul(kwarg, 10, &result);
|
||||
vcp_register_param.volume = shell_strtoul(kwarg, 10, &result);
|
||||
} else {
|
||||
shell_help(sh);
|
||||
return SHELL_CMD_HELP_PRINTED;
|
||||
|
@ -226,15 +227,15 @@ static int cmd_vcs_init(const struct shell *sh, size_t argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
vcs_param.cb = &vcs_cbs;
|
||||
vcp_register_param.cb = &vcp_vol_rend_cbs;
|
||||
|
||||
result = bt_vcp_register(&vcs_param, &vcp);
|
||||
result = bt_vcp_vol_rend_register(&vcp_register_param, &vcp);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
result = bt_vcp_included_get(vcp, &vcp_included);
|
||||
result = bt_vcp_vol_rend_included_get(vcp, &vcp_included);
|
||||
if (result != 0) {
|
||||
shell_error(sh, "Failed to get included services: %d", result);
|
||||
return result;
|
||||
|
@ -243,8 +244,8 @@ static int cmd_vcs_init(const struct shell *sh, size_t argc, char **argv)
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_volume_step(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_volume_step(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result;
|
||||
int step = strtol(argv[1], NULL, 0);
|
||||
|
@ -255,7 +256,7 @@ static int cmd_vcs_volume_step(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vol_step_set(step);
|
||||
result = bt_vcp_vol_rend_set_step(step);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -263,59 +264,10 @@ static int cmd_vcs_volume_step(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_state_get(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result = bt_vcp_vol_get(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_flags_get(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result = bt_vcp_flags_get(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_volume_down(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result = bt_vcp_vol_down(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_volume_up(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
|
||||
{
|
||||
int result = bt_vcp_vol_up(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_unmute_volume_down(const struct shell *sh, size_t argc,
|
||||
static int cmd_vcp_vol_rend_state_get(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result = bt_vcp_unmute_vol_down(vcp);
|
||||
int result = bt_vcp_vol_rend_get_state(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
@ -324,10 +276,10 @@ static int cmd_vcs_unmute_volume_down(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_unmute_volume_up(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_flags_get(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result = bt_vcp_unmute_vol_up(vcp);
|
||||
int result = bt_vcp_vol_rend_get_flags(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
@ -336,8 +288,57 @@ static int cmd_vcs_unmute_volume_up(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_volume_set(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_volume_down(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result = bt_vcp_vol_rend_vol_down(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcp_vol_rend_volume_up(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
|
||||
{
|
||||
int result = bt_vcp_vol_rend_vol_up(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcp_vol_rend_unmute_volume_down(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
int result = bt_vcp_vol_rend_unmute_vol_down(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcp_vol_rend_unmute_volume_up(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
int result = bt_vcp_vol_rend_unmute_vol_up(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcp_vol_rend_volume_set(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
|
||||
{
|
||||
int result;
|
||||
|
@ -348,7 +349,7 @@ static int cmd_vcs_volume_set(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vol_set(vcp, volume);
|
||||
result = bt_vcp_vol_rend_set_vol(vcp, volume);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -356,9 +357,10 @@ static int cmd_vcs_volume_set(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_unmute(const struct shell *sh, size_t argc, char **argv)
|
||||
static int cmd_vcp_vol_rend_unmute(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result = bt_vcp_unmute(vcp);
|
||||
int result = bt_vcp_vol_rend_unmute(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
@ -367,9 +369,10 @@ static int cmd_vcs_unmute(const struct shell *sh, size_t argc, char **argv)
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_mute(const struct shell *sh, size_t argc, char **argv)
|
||||
static int cmd_vcp_vol_rend_mute(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result = bt_vcp_mute(vcp);
|
||||
int result = bt_vcp_vol_rend_mute(vcp);
|
||||
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
@ -378,17 +381,17 @@ static int cmd_vcs_mute(const struct shell *sh, size_t argc, char **argv)
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_vocs_state_get(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_vocs_state_get(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
||||
/* TODO: For here, and the following VOCS and AICS, default index to 0 */
|
||||
|
||||
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
|
||||
if (index > CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT) {
|
||||
shell_error(sh, "Index out of range; 0-%u, was %u",
|
||||
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
|
||||
CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
@ -400,15 +403,15 @@ static int cmd_vcs_vocs_state_get(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_vocs_location_get(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_vocs_location_get(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
||||
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
|
||||
if (index > CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT) {
|
||||
shell_error(sh, "Index out of range; 0-%u, was %u",
|
||||
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
|
||||
CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
@ -420,16 +423,16 @@ static int cmd_vcs_vocs_location_get(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_vocs_location_set(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_vocs_location_set(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
int location = strtol(argv[2], NULL, 0);
|
||||
|
||||
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
|
||||
if (index > CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT) {
|
||||
shell_error(sh, "Index out of range; 0-%u, was %u",
|
||||
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
|
||||
CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
if (location > UINT16_MAX || location < 0) {
|
||||
|
@ -448,16 +451,16 @@ static int cmd_vcs_vocs_location_set(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_vocs_offset_set(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_vocs_offset_set(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
int offset = strtol(argv[2], NULL, 0);
|
||||
|
||||
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
|
||||
if (index > CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT) {
|
||||
shell_error(sh, "Index out of range; 0-%u, was %u",
|
||||
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
|
||||
CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
@ -475,15 +478,16 @@ static int cmd_vcs_vocs_offset_set(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_vocs_output_description_get(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
static int cmd_vcp_vol_rend_vocs_output_description_get(const struct shell *sh,
|
||||
size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
||||
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
|
||||
if (index > CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT) {
|
||||
shell_error(sh, "Index out of range; 0-%u, was %u",
|
||||
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
|
||||
CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
@ -495,16 +499,17 @@ static int cmd_vcs_vocs_output_description_get(const struct shell *sh,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_vocs_output_description_set(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
static int cmd_vcp_vol_rend_vocs_output_description_set(const struct shell *sh,
|
||||
size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
char *description = argv[2];
|
||||
|
||||
if (index > CONFIG_BT_VCP_VOCS_INSTANCE_COUNT) {
|
||||
if (index > CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT) {
|
||||
shell_error(sh, "Index out of range; 0-%u, was %u",
|
||||
CONFIG_BT_VCP_VOCS_INSTANCE_COUNT, index);
|
||||
CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
@ -517,8 +522,8 @@ static int cmd_vcs_vocs_output_description_set(const struct shell *sh,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_aics_input_state_get(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_aics_input_state_get(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
@ -537,8 +542,8 @@ static int cmd_vcs_aics_input_state_get(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_aics_gain_setting_get(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_aics_gain_setting_get(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
@ -557,8 +562,8 @@ static int cmd_vcs_aics_gain_setting_get(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_aics_input_type_get(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_aics_input_type_get(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
@ -577,8 +582,8 @@ static int cmd_vcs_aics_input_type_get(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_aics_input_status_get(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_aics_input_status_get(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
@ -597,8 +602,8 @@ static int cmd_vcs_aics_input_status_get(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_aics_input_unmute(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_aics_input_unmute(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
@ -617,8 +622,8 @@ static int cmd_vcs_aics_input_unmute(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_aics_input_mute(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_aics_input_mute(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
@ -637,8 +642,9 @@ static int cmd_vcs_aics_input_mute(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_aics_manual_input_gain_set(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
static int cmd_vcp_vol_rend_aics_manual_input_gain_set(const struct shell *sh,
|
||||
size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
@ -657,8 +663,9 @@ static int cmd_vcs_aics_manual_input_gain_set(const struct shell *sh,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_aics_automatic_input_gain_set(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
static int cmd_vcp_vol_rend_aics_auto_input_gain_set(const struct shell *sh,
|
||||
size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
@ -677,8 +684,8 @@ static int cmd_vcs_aics_automatic_input_gain_set(const struct shell *sh,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_aics_gain_set(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
static int cmd_vcp_vol_rend_aics_gain_set(const struct shell *sh, size_t argc,
|
||||
char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
@ -704,8 +711,8 @@ static int cmd_vcs_aics_gain_set(const struct shell *sh, size_t argc,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_aics_input_description_get(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
static int cmd_vcp_vol_rend_aics_input_description_get(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
@ -724,8 +731,8 @@ static int cmd_vcs_aics_input_description_get(const struct shell *sh,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs_aics_input_description_set(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
static int cmd_vcp_vol_rend_aics_input_description_set(const struct shell *sh,
|
||||
size_t argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
int index = strtol(argv[1], NULL, 0);
|
||||
|
@ -746,7 +753,7 @@ static int cmd_vcs_aics_input_description_set(const struct shell *sh,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cmd_vcs(const struct shell *sh, size_t argc, char **argv)
|
||||
static int cmd_vcp_vol_rend(const struct shell *sh, size_t argc, char **argv)
|
||||
{
|
||||
if (argc > 1) {
|
||||
shell_error(sh, "%s unknown parameter: %s",
|
||||
|
@ -758,104 +765,105 @@ static int cmd_vcs(const struct shell *sh, size_t argc, char **argv)
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
SHELL_STATIC_SUBCMD_SET_CREATE(vcs_cmds,
|
||||
SHELL_STATIC_SUBCMD_SET_CREATE(vcp_vol_rend_cmds,
|
||||
SHELL_CMD_ARG(init, NULL,
|
||||
"Initialize the service and register callbacks "
|
||||
"[step=<uint>] [mute=<bool>] [volume=<uint>]",
|
||||
cmd_vcs_init, 1, 3),
|
||||
cmd_vcp_vol_rend_init, 1, 3),
|
||||
SHELL_CMD_ARG(state_get, NULL,
|
||||
"Get volume state of the VCP server. Should be done "
|
||||
"before sending any control messages",
|
||||
cmd_vcs_state_get, 1, 0),
|
||||
cmd_vcp_vol_rend_state_get, 1, 0),
|
||||
SHELL_CMD_ARG(flags_get, NULL,
|
||||
"Read volume flags",
|
||||
cmd_vcs_flags_get, 1, 0),
|
||||
cmd_vcp_vol_rend_flags_get, 1, 0),
|
||||
SHELL_CMD_ARG(volume_down, NULL,
|
||||
"Turn the volume down",
|
||||
cmd_vcs_volume_down, 1, 0),
|
||||
cmd_vcp_vol_rend_volume_down, 1, 0),
|
||||
SHELL_CMD_ARG(volume_up, NULL,
|
||||
"Turn the volume up",
|
||||
cmd_vcs_volume_up, 1, 0),
|
||||
cmd_vcp_vol_rend_volume_up, 1, 0),
|
||||
SHELL_CMD_ARG(unmute_volume_down, NULL,
|
||||
"Turn the volume down, and unmute",
|
||||
cmd_vcs_unmute_volume_down, 1, 0),
|
||||
cmd_vcp_vol_rend_unmute_volume_down, 1, 0),
|
||||
SHELL_CMD_ARG(unmute_volume_up, NULL,
|
||||
"Turn the volume up, and unmute",
|
||||
cmd_vcs_unmute_volume_up, 1, 0),
|
||||
cmd_vcp_vol_rend_unmute_volume_up, 1, 0),
|
||||
SHELL_CMD_ARG(volume_set, NULL,
|
||||
"Set an absolute volume <volume>",
|
||||
cmd_vcs_volume_set, 2, 0),
|
||||
cmd_vcp_vol_rend_volume_set, 2, 0),
|
||||
SHELL_CMD_ARG(unmute, NULL,
|
||||
"Unmute",
|
||||
cmd_vcs_unmute, 1, 0),
|
||||
cmd_vcp_vol_rend_unmute, 1, 0),
|
||||
SHELL_CMD_ARG(mute, NULL,
|
||||
"Mute",
|
||||
cmd_vcs_mute, 1, 0),
|
||||
cmd_vcp_vol_rend_mute, 1, 0),
|
||||
SHELL_CMD_ARG(step, NULL,
|
||||
"Set step size",
|
||||
cmd_vcs_volume_step, 2, 0),
|
||||
cmd_vcp_vol_rend_volume_step, 2, 0),
|
||||
SHELL_CMD_ARG(vocs_state_get, NULL,
|
||||
"Get the offset state of a VOCS instance <inst_index>",
|
||||
cmd_vcs_vocs_state_get, 2, 0),
|
||||
cmd_vcp_vol_rend_vocs_state_get, 2, 0),
|
||||
SHELL_CMD_ARG(vocs_location_get, NULL,
|
||||
"Get the location of a VOCS instance <inst_index>",
|
||||
cmd_vcs_vocs_location_get, 2, 0),
|
||||
cmd_vcp_vol_rend_vocs_location_get, 2, 0),
|
||||
SHELL_CMD_ARG(vocs_location_set, NULL,
|
||||
"Set the location of a VOCS instance <inst_index> "
|
||||
"<location>",
|
||||
cmd_vcs_vocs_location_set, 3, 0),
|
||||
cmd_vcp_vol_rend_vocs_location_set, 3, 0),
|
||||
SHELL_CMD_ARG(vocs_offset_set, NULL,
|
||||
"Set the offset for a VOCS instance <inst_index> "
|
||||
"<offset>",
|
||||
cmd_vcs_vocs_offset_set, 3, 0),
|
||||
cmd_vcp_vol_rend_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_vocs_output_description_get, 2, 0),
|
||||
cmd_vcp_vol_rend_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_vocs_output_description_set, 3, 0),
|
||||
cmd_vcp_vol_rend_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_aics_input_state_get, 2, 0),
|
||||
cmd_vcp_vol_rend_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_aics_gain_setting_get, 2, 0),
|
||||
cmd_vcp_vol_rend_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_aics_input_type_get, 2, 0),
|
||||
cmd_vcp_vol_rend_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_aics_input_status_get, 2, 0),
|
||||
cmd_vcp_vol_rend_aics_input_status_get, 2, 0),
|
||||
SHELL_CMD_ARG(aics_input_unmute, NULL,
|
||||
"Unmute the input of a AICS instance <inst_index>",
|
||||
cmd_vcs_aics_input_unmute, 2, 0),
|
||||
cmd_vcp_vol_rend_aics_input_unmute, 2, 0),
|
||||
SHELL_CMD_ARG(aics_input_mute, NULL,
|
||||
"Mute the input of a AICS instance <inst_index>",
|
||||
cmd_vcs_aics_input_mute, 2, 0),
|
||||
cmd_vcp_vol_rend_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_aics_manual_input_gain_set, 2, 0),
|
||||
cmd_vcp_vol_rend_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_aics_automatic_input_gain_set, 2, 0),
|
||||
cmd_vcp_vol_rend_aics_auto_input_gain_set, 2, 0),
|
||||
SHELL_CMD_ARG(aics_gain_set, NULL,
|
||||
"Set the gain in dB of a AICS instance <inst_index> "
|
||||
"<gain (-128 to 127)>",
|
||||
cmd_vcs_aics_gain_set, 3, 0),
|
||||
cmd_vcp_vol_rend_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_aics_input_description_get, 2, 0),
|
||||
cmd_vcp_vol_rend_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_aics_input_description_set, 3, 0),
|
||||
cmd_vcp_vol_rend_aics_input_description_set, 3, 0),
|
||||
SHELL_SUBCMD_SET_END
|
||||
);
|
||||
|
||||
SHELL_CMD_ARG_REGISTER(vcp, &vcs_cmds, "Bluetooth VCP shell commands",
|
||||
cmd_vcs, 1, 1);
|
||||
SHELL_CMD_ARG_REGISTER(vcp_vol_rend, &vcp_vol_rend_cmds,
|
||||
"Bluetooth VCP Volume Renderer shell commands",
|
||||
cmd_vcp_vol_rend, 1, 1);
|
Loading…
Add table
Add a link
Reference in a new issue