From 2b56db8e550e3e0ee8a855fb9a8ac86c36b8d56a Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 15 Aug 2013 18:06:04 +0300 Subject: [PATCH] tools/obexctl: Add info command Add support for info command which can be used to print transfer information --- tools/obexctl.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tools/obexctl.c b/tools/obexctl.c index 9080928cc..ee8e9d83f 100644 --- a/tools/obexctl.c +++ b/tools/obexctl.c @@ -431,6 +431,47 @@ static void cmd_select(int argc, char *argv[]) print_proxy(proxy, "Session", NULL); } +static GDBusProxy *find_transfer(const char *path) +{ + GSList *l; + + for (l = transfers; l; l = g_slist_next(l)) { + GDBusProxy *proxy = l->data; + + if (strcmp(path, g_dbus_proxy_get_path(proxy)) == 0) + return proxy; + } + + return NULL; +} + +static void cmd_info(int argc, char *argv[]) +{ + GDBusProxy *proxy; + + if (argc < 2) { + rl_printf("Missing transfer address argument\n"); + return; + } + + proxy = find_transfer(argv[1]); + if (!proxy) { + rl_printf("Transfer %s not available\n", argv[1]); + return; + } + + rl_printf("Transfer %s\n", g_dbus_proxy_get_path(proxy)); + + print_property(proxy, "Session"); + print_property(proxy, "Name"); + print_property(proxy, "Type"); + print_property(proxy, "Status"); + print_property(proxy, "Time"); + print_property(proxy, "Size"); + print_property(proxy, "Transferred"); + print_property(proxy, "Filename"); +} + static const struct { const char *cmd; const char *arg; @@ -442,6 +483,7 @@ static const struct { { "list", NULL, cmd_list, "List available sessions" }, { "show", "[session]", cmd_show, "Session information" }, { "select", "", cmd_select, "Select default session" }, + { "info", "", cmd_info, "Transfer information" }, { "quit", NULL, cmd_quit, "Quit program" }, { "exit", NULL, cmd_quit }, { "help" }, -- 2.47.3