Re: [PATCH 2/3] audio/player: Add TotalNumberOfItems DBUS method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bharat,

On Wed, Jun 24, 2015 at 12:11 PM, Bharat Panda <bharat.panda@xxxxxxxxxxx> wrote:
> Adds support for TotalNumberOfItems DBUS method on
> org.bluez.MediaFolder1 interface.
> ---
>  profiles/audio/player.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/profiles/audio/player.c b/profiles/audio/player.c
> index b7f7b60..c8e10e1 100644
> --- a/profiles/audio/player.c
> +++ b/profiles/audio/player.c
> @@ -877,6 +877,30 @@ static DBusMessage *media_folder_list_items(DBusConnection *conn,
>         return NULL;
>  }
>
> +static DBusMessage *media_folder_total_items(DBusConnection *conn,
> +                                               DBusMessage *msg, void *data)
> +{
> +       struct media_player *mp = data;
> +       struct media_folder *folder = mp->scope;
> +       struct player_callback *cb = mp->cb;
> +       int err;
> +
> +       if (cb->cbs->list_items == NULL)
> +               return btd_error_not_supported(msg);
> +
> +       if (folder->msg != NULL)
> +               return btd_error_failed(msg, strerror(EBUSY));
> +
> +       err = cb->cbs->total_items(mp, folder->item->name,
> +                                                       cb->user_data);
> +       if (err < 0)
> +               return btd_error_failed(msg, strerror(-err));
> +
> +       folder->msg = dbus_message_ref(msg);
> +
> +       return NULL;
> +}
> +
>  static void media_item_free(struct media_item *item)
>  {
>         if (item->metadata != NULL)
> @@ -1091,6 +1115,10 @@ static const GDBusMethodTable media_folder_methods[] = {
>                         GDBUS_ARGS({ "filter", "a{sv}" }),
>                         GDBUS_ARGS({ "items", "a{oa{sv}}" }),
>                         media_folder_list_items) },
> +       { GDBUS_ASYNC_METHOD("TotalNumberOfItems",
> +                       NULL,
> +                       GDBUS_ARGS({ "totalitems", "u" }),
> +                       media_folder_total_items) },

This shall be updated via NumberOfItems property probably once you
switch folder/scope we can send the command to read the number of
items and update its property so no new API should be needed.

-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux