Bluetooth: Audio: Rename bt_vcs to bt_vcs_included
Rename the struct from bt_vcs to bt_vcs_included, and rename bt_vcs_get to bt_vcs_included_get as that is more descriptive of the value returned. Furthermore, this will also allow us to use bt_vcs as an opaque pointer to a VCS service instance (local or remote) to match the service instance pointers of AICS and VOCS. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
d52b4ac4bf
commit
6b2cc7e57e
8 changed files with 183 additions and 161 deletions
|
@ -52,13 +52,13 @@ struct bt_vcs_register_param {
|
|||
};
|
||||
|
||||
/**
|
||||
* @brief Volume Control Service service instance
|
||||
* @brief Volume Control Service included services
|
||||
*
|
||||
* Used for to represent a Volume Control Service instance, for either a client
|
||||
* or a server. The instance pointers either represent local server instances,
|
||||
* or remote service instances.
|
||||
* Used for to represent the Volume Control Service included service instances,
|
||||
* for either a client or a server. The instance pointers either represent
|
||||
* local server instances, or remote service instances.
|
||||
*/
|
||||
struct bt_vcs {
|
||||
struct bt_vcs_included {
|
||||
/** Number of Volume Offset Control Service instances */
|
||||
uint8_t vocs_cnt;
|
||||
/** Array of pointers to Volume Offset Control Service instances */
|
||||
|
@ -83,19 +83,19 @@ struct bt_vcs {
|
|||
int bt_vcs_register(struct bt_vcs_register_param *param);
|
||||
|
||||
/**
|
||||
* @brief Get Volume Control Service service pointer.
|
||||
* @brief Get Volume Control Service included services.
|
||||
*
|
||||
* Returns a pointer to a struct that contains information about the
|
||||
* Volume Control Service instance, such as pointers to the
|
||||
* Volume Control Service included service instances, such as pointers to the
|
||||
* Volume Offset Control Service (Volume Offset Control Service) or
|
||||
* Audio Input Control Service (AICS) instances.
|
||||
*
|
||||
* @param conn Connection to peer device, or NULL to get server value.
|
||||
* @param[out] service Pointer to store the result in.
|
||||
* @param[out] included Pointer to store the result in.
|
||||
*
|
||||
* @return 0 if success, errno on failure.
|
||||
*/
|
||||
int bt_vcs_get(struct bt_conn *conn, struct bt_vcs *service);
|
||||
int bt_vcs_included_get(struct bt_conn *conn, struct bt_vcs_included *included);
|
||||
|
||||
/**
|
||||
* @brief Callback function for bt_vcs_discover.
|
||||
|
|
|
@ -423,26 +423,26 @@ static bool valid_aics_inst(struct bt_aics *aics)
|
|||
return false;
|
||||
}
|
||||
|
||||
int bt_vcs_get(struct bt_conn *conn, struct bt_vcs *service)
|
||||
int bt_vcs_included_get(struct bt_conn *conn, struct bt_vcs_included *included)
|
||||
{
|
||||
if (conn != NULL) {
|
||||
if (IS_ENABLED(CONFIG_BT_VCS_CLIENT)) {
|
||||
return bt_vcs_client_get(conn, service);
|
||||
return bt_vcs_client_included_get(conn, included);
|
||||
} else {
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_VCS)
|
||||
if (service == NULL) {
|
||||
if (included == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
service->vocs_cnt = ARRAY_SIZE(vcs_inst.vocs_insts);
|
||||
service->vocs = vcs_inst.vocs_insts;
|
||||
included->vocs_cnt = ARRAY_SIZE(vcs_inst.vocs_insts);
|
||||
included->vocs = vcs_inst.vocs_insts;
|
||||
|
||||
service->aics_cnt = ARRAY_SIZE(vcs_inst.aics_insts);
|
||||
service->aics = vcs_inst.aics_insts;
|
||||
included->aics_cnt = ARRAY_SIZE(vcs_inst.aics_insts);
|
||||
included->aics = vcs_inst.aics_insts;
|
||||
|
||||
return 0;
|
||||
#else
|
||||
|
|
|
@ -835,12 +835,13 @@ int bt_vcs_client_cb_register(struct bt_vcs_cb *cb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_vcs_client_get(struct bt_conn *conn, struct bt_vcs *client)
|
||||
int bt_vcs_client_included_get(struct bt_conn *conn,
|
||||
struct bt_vcs_included *included)
|
||||
{
|
||||
uint8_t conn_index;
|
||||
struct vcs_instance *vcs_inst;
|
||||
|
||||
CHECKIF(!client || !conn) {
|
||||
CHECKIF(!included || !conn) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -848,11 +849,11 @@ int bt_vcs_client_get(struct bt_conn *conn, struct bt_vcs *client)
|
|||
|
||||
conn_index = bt_conn_index(conn);
|
||||
|
||||
client->vocs_cnt = vcs_inst->vocs_inst_cnt;
|
||||
client->vocs = vcs_insts[conn_index].vocs;
|
||||
included->vocs_cnt = vcs_inst->vocs_inst_cnt;
|
||||
included->vocs = vcs_insts[conn_index].vocs;
|
||||
|
||||
client->aics_cnt = vcs_inst->aics_inst_cnt;
|
||||
client->aics = vcs_insts[conn_index].aics;
|
||||
included->aics_cnt = vcs_inst->aics_inst_cnt;
|
||||
included->aics = vcs_insts[conn_index].aics;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ struct vcs_control_vol {
|
|||
uint8_t volume;
|
||||
} __packed;
|
||||
|
||||
int bt_vcs_client_get(struct bt_conn *conn, struct bt_vcs *client);
|
||||
int bt_vcs_client_included_get(struct bt_conn *conn,
|
||||
struct bt_vcs_included *included);
|
||||
int bt_vcs_client_read_vol_state(struct bt_conn *conn);
|
||||
int bt_vcs_client_read_flags(struct bt_conn *conn);
|
||||
int bt_vcs_client_vol_down(struct bt_conn *conn);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "bt.h"
|
||||
|
||||
static struct bt_vcs vcs;
|
||||
static struct bt_vcs_included vcs_included;
|
||||
|
||||
static void vcs_state_cb(struct bt_conn *conn, int err, uint8_t volume,
|
||||
uint8_t mute)
|
||||
|
@ -202,7 +202,11 @@ static int cmd_vcs_init(const struct shell *sh, size_t argc, char **argv)
|
|||
return result;
|
||||
}
|
||||
|
||||
bt_vcs_get(NULL, &vcs);
|
||||
result = bt_vcs_included_get(NULL, &vcs_included);
|
||||
if (result != 0) {
|
||||
shell_error(sh, "Failed to get included services: %d", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -356,7 +360,7 @@ static int cmd_vcs_vocs_state_get(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_vocs_state_get(NULL, vcs.vocs[index]);
|
||||
result = bt_vcs_vocs_state_get(NULL, vcs_included.vocs[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -376,7 +380,7 @@ static int cmd_vcs_vocs_location_get(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_vocs_location_get(NULL, vcs.vocs[index]);
|
||||
result = bt_vcs_vocs_location_get(NULL, vcs_included.vocs[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -403,7 +407,8 @@ static int cmd_vcs_vocs_location_set(const struct shell *sh, size_t argc,
|
|||
|
||||
}
|
||||
|
||||
result = bt_vcs_vocs_location_set(NULL, vcs.vocs[index], location);
|
||||
result = bt_vcs_vocs_location_set(NULL, vcs_included.vocs[index],
|
||||
location);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -430,7 +435,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.vocs[index], offset);
|
||||
result = bt_vcs_vocs_state_set(NULL, vcs_included.vocs[index], offset);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -450,7 +455,7 @@ static int cmd_vcs_vocs_output_description_get(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_vocs_description_get(NULL, vcs.vocs[index]);
|
||||
result = bt_vcs_vocs_description_get(NULL, vcs_included.vocs[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -471,7 +476,7 @@ static int cmd_vcs_vocs_output_description_set(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_vocs_description_set(NULL, vcs.vocs[index],
|
||||
result = bt_vcs_vocs_description_set(NULL, vcs_included.vocs[index],
|
||||
description);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
@ -486,13 +491,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.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_state_get(NULL, vcs.aics[index]);
|
||||
result = bt_vcs_aics_state_get(NULL, vcs_included.aics[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -506,13 +511,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.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_gain_setting_get(NULL, vcs.aics[index]);
|
||||
result = bt_vcs_aics_gain_setting_get(NULL, vcs_included.aics[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -526,13 +531,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.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_type_get(NULL, vcs.aics[index]);
|
||||
result = bt_vcs_aics_type_get(NULL, vcs_included.aics[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -546,13 +551,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.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_status_get(NULL, vcs.aics[index]);
|
||||
result = bt_vcs_aics_status_get(NULL, vcs_included.aics[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -566,13 +571,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.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_unmute(NULL, vcs.aics[index]);
|
||||
result = bt_vcs_aics_unmute(NULL, vcs_included.aics[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -586,13 +591,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.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_mute(NULL, vcs.aics[index]);
|
||||
result = bt_vcs_aics_mute(NULL, vcs_included.aics[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -606,13 +611,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.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_manual_gain_set(NULL, vcs.aics[index]);
|
||||
result = bt_vcs_aics_manual_gain_set(NULL, vcs_included.aics[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -626,13 +631,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.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_automatic_gain_set(NULL, vcs.aics[index]);
|
||||
result = bt_vcs_aics_automatic_gain_set(NULL, vcs_included.aics[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -647,9 +652,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.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
@ -659,7 +664,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.aics[index], gain);
|
||||
result = bt_vcs_aics_gain_set(NULL, vcs_included.aics[index], gain);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -673,13 +678,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.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_description_get(NULL, vcs.aics[index]);
|
||||
result = bt_vcs_aics_description_get(NULL, vcs_included.aics[index]);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -694,13 +699,14 @@ 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.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_description_set(NULL, vcs.aics[index], description);
|
||||
result = bt_vcs_aics_description_set(NULL, vcs_included.aics[index],
|
||||
description);
|
||||
if (result) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "bt.h"
|
||||
|
||||
static struct bt_vcs vcs;
|
||||
static struct bt_vcs_included vcs_included;
|
||||
|
||||
static void vcs_discover_cb(struct bt_conn *conn, int err, uint8_t vocs_count,
|
||||
uint8_t aics_count)
|
||||
|
@ -26,7 +26,7 @@ static void vcs_discover_cb(struct bt_conn *conn, int err, uint8_t vocs_count,
|
|||
shell_print(ctx_shell, "VCS discover done with %u AICS",
|
||||
aics_count);
|
||||
|
||||
if (bt_vcs_get(conn, &vcs)) {
|
||||
if (bt_vcs_included_get(conn, &vcs_included)) {
|
||||
shell_error(ctx_shell, "Could not get VCS context");
|
||||
}
|
||||
}
|
||||
|
@ -538,13 +538,13 @@ static int cmd_vcs_client_vocs_state_get(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.vocs_cnt) {
|
||||
if (index >= vcs_included.vocs_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.vocs_cnt, index);
|
||||
vcs_included.vocs_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_vocs_state_get(default_conn, vcs.vocs[index]);
|
||||
result = bt_vcs_vocs_state_get(default_conn, vcs_included.vocs[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -563,13 +563,14 @@ static int cmd_vcs_client_vocs_location_get(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.vocs_cnt) {
|
||||
if (index >= vcs_included.vocs_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.vocs_cnt, index);
|
||||
vcs_included.vocs_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_vocs_location_get(default_conn, vcs.vocs[index]);
|
||||
result = bt_vcs_vocs_location_get(default_conn,
|
||||
vcs_included.vocs[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -589,9 +590,9 @@ static int cmd_vcs_client_vocs_location_set(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.vocs_cnt) {
|
||||
if (index >= vcs_included.vocs_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.vocs_cnt, index);
|
||||
vcs_included.vocs_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
@ -602,7 +603,8 @@ static int cmd_vcs_client_vocs_location_set(const struct shell *sh,
|
|||
|
||||
}
|
||||
|
||||
result = bt_vcs_vocs_location_set(default_conn, vcs.vocs[index],
|
||||
result = bt_vcs_vocs_location_set(default_conn,
|
||||
vcs_included.vocs[index],
|
||||
location);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
@ -623,9 +625,9 @@ static int cmd_vcs_client_vocs_offset_set(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.vocs_cnt) {
|
||||
if (index >= vcs_included.vocs_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.vocs_cnt, index);
|
||||
vcs_included.vocs_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
@ -635,7 +637,9 @@ static int cmd_vcs_client_vocs_offset_set(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_vocs_state_set(default_conn, vcs.vocs[index], offset);
|
||||
result = bt_vcs_vocs_state_set(default_conn,
|
||||
vcs_included.vocs[index],
|
||||
offset);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -654,13 +658,14 @@ static int cmd_vcs_client_vocs_output_description_get(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.vocs_cnt) {
|
||||
if (index >= vcs_included.vocs_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.vocs_cnt, index);
|
||||
vcs_included.vocs_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_vocs_description_get(default_conn, vcs.vocs[index]);
|
||||
result = bt_vcs_vocs_description_get(default_conn,
|
||||
vcs_included.vocs[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -680,13 +685,14 @@ static int cmd_vcs_client_vocs_output_description_set(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.vocs_cnt) {
|
||||
if (index >= vcs_included.vocs_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.vocs_cnt, index);
|
||||
vcs_included.vocs_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_vocs_description_set(default_conn, vcs.vocs[index],
|
||||
result = bt_vcs_vocs_description_set(default_conn,
|
||||
vcs_included.vocs[index],
|
||||
description);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
@ -706,13 +712,13 @@ static int cmd_vcs_client_aics_input_state_get(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_state_get(default_conn, vcs.aics[index]);
|
||||
result = bt_vcs_aics_state_get(default_conn, vcs_included.aics[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -731,13 +737,14 @@ static int cmd_vcs_client_aics_gain_setting_get(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_gain_setting_get(default_conn, vcs.aics[index]);
|
||||
result = bt_vcs_aics_gain_setting_get(default_conn,
|
||||
vcs_included.aics[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -756,13 +763,13 @@ static int cmd_vcs_client_aics_input_type_get(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_type_get(default_conn, vcs.aics[index]);
|
||||
result = bt_vcs_aics_type_get(default_conn, vcs_included.aics[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -781,13 +788,13 @@ static int cmd_vcs_client_aics_input_status_get(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_status_get(default_conn, vcs.aics[index]);
|
||||
result = bt_vcs_aics_status_get(default_conn, vcs_included.aics[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -806,13 +813,13 @@ static int cmd_vcs_client_aics_input_unmute(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_unmute(default_conn, vcs.aics[index]);
|
||||
result = bt_vcs_aics_unmute(default_conn, vcs_included.aics[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -831,13 +838,13 @@ static int cmd_vcs_client_aics_input_mute(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_mute(default_conn, vcs.aics[index]);
|
||||
result = bt_vcs_aics_mute(default_conn, vcs_included.aics[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -856,13 +863,14 @@ static int cmd_vcs_client_aics_manual_input_gain_set(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_manual_gain_set(default_conn, vcs.aics[index]);
|
||||
result = bt_vcs_aics_manual_gain_set(default_conn,
|
||||
vcs_included.aics[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -881,13 +889,14 @@ static int cmd_vcs_client_aics_auto_input_gain_set(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_automatic_gain_set(default_conn, vcs.aics[index]);
|
||||
result = bt_vcs_aics_automatic_gain_set(default_conn,
|
||||
vcs_included.aics[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -907,9 +916,9 @@ static int cmd_vcs_client_aics_gain_set(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
@ -919,7 +928,8 @@ static int cmd_vcs_client_aics_gain_set(const struct shell *sh, size_t argc,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_gain_set(default_conn, vcs.aics[index], gain);
|
||||
result = bt_vcs_aics_gain_set(default_conn,
|
||||
vcs_included.aics[index], gain);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -938,13 +948,14 @@ static int cmd_vcs_client_aics_input_description_get(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_description_get(default_conn, vcs.aics[index]);
|
||||
result = bt_vcs_aics_description_get(default_conn,
|
||||
vcs_included.aics[index]);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
}
|
||||
|
@ -964,13 +975,14 @@ static int cmd_vcs_client_aics_input_description_set(const struct shell *sh,
|
|||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
if (index >= vcs.aics_cnt) {
|
||||
if (index >= vcs_included.aics_cnt) {
|
||||
shell_error(sh, "Index shall be less than %u, was %u",
|
||||
vcs.aics_cnt, index);
|
||||
vcs_included.aics_cnt, index);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
result = bt_vcs_aics_description_set(default_conn, vcs.aics[index],
|
||||
result = bt_vcs_aics_description_set(default_conn,
|
||||
vcs_included.aics[index],
|
||||
description);
|
||||
if (result != 0) {
|
||||
shell_print(sh, "Fail: %d", result);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
static struct bt_conn_cb conn_callbacks;
|
||||
extern enum bst_result_t bst_result;
|
||||
|
||||
static struct bt_vcs vcs;
|
||||
static struct bt_vcs_included vcs_included;
|
||||
static volatile bool g_bt_init;
|
||||
static volatile bool g_is_connected;
|
||||
static volatile bool g_mtu_exchanged;
|
||||
|
@ -312,7 +312,7 @@ static int test_aics(void)
|
|||
|
||||
printk("Getting AICS state\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_aics_state_get(g_conn, vcs.aics[0]);
|
||||
err = bt_vcs_aics_state_get(g_conn, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get AICS state (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -322,7 +322,7 @@ static int test_aics(void)
|
|||
|
||||
printk("Getting AICS gain setting\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_aics_gain_setting_get(g_conn, vcs.aics[0]);
|
||||
err = bt_vcs_aics_gain_setting_get(g_conn, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get AICS gain setting (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -333,7 +333,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(g_conn, vcs.aics[0]);
|
||||
err = bt_vcs_aics_type_get(g_conn, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get AICS input type (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -344,7 +344,7 @@ static int test_aics(void)
|
|||
|
||||
printk("Getting AICS status\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_aics_status_get(g_conn, vcs.aics[0]);
|
||||
err = bt_vcs_aics_status_get(g_conn, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get AICS status (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -354,7 +354,7 @@ static int test_aics(void)
|
|||
|
||||
printk("Getting AICS description\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_aics_description_get(g_conn, vcs.aics[0]);
|
||||
err = bt_vcs_aics_description_get(g_conn, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get AICS description (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -365,7 +365,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(g_conn, vcs.aics[0]);
|
||||
err = bt_vcs_aics_mute(g_conn, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS mute (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -377,7 +377,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(g_conn, vcs.aics[0]);
|
||||
err = bt_vcs_aics_unmute(g_conn, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS unmute (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -389,7 +389,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(g_conn, vcs.aics[0]);
|
||||
err = bt_vcs_aics_automatic_gain_set(g_conn, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS auto mode (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -400,7 +400,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(g_conn, vcs.aics[0]);
|
||||
err = bt_vcs_aics_manual_gain_set(g_conn, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS manual mode (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -411,7 +411,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(g_conn, vcs.aics[0], expected_gain);
|
||||
err = bt_vcs_aics_gain_set(g_conn, vcs_included.aics[0], expected_gain);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS gain (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -424,7 +424,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(g_conn, vcs.aics[0],
|
||||
err = bt_vcs_aics_description_set(g_conn, vcs_included.aics[0],
|
||||
expected_aics_desc);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS Description (err %d)\n", err);
|
||||
|
@ -460,7 +460,7 @@ static int test_vocs(void)
|
|||
|
||||
printk("Getting VOCS state\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_vocs_state_get(g_conn, vcs.vocs[0]);
|
||||
err = bt_vcs_vocs_state_get(g_conn, vcs_included.vocs[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get VOCS state (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -470,7 +470,7 @@ static int test_vocs(void)
|
|||
|
||||
printk("Getting VOCS location\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_vocs_location_get(g_conn, vcs.vocs[0]);
|
||||
err = bt_vcs_vocs_location_get(g_conn, vcs_included.vocs[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get VOCS location (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -480,7 +480,7 @@ static int test_vocs(void)
|
|||
|
||||
printk("Getting VOCS description\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_vocs_description_get(g_conn, vcs.vocs[0]);
|
||||
err = bt_vcs_vocs_description_get(g_conn, vcs_included.vocs[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get VOCS description (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -491,7 +491,8 @@ 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(g_conn, vcs.vocs[0], expected_location);
|
||||
err = bt_vcs_vocs_location_set(g_conn, vcs_included.vocs[0],
|
||||
expected_location);
|
||||
if (err) {
|
||||
FAIL("Could not set VOCS location (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -502,7 +503,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(g_conn, vcs.vocs[0], expected_offset);
|
||||
err = bt_vcs_vocs_state_set(g_conn, vcs_included.vocs[0], expected_offset);
|
||||
if (err) {
|
||||
FAIL("Could not set VOCS state (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -515,7 +516,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(g_conn, vcs.vocs[0],
|
||||
err = bt_vcs_vocs_description_set(g_conn, vcs_included.vocs[0],
|
||||
expected_description);
|
||||
if (err) {
|
||||
FAIL("Could not set VOCS description (err %d)\n", err);
|
||||
|
@ -581,9 +582,9 @@ static void test_main(void)
|
|||
|
||||
WAIT_FOR(g_discovery_complete);
|
||||
|
||||
err = bt_vcs_get(g_conn, &vcs);
|
||||
err = bt_vcs_included_get(g_conn, &vcs_included);
|
||||
if (err) {
|
||||
FAIL("Failed to get VCS context (err %d)\n", err);
|
||||
FAIL("Failed to get VCS included services (err %d)\n", err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ 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 volatile uint8_t g_volume;
|
||||
static volatile uint8_t g_mute;
|
||||
|
@ -240,7 +240,7 @@ static int test_aics_standalone(void)
|
|||
|
||||
printk("Deactivating AICS\n");
|
||||
expected_aics_active = false;
|
||||
err = bt_vcs_aics_deactivate(vcs.aics[0]);
|
||||
err = bt_vcs_aics_deactivate(vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not deactivate AICS (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -250,7 +250,7 @@ static int test_aics_standalone(void)
|
|||
|
||||
printk("Activating AICS\n");
|
||||
expected_aics_active = true;
|
||||
err = bt_vcs_aics_activate(vcs.aics[0]);
|
||||
err = bt_vcs_aics_activate(vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not activate AICS (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -260,7 +260,7 @@ static int test_aics_standalone(void)
|
|||
|
||||
printk("Getting AICS state\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_aics_state_get(NULL, vcs.aics[0]);
|
||||
err = bt_vcs_aics_state_get(NULL, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get AICS state (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -270,7 +270,7 @@ static int test_aics_standalone(void)
|
|||
|
||||
printk("Getting AICS gain setting\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_aics_gain_setting_get(NULL, vcs.aics[0]);
|
||||
err = bt_vcs_aics_gain_setting_get(NULL, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get AICS gain setting (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -280,7 +280,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(NULL, vcs.aics[0]);
|
||||
err = bt_vcs_aics_type_get(NULL, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get AICS input type (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -291,7 +291,7 @@ static int test_aics_standalone(void)
|
|||
|
||||
printk("Getting AICS status\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_aics_status_get(NULL, vcs.aics[0]);
|
||||
err = bt_vcs_aics_status_get(NULL, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get AICS status (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -301,7 +301,7 @@ static int test_aics_standalone(void)
|
|||
|
||||
printk("Getting AICS description\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_aics_description_get(NULL, vcs.aics[0]);
|
||||
err = bt_vcs_aics_description_get(NULL, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get AICS description (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -311,7 +311,7 @@ static int test_aics_standalone(void)
|
|||
|
||||
printk("Setting AICS mute\n");
|
||||
expected_input_mute = BT_AICS_STATE_MUTED;
|
||||
err = bt_vcs_aics_mute(NULL, vcs.aics[0]);
|
||||
err = bt_vcs_aics_mute(NULL, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS mute (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -321,7 +321,7 @@ static int test_aics_standalone(void)
|
|||
|
||||
printk("Setting AICS unmute\n");
|
||||
expected_input_mute = BT_AICS_STATE_UNMUTED;
|
||||
err = bt_vcs_aics_unmute(NULL, vcs.aics[0]);
|
||||
err = bt_vcs_aics_unmute(NULL, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS unmute (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -331,7 +331,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(NULL, vcs.aics[0]);
|
||||
err = bt_vcs_aics_automatic_gain_set(NULL, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS auto mode (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -341,7 +341,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(NULL, vcs.aics[0]);
|
||||
err = bt_vcs_aics_manual_gain_set(NULL, vcs_included.aics[0]);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS manual mode (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -351,7 +351,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(NULL, vcs.aics[0], expected_gain);
|
||||
err = bt_vcs_aics_gain_set(NULL, vcs_included.aics[0], expected_gain);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS gain (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -364,7 +364,8 @@ 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(NULL, vcs.aics[0], expected_aics_desc);
|
||||
err = bt_vcs_aics_description_set(NULL, vcs_included.aics[0],
|
||||
expected_aics_desc);
|
||||
if (err) {
|
||||
FAIL("Could not set AICS Description (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -385,7 +386,7 @@ static int test_vocs_standalone(void)
|
|||
|
||||
printk("Getting VOCS state\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_vocs_state_get(NULL, vcs.vocs[0]);
|
||||
err = bt_vcs_vocs_state_get(NULL, vcs_included.vocs[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get VOCS state (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -395,7 +396,7 @@ static int test_vocs_standalone(void)
|
|||
|
||||
printk("Getting VOCS location\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_vocs_location_get(NULL, vcs.vocs[0]);
|
||||
err = bt_vcs_vocs_location_get(NULL, vcs_included.vocs[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get VOCS location (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -405,7 +406,7 @@ static int test_vocs_standalone(void)
|
|||
|
||||
printk("Getting VOCS description\n");
|
||||
g_cb = false;
|
||||
err = bt_vcs_vocs_description_get(NULL, vcs.vocs[0]);
|
||||
err = bt_vcs_vocs_description_get(NULL, vcs_included.vocs[0]);
|
||||
if (err) {
|
||||
FAIL("Could not get VOCS description (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -415,7 +416,7 @@ static int test_vocs_standalone(void)
|
|||
|
||||
printk("Setting VOCS location\n");
|
||||
expected_location = g_vocs_location + 1;
|
||||
err = bt_vcs_vocs_location_set(NULL, vcs.vocs[0], expected_location);
|
||||
err = bt_vcs_vocs_location_set(NULL, vcs_included.vocs[0], expected_location);
|
||||
if (err) {
|
||||
FAIL("Could not set VOCS location (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -425,7 +426,7 @@ static int test_vocs_standalone(void)
|
|||
|
||||
printk("Setting VOCS state\n");
|
||||
expected_offset = g_vocs_offset + 1;
|
||||
err = bt_vcs_vocs_state_set(NULL, vcs.vocs[0], expected_offset);
|
||||
err = bt_vcs_vocs_state_set(NULL, vcs_included.vocs[0], expected_offset);
|
||||
if (err) {
|
||||
FAIL("Could not set VOCS state (err %d)\n", err);
|
||||
return err;
|
||||
|
@ -438,7 +439,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(NULL, vcs.vocs[0],
|
||||
err = bt_vcs_vocs_description_set(NULL, vcs_included.vocs[0],
|
||||
expected_description);
|
||||
if (err) {
|
||||
FAIL("Could not set VOCS description (err %d)\n", err);
|
||||
|
@ -502,9 +503,9 @@ static void test_standalone(void)
|
|||
return;
|
||||
}
|
||||
|
||||
err = bt_vcs_get(NULL, &vcs);
|
||||
err = bt_vcs_included_get(NULL, &vcs_included);
|
||||
if (err) {
|
||||
FAIL("VCS get failed (err %d)\n", err);
|
||||
FAIL("VCS included get failed (err %d)\n", err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -697,9 +698,9 @@ static void test_main(void)
|
|||
|
||||
bt_conn_cb_register(&conn_callbacks);
|
||||
|
||||
err = bt_vcs_get(NULL, &vcs);
|
||||
err = bt_vcs_included_get(NULL, &vcs_included);
|
||||
if (err) {
|
||||
FAIL("VCS get failed (err %d)\n", err);
|
||||
FAIL("VCS included get failed (err %d)\n", err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue