summaryrefslogtreecommitdiff
path: root/tools/bluetooth-player.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-05-30 20:29:36 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-06-10 11:06:45 +0300
commit9948de8271385a5ffa84ff6dd4e2f019740bb587 (patch)
tree9c6640d445d352a17fc78f6a51b0ac895e57183b /tools/bluetooth-player.c
parent5f5953ebeedaad4311b9ca59eba1072ce6b4e3e1 (diff)
downloadbluez-9948de8271385a5ffa84ff6dd4e2f019740bb587.tar.gz
tools/bluetooth-player: Add previous command
Add support for next command which can be used to jump to the previous item
Diffstat (limited to 'tools/bluetooth-player.c')
-rw-r--r--tools/bluetooth-player.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/bluetooth-player.c b/tools/bluetooth-player.c
index d3f89dc72..b8c7e0648 100644
--- a/tools/bluetooth-player.c
+++ b/tools/bluetooth-player.c
@@ -202,6 +202,35 @@ static void cmd_next(int argc, char *argv[])
rl_printf("Attempting to jump to next\n");
}
+static void previous_reply(DBusMessage *message, void *user_data)
+{
+ DBusError error;
+
+ dbus_error_init(&error);
+
+ if (dbus_set_error_from_message(&error, message) == TRUE) {
+ rl_printf("Failed to jump to previous: %s\n", error.name);
+ dbus_error_free(&error);
+ return;
+ }
+
+ rl_printf("Previous successful\n");
+}
+
+static void cmd_previous(int argc, char *argv[])
+{
+ if (!check_default_player())
+ return;
+
+ if (g_dbus_proxy_method_call(default_player, "Previous", NULL,
+ previous_reply, NULL, NULL) == FALSE) {
+ rl_printf("Failed to jump to previous\n");
+ return;
+ }
+
+ rl_printf("Attempting to jump to previous\n");
+}
+
static const struct {
const char *cmd;
const char *arg;
@@ -212,6 +241,7 @@ static const struct {
{ "pause", NULL, cmd_pause, "Pause playback" },
{ "stop", NULL, cmd_stop, "Stop playback" },
{ "next", NULL, cmd_next, "Jump to next item" },
+ { "previous", NULL, cmd_previous, "Jump to previous item" },
{ "quit", NULL, cmd_quit, "Quit program" },
{ "exit", NULL, cmd_quit },
{ "help" },