diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-06-04 17:14:17 +0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-06-10 11:06:46 +0300 |
commit | d8763661991cad8c235e72f805acf4900d5d8d1d (patch) | |
tree | 7c021f6334f5e210077917eee1a496e0520c9ec4 /tools/bluetooth-player.c | |
parent | ad3acd58f8f2b324f07f59ceb2eda352eaf08eea (diff) | |
download | bluez-d8763661991cad8c235e72f805acf4900d5d8d1d.tar.gz |
tools/bluetooth-player: Add scan command
Add support for scan command which can be used to set scan mode.
Diffstat (limited to 'tools/bluetooth-player.c')
-rw-r--r-- | tools/bluetooth-player.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/bluetooth-player.c b/tools/bluetooth-player.c index 456617fcd..f5a743854 100644 --- a/tools/bluetooth-player.c +++ b/tools/bluetooth-player.c @@ -435,6 +435,38 @@ static void cmd_shuffle(int argc, char *argv[]) rl_printf("Attempting to set shuffle\n"); } +static void cmd_scan(int argc, char *argv[]) +{ + char *value; + DBusMessageIter iter; + + if (!check_default_player()) + return; + + if (argc < 2) { + rl_printf("Missing mode argument\n"); + return; + } + + if (!g_dbus_proxy_get_property(default_player, "Shuffle", &iter)) { + rl_printf("Operation not supported\n"); + return; + } + + value = g_strdup(argv[1]); + + if (g_dbus_proxy_set_property_basic(default_player, "Shuffle", + DBUS_TYPE_STRING, &value, + generic_callback, value, + g_free) == FALSE) { + rl_printf("Failed to set scan\n"); + g_free(value); + return; + } + + rl_printf("Attempting to set scan\n"); +} + static char *proxy_description(GDBusProxy *proxy, const char *title, const char *description) { @@ -892,6 +924,8 @@ static const struct { "Set repeat mode"}, { "shuffle", "<alltracks/group/off>", cmd_shuffle, "Set shuffle mode"}, + { "scan", "<alltracks/group/off>", cmd_scan, + "Set scan mode"}, { "change-folder", "<item>", cmd_change_folder, "Change current folder" }, { "list-items", "[start] [end]", cmd_list_items, |