public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: [PATCH obexd v1 16/16] client-test: Remove agent from ftp-client
Date: Fri, 25 May 2012 12:11:33 +0200	[thread overview]
Message-ID: <1337940693-3417-17-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1337940693-3417-1-git-send-email-mikel.astiz.oss@gmail.com>

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

This updated test script is limited because the current transitional
D-Bus API is incomplete. The reason behind is that the transfer path is
not being returned by methods that initiate such a transfer. Therefore
the client cannot know when the transfer has succeeded or failed, and
neither can receive progress reports in a reliable way.
---
 test/ftp-client |   49 +++++++++----------------------------------------
 1 files changed, 9 insertions(+), 40 deletions(-)

diff --git a/test/ftp-client b/test/ftp-client
index 825f591..da15116 100755
--- a/test/ftp-client
+++ b/test/ftp-client
@@ -9,42 +9,6 @@ import dbus.mainloop.glib
 import os.path
 from optparse import OptionParser
 
-class Agent(dbus.service.Object):
-    def __init__(self, conn=None, obj_path=None, verbose=False):
-        dbus.service.Object.__init__(self, conn, obj_path)
-        self.verbose = verbose
-
-    @dbus.service.method("org.openobex.Agent",
-                    in_signature="o", out_signature="s")
-    def Request(self, path):
-        return ""
-
-    @dbus.service.method("org.openobex.Agent",
-                    in_signature="ot", out_signature="")
-    def Progress(self, path, transferred):
-        if self.verbose:
-            print "Transfer progress (%d bytes)" % (transferred)
-        return
-
-    @dbus.service.method("org.openobex.Agent",
-                    in_signature="o", out_signature="")
-    def Complete(self, path):
-        if self.verbose:
-            print "Transfer finished"
-        mainloop.quit()
-
-    @dbus.service.method("org.openobex.Agent",
-                    in_signature="os", out_signature="")
-    def Error(self, path, error):
-        print "Transfer finished with an error: %s" % (error)
-        mainloop.quit()
-
-    @dbus.service.method("org.openobex.Agent",
-                    in_signature="", out_signature="")
-    def Release(self):
-        mainloop.quit()
-
-
 def parse_options():
     parser.add_option("-d", "--device", dest="device",
                       help="Device to connect", metavar="DEVICE")
@@ -74,6 +38,9 @@ def error(err):
 def void_reply():
     pass
 
+def transfer_complete():
+    print "SOME transfer finished (could not check if path matches)"
+
 def change_folder(session, new_dir):
     for node in new_dir.split("/"):
         session.ChangeFolder(node)
@@ -129,8 +96,12 @@ if  __name__ == '__main__':
     bus = dbus.SessionBus()
     mainloop = gobject.MainLoop()
 
-    path = "/test/agent"
-    agent = Agent(bus, path, options.verbose)
+    bus.add_signal_receiver(transfer_complete,
+                            dbus_interface="org.openobex.Transfer",
+                            signal_name="Complete")
+    bus.add_signal_receiver(error,
+                            dbus_interface="org.openobex.Transfer",
+                            signal_name="Error")
 
     client = dbus.Interface(bus.get_object("org.openobex.client", "/"),
                             "org.openobex.Client")
@@ -140,8 +111,6 @@ if  __name__ == '__main__':
     session = dbus.Interface(bus.get_object("org.openobex.client", session_path),
                  "org.openobex.Session")
 
-    session.AssignAgent(path)
-
     ftp = dbus.Interface(bus.get_object("org.openobex.client", session_path),
                  "org.openobex.FileTransfer")
 
-- 
1.7.7.6


      parent reply	other threads:[~2012-05-25 10:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-25 10:11 [PATCH obexd v1 00/16] client: Remove D-Bus agent Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 01/16] client: Add D-Bus helper library Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 02/16] client-doc: Add progress property to transfer Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 03/16] client: " Mikel Astiz
2012-05-25 10:15   ` Mikel Astiz
2012-05-25 10:35   ` Luiz Augusto von Dentz
2012-05-25 10:45     ` Mikel Astiz
2012-05-25 10:55       ` Luiz Augusto von Dentz
2012-05-25 11:02         ` Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 04/16] client-doc: Add transfer event-reporting signals Mikel Astiz
2012-05-25 10:50   ` Luiz Augusto von Dentz
2012-05-25 10:57     ` Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 05/16] client: " Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 06/16] client-doc: Remove D-Bus agent Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 07/16] client: Use transfer owner instead of agent Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 08/16] client: Remove D-Bus agent Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 09/16] client: Remove unused functions in transfer API Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 10/16] client: Remove internal transfer progress report Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 11/16] client: Remove obsolete authentication code Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 12/16] client: Make D-Bus exposure of transfers optional Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 13/16] client-doc: Add signal to report new transfers Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 14/16] client: Expose D-Bus data in internal transfer API Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 15/16] client: Add signal to report new transfers Mikel Astiz
2012-05-25 10:11 ` Mikel Astiz [this message]

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=1337940693-3417-17-git-send-email-mikel.astiz.oss@gmail.com \
    --to=mikel.astiz.oss@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mikel.astiz@bmw-carit.de \
    /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