diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-05-30 20:18:59 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-06-10 11:06:45 +0300 |
commit | 4d8386628abca63bc8b8273045bf7140f7cf63b6 (patch) | |
tree | 8ba30510b7fc782fe7208a19988e36e8fabfa75e /tools/bluetooth-player.c | |
parent | 49618d1f4d4efd78eeaa5a46aaa246c16a78abea (diff) | |
download | bluez-4d8386628abca63bc8b8273045bf7140f7cf63b6.tar.gz |
tools/bluetooth-player: Add stop command
Add support for stop command which can be used to stop the playback
Diffstat (limited to 'tools/bluetooth-player.c')
-rw-r--r-- | tools/bluetooth-player.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/bluetooth-player.c b/tools/bluetooth-player.c index 77cc9a881..1d7137a2c 100644 --- a/tools/bluetooth-player.c +++ b/tools/bluetooth-player.c @@ -144,6 +144,35 @@ static void cmd_pause(int argc, char *argv[]) rl_printf("Attempting to pause\n"); } +static void stop_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 stop: %s\n", error.name); + dbus_error_free(&error); + return; + } + + rl_printf("Stop successful\n"); +} + +static void cmd_stop(int argc, char *argv[]) +{ + if (!check_default_player()) + return; + + if (g_dbus_proxy_method_call(default_player, "Stop", NULL, stop_reply, + NULL, NULL) == FALSE) { + rl_printf("Failed to stop\n"); + return; + } + + rl_printf("Attempting to stop\n"); +} + static const struct { const char *cmd; const char *arg; @@ -152,6 +181,7 @@ static const struct { } cmd_table[] = { { "play", NULL, cmd_play, "Start playback" }, { "pause", NULL, cmd_pause, "Pause playback" }, + { "stop", NULL, cmd_stop, "Stop playback" }, { "quit", NULL, cmd_quit, "Quit program" }, { "exit", NULL, cmd_quit }, { "help" }, |