diff options
author | Luiz Augusto Von Dentz <luiz.dentz-von@nokia.com> | 2010-03-18 10:38:07 +0200 |
---|---|---|
committer | Luiz Augusto Von Dentz <luiz.dentz-von@nokia.com> | 2010-03-18 10:38:32 +0200 |
commit | 6cba7a690a0a844804ced9c9b7c0467f727ffbcf (patch) | |
tree | d12258a9aa54ed7ebd596757650ab24e400702a8 /test | |
parent | a45ded00c96ce0c83c9e7de02e9752493934c24f (diff) | |
download | obexd-6cba7a690a0a844804ced9c9b7c0467f727ffbcf.tar.gz |
Add speed estimation to send-files
Diffstat (limited to 'test')
-rwxr-xr-x | test/send-files | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/send-files b/test/send-files index caf00b9..6481836 100755 --- a/test/send-files +++ b/test/send-files @@ -3,6 +3,7 @@ import gobject import sys +import time import dbus import dbus.service import dbus.mainloop.glib @@ -20,12 +21,14 @@ class Agent(dbus.service.Object): properties = transfer.GetProperties() for key in properties.keys(): print " %s = %s" % (key, properties[key]) + self.start_time = time.time() return "" @dbus.service.method("org.openobex.Agent", in_signature="ot", out_signature="") def Progress(self, path, transferred): - print "Transfer progress (%d bytes)" % (transferred) + speed = transferred / abs((time.time() - self.start_time) * 1000) + print "Transfer progress (%d bytes) @ %d kB/s" % (transferred, speed) return @dbus.service.method("org.openobex.Agent", |