Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: patrick.ohly@intel.com
Subject: [PATCH BlueZ 4/8] tools/obexctl: Add resume command
Date: Fri, 14 Feb 2014 17:53:00 +0200	[thread overview]
Message-ID: <1392393184-15266-4-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1392393184-15266-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Add support for resume command which can be used to resume ongoing
transfers.
---
 tools/obexctl.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/tools/obexctl.c b/tools/obexctl.c
index 000e44d..fc051d7 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" },
-- 
1.8.5.3


  parent reply	other threads:[~2014-02-14 15:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 15:52 [PATCH BlueZ 1/8] obexd/transfer: Add Transfer.Suspend method Luiz Augusto von Dentz
2014-02-14 15:52 ` [PATCH BlueZ 2/8] obexd/transfer: Add Transfer.Resume method Luiz Augusto von Dentz
2014-02-14 15:52 ` [PATCH BlueZ 3/8] tools/obexctl: Add suspend command Luiz Augusto von Dentz
2014-02-14 15:53 ` Luiz Augusto von Dentz [this message]
2014-02-14 15:53 ` [PATCH BlueZ 5/8] unit/test-gobex-transfer: Add /gobex/test_packet_get_req_suspend_resume Luiz Augusto von Dentz
2014-02-14 15:53 ` [PATCH BlueZ 6/8] gobex: Fix not handling SRM properly Luiz Augusto von Dentz
2014-02-14 15:53 ` [PATCH BlueZ 7/8] gobex: Handle suspending/resuming for GET when SRM is active Luiz Augusto von Dentz
2014-02-14 15:53 ` [PATCH BlueZ 8/8] doc/obex-api: Update documentation Luiz Augusto von Dentz
2014-02-17  7:24   ` Andrei Emeltchenko
2014-02-18  9:09   ` Patrick Ohly
2014-02-18  9:30     ` Luiz Augusto von Dentz
2014-02-18 16:54       ` Patrick Ohly
2014-02-19 17:11         ` Luiz Augusto von Dentz
2014-02-20 10:52           ` Patrick Ohly
2014-02-20 12:09             ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392393184-15266-4-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=patrick.ohly@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox