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:24:34 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-06-10 11:06:45 +0300
commit5f5953ebeedaad4311b9ca59eba1072ce6b4e3e1 (patch)
tree6d3299ff51438e002799a4c65f40502837c267ca /tools/bluetooth-player.c
parent4d8386628abca63bc8b8273045bf7140f7cf63b6 (diff)
downloadbluez-5f5953ebeedaad4311b9ca59eba1072ce6b4e3e1.tar.gz
tools/bluetooth-player: Add next command
Add support for next command which can be used to jump to the next 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 1d7137a2c..d3f89dc72 100644
--- a/tools/bluetooth-player.c
+++ b/tools/bluetooth-player.c
@@ -173,6 +173,35 @@ static void cmd_stop(int argc, char *argv[])
rl_printf("Attempting to stop\n");
}
+static void next_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 next: %s\n", error.name);
+ dbus_error_free(&error);
+ return;
+ }
+
+ rl_printf("Next successful\n");
+}
+
+static void cmd_next(int argc, char *argv[])
+{
+ if (!check_default_player())
+ return;
+
+ if (g_dbus_proxy_method_call(default_player, "Next", NULL, next_reply,
+ NULL, NULL) == FALSE) {
+ rl_printf("Failed to jump to next\n");
+ return;
+ }
+
+ rl_printf("Attempting to jump to next\n");
+}
+
static const struct {
const char *cmd;
const char *arg;
@@ -182,6 +211,7 @@ static const struct {
{ "play", NULL, cmd_play, "Start playback" },
{ "pause", NULL, cmd_pause, "Pause playback" },
{ "stop", NULL, cmd_stop, "Stop playback" },
+ { "next", NULL, cmd_next, "Jump to next item" },
{ "quit", NULL, cmd_quit, "Quit program" },
{ "exit", NULL, cmd_quit },
{ "help" },