public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Sathish Narasimman <sathish.narasimman@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: Sathish Narasimman <sathish.narasimman@intel.com>
Subject: [PATCH 3/3] profiles: Register callback function to update volume
Date: Sat,  1 Oct 2022 00:19:54 +0530	[thread overview]
Message-ID: <20220930184954.108937-3-sathish.narasimman@intel.com> (raw)
In-Reply-To: <20220930184954.108937-1-sathish.narasimman@intel.com>

Callback function has to be registered to call
media_transport_update_device_volume to change transport volume.
---
 profiles/audio/vcp.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/profiles/audio/vcp.c b/profiles/audio/vcp.c
index b42b0a4f79dd..4b790b03c032 100644
--- a/profiles/audio/vcp.c
+++ b/profiles/audio/vcp.c
@@ -50,6 +50,7 @@
 #include "src/service.h"
 #include "src/log.h"
 #include "src/error.h"
+#include "transport.h"
 
 #define VCS_UUID_STR "00001844-0000-1000-8000-00805f9b34fb"
 #define MEDIA_ENDPOINT_INTERFACE "org.bluez.MediaEndpoint1"
@@ -83,6 +84,20 @@ static struct vcp_data *vcp_data_new(struct btd_device *device)
 	return data;
 }
 
+static void vr_set_volume(struct bt_vcp *vcp, int8_t volume, void *data)
+{
+	struct vcp_data *user_data = data;
+	struct btd_device *device = user_data->device;
+
+	DBG("set volume");
+
+	media_transport_update_device_volume(device, volume);
+}
+
+static struct bt_vcp_vr_ops vcp_vr_ops = {
+	.set_volume	= vr_set_volume,
+};
+
 static void vcp_data_add(struct vcp_data *data)
 {
 	DBG("data %p", data);
@@ -94,6 +109,7 @@ static void vcp_data_add(struct vcp_data *data)
 
 	bt_vcp_set_debug(data->vcp, vcp_debug, NULL, NULL);
 
+	bt_vcp_vr_set_ops(data->vcp, &vcp_vr_ops, data);
 	if (!sessions)
 		sessions = queue_new();
 
@@ -178,6 +194,7 @@ static void vcp_attached(struct bt_vcp *vcp, void *user_data)
 	data->vcp = vcp;
 
 	vcp_data_add(data);
+
 }
 
 static int vcp_probe(struct btd_service *service)
-- 
2.25.1


  parent reply	other threads:[~2022-09-30  9:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30 18:49 [PATCH 1/3] audio/transport: seprate a2dp and bap transport to update volume Sathish Narasimman
2022-09-30 10:16 ` Message from the future (wrong date) (was: [PATCH 1/3] audio/transport: seprate a2dp and bap transport to update volume) Paul Menzel
2022-09-30 10:23   ` Sathish Narasimman
2022-09-30 11:24 ` [1/3] audio/transport: seprate a2dp and bap transport to update volume bluez.test.bot
2022-09-30 17:58 ` [PATCH 1/3] " Luiz Augusto von Dentz
2022-09-30 18:49 ` [PATCH 2/3] shared/vcp: Add callback to update media volume Sathish Narasimman
2022-09-30 18:49 ` Sathish Narasimman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-09-30 10:45 [PATCH 1/3] audio/transport: seperate a2dp and bap transport to update volume Sathish Narasimman
2022-09-30 10:45 ` [PATCH 3/3] profiles: Register callback function " Sathish Narasimman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220930184954.108937-3-sathish.narasimman@intel.com \
    --to=sathish.narasimman@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox