Bluetooth: Audio: Remove the bt_vcp_vocs API
Remove the bt_vcp_vocs API as it did the same as the bt_vocs API, and did not really any functionality. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
bfbb704c8e
commit
966c9f80e7
8 changed files with 24 additions and 253 deletions
|
@ -27,23 +27,6 @@
|
|||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(bt_vcp);
|
||||
|
||||
static bool valid_vocs_inst(struct bt_vcp *vcp, struct bt_vocs *vocs)
|
||||
{
|
||||
if (vocs == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_VCP)
|
||||
for (int i = 0; i < ARRAY_SIZE(vcp->srv.vocs_insts); i++) {
|
||||
if (vcp->srv.vocs_insts[i] == vocs) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BT_VCP */
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_VCP)
|
||||
|
||||
#define VOLUME_DOWN(current_vol) \
|
||||
|
@ -660,120 +643,3 @@ int bt_vcp_mute(struct bt_vcp *vcp)
|
|||
return -EOPNOTSUPP;
|
||||
#endif /* CONFIG_BT_VCP */
|
||||
}
|
||||
|
||||
int bt_vcp_vocs_state_get(struct bt_vcp *vcp, struct bt_vocs *inst)
|
||||
{
|
||||
CHECKIF(vcp == NULL) {
|
||||
LOG_DBG("NULL vcp instance");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_CLIENT_VOCS) &&
|
||||
bt_vcp_client_valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_state_get(inst);
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_VOCS) && valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_state_get(inst);
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
int bt_vcp_vocs_location_get(struct bt_vcp *vcp, struct bt_vocs *inst)
|
||||
{
|
||||
CHECKIF(vcp == NULL) {
|
||||
LOG_DBG("NULL vcp instance");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_CLIENT_VOCS) &&
|
||||
bt_vcp_client_valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_location_get(inst);
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_VOCS) && valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_location_get(inst);
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
int bt_vcp_vocs_location_set(struct bt_vcp *vcp, struct bt_vocs *inst,
|
||||
uint8_t location)
|
||||
{
|
||||
CHECKIF(vcp == NULL) {
|
||||
LOG_DBG("NULL vcp instance");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_CLIENT_VOCS) &&
|
||||
bt_vcp_client_valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_location_set(inst, location);
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_VOCS) && valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_location_set(inst, location);
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
int bt_vcp_vocs_state_set(struct bt_vcp *vcp, struct bt_vocs *inst,
|
||||
int16_t offset)
|
||||
{
|
||||
CHECKIF(vcp == NULL) {
|
||||
LOG_DBG("NULL vcp instance");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_CLIENT_VOCS) &&
|
||||
bt_vcp_client_valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_state_set(inst, offset);
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_VOCS) && valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_state_set(inst, offset);
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
int bt_vcp_vocs_description_get(struct bt_vcp *vcp, struct bt_vocs *inst)
|
||||
{
|
||||
CHECKIF(vcp == NULL) {
|
||||
LOG_DBG("NULL vcp instance");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_CLIENT_VOCS) &&
|
||||
bt_vcp_client_valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_description_get(inst);
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_VOCS) && valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_description_get(inst);
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
int bt_vcp_vocs_description_set(struct bt_vcp *vcp, struct bt_vocs *inst,
|
||||
const char *description)
|
||||
{
|
||||
CHECKIF(vcp == NULL) {
|
||||
LOG_DBG("NULL vcp instance");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_CLIENT_VOCS) &&
|
||||
bt_vcp_client_valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_description_set(inst, description);
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_VCP_VOCS) && valid_vocs_inst(vcp, inst)) {
|
||||
return bt_vocs_description_set(inst, description);
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
|
|
@ -34,33 +34,6 @@ static struct bt_vcp_cb *vcp_client_cb;
|
|||
static struct bt_vcp vcp_insts[CONFIG_BT_MAX_CONN];
|
||||
static int vcp_client_common_vcs_cp(struct bt_vcp *vcp, uint8_t opcode);
|
||||
|
||||
bool bt_vcp_client_valid_vocs_inst(struct bt_vcp *vcp, struct bt_vocs *vocs)
|
||||
{
|
||||
if (vcp == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!vcp->client_instance) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (vcp->cli.conn == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (vocs == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(vcp->cli.vocs); i++) {
|
||||
if (vcp->cli.vocs[i] == vocs) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint8_t vcp_client_notify_handler(struct bt_conn *conn,
|
||||
struct bt_gatt_subscribe_params *params,
|
||||
const void *data, uint16_t length)
|
||||
|
|
|
@ -104,6 +104,4 @@ 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);
|
||||
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_VCP_INTERNAL_*/
|
||||
|
|
|
@ -392,7 +392,7 @@ static int cmd_vcs_vocs_state_get(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_state_get(NULL, vcp_included.vocs[index]);
|
||||
result = bt_vocs_state_get(vcp_included.vocs[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ static int cmd_vcs_vocs_location_get(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_location_get(NULL, vcp_included.vocs[index]);
|
||||
result = bt_vocs_location_get(vcp_included.vocs[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ static int cmd_vcs_vocs_location_set(const struct shell *sh, size_t argc,
|
|||
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_location_set(NULL, vcp_included.vocs[index],
|
||||
result = bt_vocs_location_set(vcp_included.vocs[index],
|
||||
location);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
@ -467,7 +467,7 @@ static int cmd_vcs_vocs_offset_set(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_state_set(NULL, vcp_included.vocs[index], offset);
|
||||
result = bt_vocs_state_set(vcp_included.vocs[index], offset);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ static int cmd_vcs_vocs_output_description_get(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_description_get(NULL, vcp_included.vocs[index]);
|
||||
result = bt_vocs_description_get(vcp_included.vocs[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ static int cmd_vcs_vocs_output_description_set(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_description_set(NULL, vcp_included.vocs[index],
|
||||
result = bt_vocs_description_set(vcp_included.vocs[index],
|
||||
description);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
|
|
@ -537,7 +537,7 @@ static int cmd_vcp_client_vocs_state_get(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_state_get(vcp, vcp_included.vocs[index]);
|
||||
result = bt_vocs_state_get(vcp_included.vocs[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ static int cmd_vcp_client_vocs_location_get(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_location_get(vcp, vcp_included.vocs[index]);
|
||||
result = bt_vocs_location_get(vcp_included.vocs[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ static int cmd_vcp_client_vocs_location_set(const struct shell *sh,
|
|||
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_location_set(vcp, vcp_included.vocs[index],
|
||||
result = bt_vocs_location_set(vcp_included.vocs[index],
|
||||
location);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
@ -628,7 +628,7 @@ static int cmd_vcp_client_vocs_offset_set(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_state_set(vcp, vcp_included.vocs[index],
|
||||
result = bt_vocs_state_set(vcp_included.vocs[index],
|
||||
offset);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
@ -654,7 +654,7 @@ static int cmd_vcp_client_vocs_output_description_get(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_description_get(vcp, vcp_included.vocs[index]);
|
||||
result = bt_vocs_description_get(vcp_included.vocs[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ static int cmd_vcp_client_vocs_output_description_set(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcp_vocs_description_set(vcp, vcp_included.vocs[index],
|
||||
result = bt_vocs_description_set(vcp_included.vocs[index],
|
||||
description);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue