summaryrefslogtreecommitdiff
path: root/tools/obexctl.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-02-08 15:32:01 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-02-20 12:45:59 +0200
commit7cbdb40a8838466055d47b6bd76749ca7e3c0e11 (patch)
treef4140c5a8f1f81573d52f8388c58c3fdc950aa91 /tools/obexctl.c
parent1ada23b015c9f5ebad9e061f48ef192c75edbe40 (diff)
downloadbluez-7cbdb40a8838466055d47b6bd76749ca7e3c0e11.tar.gz
tools/obexctl: Add resume command
Add support for resume command which can be used to resume ongoing transfers.
Diffstat (limited to 'tools/obexctl.c')
-rw-r--r--tools/obexctl.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/obexctl.c b/tools/obexctl.c
index 000e44d40..fc051d716 100644
--- a/tools/obexctl.c
+++ b/tools/obexctl.c
@@ -636,6 +636,46 @@ static void cmd_suspend(int argc, char *argv[])
g_dbus_proxy_get_path(proxy));
}
+static void resume_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 resume: %s\n", error.name);
+ dbus_error_free(&error);
+ return;
+ }
+
+ rl_printf("Resume successful\n");
+}
+
+static void cmd_resume(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;
+ }
+
+ if (g_dbus_proxy_method_call(proxy, "Resume", NULL, resume_reply,
+ NULL, NULL) == FALSE) {
+ rl_printf("Failed to resume transfer\n");
+ return;
+ }
+
+ rl_printf("Attempting to resume transfer %s\n",
+ g_dbus_proxy_get_path(proxy));
+}
+
static GDBusProxy *find_opp(const char *path)
{
GSList *l;
@@ -1897,6 +1937,7 @@ static const struct {
{ "info", "<object>", cmd_info, "Object information" },
{ "cancel", "<transfer>", cmd_cancel, "Cancel transfer" },
{ "suspend", "<transfer>", cmd_suspend, "Suspend transfer" },
+ { "resume", "<transfer>", cmd_resume, "Resume transfer" },
{ "send", "<file>", cmd_send, "Send file" },
{ "cd", "<path>", cmd_cd, "Change current folder" },
{ "ls", NULL, cmd_ls, "List current folder" },