From f36fd02d94902aa45722815fa16b3a4a0cef68a1 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 15 Aug 2013 17:21:42 +0300 Subject: [PATCH] tools/obexctl: Add select command Add support for select command which can be used to set the default session --- tools/obexctl.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/obexctl.c b/tools/obexctl.c index 1ff44c757..9080928cc 100644 --- a/tools/obexctl.c +++ b/tools/obexctl.c @@ -409,6 +409,28 @@ static void cmd_show(int argc, char *argv[]) print_property(proxy, "Target"); } +static void cmd_select(int argc, char *argv[]) +{ + GDBusProxy *proxy; + + if (argc < 2) { + rl_printf("Missing session address argument\n"); + return; + } + + proxy = find_session(argv[1]); + if (proxy == NULL) { + rl_printf("Session %s not available\n", argv[1]); + return; + } + + if (default_session == proxy) + return; + + default_session = proxy, + print_proxy(proxy, "Session", NULL); +} + static const struct { const char *cmd; const char *arg; @@ -419,6 +441,7 @@ static const struct { { "disconnect", "[session]", cmd_disconnect, "Disconnect session" }, { "list", NULL, cmd_list, "List available sessions" }, { "show", "[session]", cmd_show, "Session information" }, + { "select", "", cmd_select, "Select default session" }, { "quit", NULL, cmd_quit, "Quit program" }, { "exit", NULL, cmd_quit }, { "help" }, -- 2.47.3