* [PATCH BlueZ 1/2] audio/player: Use proper errors instead of using .Failed
@ 2014-03-13 13:32 Luiz Augusto von Dentz
2014-03-13 13:32 ` [PATCH BlueZ 2/2] doc/media-api: Include possible errors Luiz Augusto von Dentz
2014-03-13 16:06 ` [PATCH BlueZ 1/2] audio/player: Use proper errors instead of using .Failed Luiz Augusto von Dentz
0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2014-03-13 13:32 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
profiles/audio/player.c | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 2bd2d6e..c76352e 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -778,19 +778,16 @@ static DBusMessage *media_folder_search(DBusConnection *conn, DBusMessage *msg,
dbus_message_iter_init(msg, &iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return btd_error_failed(msg, strerror(EINVAL));
+ return btd_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &string);
- if (!mp->searchable || folder != mp->folder)
- return btd_error_failed(msg, strerror(ENOTSUP));
+ if (!mp->searchable || folder != mp->folder || !cb->cbs->search)
+ return btd_error_not_supported(msg);
if (folder->msg != NULL)
return btd_error_failed(msg, strerror(EINVAL));
- if (cb->cbs->search == NULL)
- return btd_error_failed(msg, strerror(ENOTSUP));
-
err = cb->cbs->search(mp, string, cb->user_data);
if (err < 0)
return btd_error_failed(msg, strerror(-err));
@@ -998,14 +995,14 @@ static DBusMessage *media_folder_change_folder(DBusConnection *conn,
if (!dbus_message_get_args(msg, NULL,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID))
- return btd_error_failed(msg, strerror(EINVAL));
+ return btd_error_invalid_args(msg);
if (folder->msg != NULL)
return btd_error_failed(msg, strerror(EBUSY));
folder = media_player_find_folder(mp, path);
if (folder == NULL)
- return btd_error_failed(msg, strerror(EINVAL));
+ return btd_error_invalid_args(msg);
if (mp->scope == folder)
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
@@ -1017,7 +1014,7 @@ static DBusMessage *media_folder_change_folder(DBusConnection *conn,
}
if (cb->cbs->change_folder == NULL)
- return btd_error_failed(msg, strerror(ENOTSUP));
+ return btd_error_not_supported(msg);
err = cb->cbs->change_folder(mp, folder->item->name, folder->item->uid,
cb->user_data);
@@ -1473,11 +1470,8 @@ static DBusMessage *media_item_play(DBusConnection *conn, DBusMessage *msg,
struct player_callback *cb = mp->cb;
int err;
- if (!item->playable)
- return btd_error_failed(msg, strerror(ENOTSUP));
-
- if (cb->cbs->play_item == NULL)
- return btd_error_failed(msg, strerror(ENOTSUP));
+ if (!item->playable || !cb->cbs->play_item)
+ return btd_error_not_supported(msg);
err = cb->cbs->play_item(mp, item->path, item->uid, cb->user_data);
if (err < 0)
@@ -1494,11 +1488,8 @@ static DBusMessage *media_item_add_to_nowplaying(DBusConnection *conn,
struct player_callback *cb = mp->cb;
int err;
- if (!item->playable)
- return btd_error_failed(msg, strerror(ENOTSUP));
-
- if (cb->cbs->play_item == NULL)
- return btd_error_failed(msg, strerror(ENOTSUP));
+ if (!item->playable || !cb->cbs->play_item)
+ return btd_error_not_supported(msg);
err = cb->cbs->add_to_nowplaying(mp, item->path, item->uid,
cb->user_data);
--
1.8.5.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH BlueZ 2/2] doc/media-api: Include possible errors
2014-03-13 13:32 [PATCH BlueZ 1/2] audio/player: Use proper errors instead of using .Failed Luiz Augusto von Dentz
@ 2014-03-13 13:32 ` Luiz Augusto von Dentz
2014-03-13 16:06 ` [PATCH BlueZ 1/2] audio/player: Use proper errors instead of using .Failed Luiz Augusto von Dentz
1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2014-03-13 13:32 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
doc/media-api.txt | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/doc/media-api.txt b/doc/media-api.txt
index 05f90e3..07ea991 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -128,32 +128,53 @@ Methods void Play()
Resume playback.
+ Possible Errors: org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
void Pause()
Pause playback.
+ Possible Errors: org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
void Stop()
Stop playback.
+ Possible Errors: org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
void Next()
Next item.
+ Possible Errors: org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
void Previous()
Previous item.
+ Possible Errors: org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
void FastForward()
Fast forward playback, this action is only stopped
when another method in this interface is called.
+ Possible Errors: org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
void Rewind()
Rewind playback, this action is only stopped
when another method in this interface is called.
+ Possible Errors: org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
Properties string Equalizer [readwrite]
Possible values: "off" or "on"
@@ -300,10 +321,17 @@ Methods object Search(string value, dict filter)
To list the items found use the folder object returned
and pass to ChangeFolder.
+ Possible Errors: org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
array{objects, properties} ListItems(dict filter)
Return a list of items found
+ Possible Errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
void ChangeFolder(object folder)
Change current folder.
@@ -313,6 +341,10 @@ Methods object Search(string value, dict filter)
exception is NowPlaying folder which should be always
present while the player is active.
+ Possible Errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
Properties uint32 NumberOfItems [readonly]
Number of items in the folder
@@ -368,10 +400,16 @@ Methods void Play()
Play item
+ Possible Errors: org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
void AddtoNowPlaying()
Add item to now playing list
+ Possible Errors: org.bluez.Error.NotSupported
+ org.bluez.Error.Failed
+
Properties object Player [readonly]
Player object path the item belongs to
--
1.8.5.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ 1/2] audio/player: Use proper errors instead of using .Failed
2014-03-13 13:32 [PATCH BlueZ 1/2] audio/player: Use proper errors instead of using .Failed Luiz Augusto von Dentz
2014-03-13 13:32 ` [PATCH BlueZ 2/2] doc/media-api: Include possible errors Luiz Augusto von Dentz
@ 2014-03-13 16:06 ` Luiz Augusto von Dentz
1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2014-03-13 16:06 UTC (permalink / raw)
To: linux-bluetooth
Hi,
On Thu, Mar 13, 2014 at 3:32 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> ---
> profiles/audio/player.c | 29 ++++++++++-------------------
> 1 file changed, 10 insertions(+), 19 deletions(-)
>
> diff --git a/profiles/audio/player.c b/profiles/audio/player.c
> index 2bd2d6e..c76352e 100644
> --- a/profiles/audio/player.c
> +++ b/profiles/audio/player.c
> @@ -778,19 +778,16 @@ static DBusMessage *media_folder_search(DBusConnection *conn, DBusMessage *msg,
> dbus_message_iter_init(msg, &iter);
>
> if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
> - return btd_error_failed(msg, strerror(EINVAL));
> + return btd_error_invalid_args(msg);
>
> dbus_message_iter_get_basic(&iter, &string);
>
> - if (!mp->searchable || folder != mp->folder)
> - return btd_error_failed(msg, strerror(ENOTSUP));
> + if (!mp->searchable || folder != mp->folder || !cb->cbs->search)
> + return btd_error_not_supported(msg);
>
> if (folder->msg != NULL)
> return btd_error_failed(msg, strerror(EINVAL));
>
> - if (cb->cbs->search == NULL)
> - return btd_error_failed(msg, strerror(ENOTSUP));
> -
> err = cb->cbs->search(mp, string, cb->user_data);
> if (err < 0)
> return btd_error_failed(msg, strerror(-err));
> @@ -998,14 +995,14 @@ static DBusMessage *media_folder_change_folder(DBusConnection *conn,
> if (!dbus_message_get_args(msg, NULL,
> DBUS_TYPE_OBJECT_PATH, &path,
> DBUS_TYPE_INVALID))
> - return btd_error_failed(msg, strerror(EINVAL));
> + return btd_error_invalid_args(msg);
>
> if (folder->msg != NULL)
> return btd_error_failed(msg, strerror(EBUSY));
>
> folder = media_player_find_folder(mp, path);
> if (folder == NULL)
> - return btd_error_failed(msg, strerror(EINVAL));
> + return btd_error_invalid_args(msg);
>
> if (mp->scope == folder)
> return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
> @@ -1017,7 +1014,7 @@ static DBusMessage *media_folder_change_folder(DBusConnection *conn,
> }
>
> if (cb->cbs->change_folder == NULL)
> - return btd_error_failed(msg, strerror(ENOTSUP));
> + return btd_error_not_supported(msg);
>
> err = cb->cbs->change_folder(mp, folder->item->name, folder->item->uid,
> cb->user_data);
> @@ -1473,11 +1470,8 @@ static DBusMessage *media_item_play(DBusConnection *conn, DBusMessage *msg,
> struct player_callback *cb = mp->cb;
> int err;
>
> - if (!item->playable)
> - return btd_error_failed(msg, strerror(ENOTSUP));
> -
> - if (cb->cbs->play_item == NULL)
> - return btd_error_failed(msg, strerror(ENOTSUP));
> + if (!item->playable || !cb->cbs->play_item)
> + return btd_error_not_supported(msg);
>
> err = cb->cbs->play_item(mp, item->path, item->uid, cb->user_data);
> if (err < 0)
> @@ -1494,11 +1488,8 @@ static DBusMessage *media_item_add_to_nowplaying(DBusConnection *conn,
> struct player_callback *cb = mp->cb;
> int err;
>
> - if (!item->playable)
> - return btd_error_failed(msg, strerror(ENOTSUP));
> -
> - if (cb->cbs->play_item == NULL)
> - return btd_error_failed(msg, strerror(ENOTSUP));
> + if (!item->playable || !cb->cbs->play_item)
> + return btd_error_not_supported(msg);
>
> err = cb->cbs->add_to_nowplaying(mp, item->path, item->uid,
> cb->user_data);
> --
> 1.8.5.3
Pushed.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-13 16:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-13 13:32 [PATCH BlueZ 1/2] audio/player: Use proper errors instead of using .Failed Luiz Augusto von Dentz
2014-03-13 13:32 ` [PATCH BlueZ 2/2] doc/media-api: Include possible errors Luiz Augusto von Dentz
2014-03-13 16:06 ` [PATCH BlueZ 1/2] audio/player: Use proper errors instead of using .Failed Luiz Augusto von Dentz
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.