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