Bluetooth: Audio: Split vol_ctlr and vol_rend callback structure

Split the `bt_vcp_cb` struct into separate structure for
the volume controller and the volume renderer.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2022-10-10 12:59:00 +02:00 committed by Carles Cufí
commit c82af2885e
8 changed files with 177 additions and 89 deletions

View file

@ -71,7 +71,7 @@ struct bt_vcp_vol_ctlr {
struct bt_vcp_server {
struct vcs_state state;
uint8_t flags;
struct bt_vcp_cb *cb;
struct bt_vcp_vol_rend_cb *cb;
uint8_t volume_step;
struct bt_gatt_service *service_p;

View file

@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(bt_vcp_vol_ctlr, CONFIG_BT_VCP_VOL_CTLR_LOG_LEVEL);
#include "common/bt_str.h"
/* Callback functions */
static struct bt_vcp_cb *vcp_vol_ctlr_cb;
static struct bt_vcp_vol_ctlr_cb *vcp_vol_ctlr_cb;
static struct bt_vcp vcp_insts[CONFIG_BT_MAX_CONN];
static int vcp_vol_ctlr_common_vcs_cp(struct bt_vcp *vcp, uint8_t opcode);
@ -756,7 +756,7 @@ int bt_vcp_vol_ctlr_discover(struct bt_conn *conn, struct bt_vcp **vcp)
return err;
}
int bt_vcp_vol_ctlr_cb_register(struct bt_vcp_cb *cb)
int bt_vcp_vol_ctlr_cb_register(struct bt_vcp_vol_ctlr_cb *cb)
{
#if defined(CONFIG_BT_VCP_VOL_CTLR_VOCS)
struct bt_vocs_cb *vocs_cb = NULL;

View file

@ -284,7 +284,7 @@ static void vcs_vocs_description_cb(struct bt_vocs *inst, int err,
}
#endif /* CONFIG_BT_VCP_VOL_CTLR_MAX_VOCS_INST > 0 */
static struct bt_vcp_cb vcs_cbs = {
static struct bt_vcp_vol_ctlr_cb vcp_cbs = {
.discover = vcs_discover_cb,
.vol_down = vcs_vol_down_cb,
.vol_up = vcs_vol_up_cb,
@ -331,7 +331,7 @@ static int cmd_vcp_vol_ctlr_discover(const struct shell *sh, size_t argc,
ctx_shell = sh;
}
result = bt_vcp_vol_ctlr_cb_register(&vcs_cbs);
result = bt_vcp_vol_ctlr_cb_register(&vcp_cbs);
if (result != 0) {
shell_print(sh, "CB register failed: %d", result);
return result;

View file

@ -139,7 +139,7 @@ static void vocs_description_cb(struct bt_vocs *inst, int err,
}
}
static struct bt_vcp_cb vcp_vol_rend_cbs = {
static struct bt_vcp_vol_rend_cb vcp_vol_rend_cbs = {
.state = vcp_vol_rend_state_cb,
.flags = vcp_vol_rend_flags_cb,
};