All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands
@ 2024-06-19 12:04 Yauhen Kharuzhy
  2024-06-19 12:04 ` [PATCH BlueZ v2 2/2] mcp: Implement Next Track and Previous Track commands Yauhen Kharuzhy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yauhen Kharuzhy @ 2024-06-19 12:04 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Yauhen Kharuzhy

Add bt_mcp_{next,previous}_track functions to shared MCP client
profile code. This allows user to have basic control of the media player
in addition to simple play/pause/stop actions.
---
 src/shared/mcp.c | 20 ++++++++++++++++++++
 src/shared/mcp.h |  2 ++
 2 files changed, 22 insertions(+)

diff --git a/src/shared/mcp.c b/src/shared/mcp.c
index b3726ebae..71fc2d151 100644
--- a/src/shared/mcp.c
+++ b/src/shared/mcp.c
@@ -628,6 +628,26 @@ unsigned int bt_mcp_stop(struct bt_mcp *mcp)
 	return mcp_send(mcp, BT_MCS_CMD_STOP);
 }
 
+unsigned int bt_mcp_next_track(struct bt_mcp *mcp)
+{
+	if (!(mcp->session.cp_op_supported & BT_MCS_CMD_NEXT_TRACK_SUPPORTED))
+		return -ENOTSUP;
+
+	DBG(mcp, "mcp %p", mcp);
+
+	return mcp_send(mcp, BT_MCS_CMD_NEXT_TRACK);
+}
+
+unsigned int bt_mcp_previous_track(struct bt_mcp *mcp)
+{
+	if (!(mcp->session.cp_op_supported & BT_MCS_CMD_PREV_TRACK_SUPPORTED))
+		return -ENOTSUP;
+
+	DBG(mcp, "mcp %p", mcp);
+
+	return mcp_send(mcp, BT_MCS_CMD_PREV_TRACK);
+}
+
 static void mcp_mp_set_player_name(struct bt_mcp *mcp, const uint8_t *value,
 					uint16_t length)
 {
diff --git a/src/shared/mcp.h b/src/shared/mcp.h
index a2cd6fc45..ee57ed4bf 100644
--- a/src/shared/mcp.h
+++ b/src/shared/mcp.h
@@ -59,3 +59,5 @@ void *bt_mcp_get_user_data(struct bt_mcp *mcp);
 unsigned int bt_mcp_play(struct bt_mcp *mcp);
 unsigned int bt_mcp_pause(struct bt_mcp *mcp);
 unsigned int bt_mcp_stop(struct bt_mcp *mcp);
+unsigned int bt_mcp_next_track(struct bt_mcp *mcp);
+unsigned int bt_mcp_previous_track(struct bt_mcp *mcp);
-- 
2.45.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-19 14:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-19 12:04 [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands Yauhen Kharuzhy
2024-06-19 12:04 ` [PATCH BlueZ v2 2/2] mcp: Implement Next Track and Previous Track commands Yauhen Kharuzhy
2024-06-19 14:10 ` [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands patchwork-bot+bluetooth
2024-06-19 14:23 ` [BlueZ,v2,1/2] " bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.