Message ID | 20240607121522.1255175-1-yauhen.kharuzhy@softeq.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [BlueZ] mcp: Implement Next Track and Previous Track commands | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | success | CheckPatch PASS |
tedd_an/GitLint | success | Gitlint PASS |
tedd_an/BuildEll | success | Build ELL PASS |
tedd_an/BluezMake | success | Bluez Make PASS |
tedd_an/MakeCheck | success | Bluez Make Check PASS |
tedd_an/MakeDistcheck | success | Make Distcheck PASS |
tedd_an/CheckValgrind | success | Check Valgrind PASS |
tedd_an/CheckSmatch | success | CheckSparse PASS |
tedd_an/bluezmakeextell | success | Make External ELL PASS |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
tedd_an/ScanBuild | success | Scan Build PASS |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=859921 ---Test result--- Test Summary: CheckPatch PASS 0.30 seconds GitLint PASS 0.22 seconds BuildEll PASS 24.15 seconds BluezMake PASS 1589.51 seconds MakeCheck PASS 12.62 seconds MakeDistcheck PASS 170.33 seconds CheckValgrind PASS 243.43 seconds CheckSmatch PASS 342.97 seconds bluezmakeextell PASS 115.30 seconds IncrementalBuild PASS 1363.20 seconds ScanBuild PASS 950.36 seconds --- Regards, Linux Bluetooth
Hi Yauhen, On Fri, Jun 7, 2024 at 8:15 AM Yauhen Kharuzhy <yauhen.kharuzhy@softeq.com> wrote: > > Add implementation of Next/Previous Track commands to audio/mcp profile > and shared/mcp.{c,h} code. > --- > profiles/audio/mcp.c | 18 ++++++++++++++++-- > src/shared/mcp.c | 20 ++++++++++++++++++++ > src/shared/mcp.h | 2 ++ Please have the changes to src/shared split from other changes, they have different licenses and shared may actually be subject to unit testing. > 3 files changed, 38 insertions(+), 2 deletions(-) > > diff --git a/profiles/audio/mcp.c b/profiles/audio/mcp.c > index b410b3d2a..8d1b7588e 100644 > --- a/profiles/audio/mcp.c > +++ b/profiles/audio/mcp.c > @@ -224,13 +224,27 @@ static int ct_stop(struct media_player *mp, void *user_data) > return bt_mcp_stop(mcp); > } > > +static int ct_next(struct media_player *mp, void *user_data) > +{ > + struct bt_mcp *mcp = user_data; > + > + return bt_mcp_next_track(mcp); > +} > + > +static int ct_previous(struct media_player *mp, void *user_data) > +{ > + struct bt_mcp *mcp = user_data; > + > + return bt_mcp_previous_track(mcp); > +} > + > static const struct media_player_callback ct_cbs = { > .set_setting = NULL, > .play = &ct_play, > .pause = &ct_pause, > .stop = &ct_stop, > - .next = NULL, > - .previous = NULL, > + .next = &ct_next, > + .previous = &ct_previous, > .fast_forward = NULL, > .rewind = NULL, > .press = NULL, > 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 > >
diff --git a/profiles/audio/mcp.c b/profiles/audio/mcp.c index b410b3d2a..8d1b7588e 100644 --- a/profiles/audio/mcp.c +++ b/profiles/audio/mcp.c @@ -224,13 +224,27 @@ static int ct_stop(struct media_player *mp, void *user_data) return bt_mcp_stop(mcp); } +static int ct_next(struct media_player *mp, void *user_data) +{ + struct bt_mcp *mcp = user_data; + + return bt_mcp_next_track(mcp); +} + +static int ct_previous(struct media_player *mp, void *user_data) +{ + struct bt_mcp *mcp = user_data; + + return bt_mcp_previous_track(mcp); +} + static const struct media_player_callback ct_cbs = { .set_setting = NULL, .play = &ct_play, .pause = &ct_pause, .stop = &ct_stop, - .next = NULL, - .previous = NULL, + .next = &ct_next, + .previous = &ct_previous, .fast_forward = NULL, .rewind = NULL, .press = NULL, 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);