summaryrefslogtreecommitdiff
path: root/test/test-counter
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-07-12 22:25:03 -0300
committerMarcel Holtmann <marcel@holtmann.org>2010-07-12 22:25:03 -0300
commit83571bf295a3c1466300f852c3be4277da8d7efa (patch)
tree25a405b8f70efa84b9ed358f5f6b3cb6d80ebabe /test/test-counter
parent205546a2cfb0e5a2662b33288041952e351cab4c (diff)
downloadconnman-83571bf295a3c1466300f852c3be4277da8d7efa.tar.gz
connman-83571bf295a3c1466300f852c3be4277da8d7efa.tar.bz2
connman-83571bf295a3c1466300f852c3be4277da8d7efa.zip
Update counter test script to print roaming ones as well
Diffstat (limited to 'test/test-counter')
-rwxr-xr-xtest/test-counter37
1 files changed, 20 insertions, 17 deletions
diff --git a/test/test-counter b/test/test-counter
index 111d4fc5..2cdee341 100755
--- a/test/test-counter
+++ b/test/test-counter
@@ -23,31 +23,34 @@ def make_bytes_readable(bytes):
return ''
+def print_stats(stats):
+ keys = stats.keys()
+ keys.sort()
+
+ for key in keys:
+ val = int(stats[key])
+ str = " %s = %s" % (key, val)
+
+ if key in ["RX.Bytes", "TX.Bytes"]:
+ hstr = make_bytes_readable(val)
+ if hstr:
+ str = "%s (%s)" % (str, hstr)
+
+ print str
+
class Counter(dbus.service.Object):
@dbus.service.method("org.moblin.connman.Counter",
- in_signature='', out_signature='')
+ in_signature='', out_signature='')
def Release(self):
print("Release")
mainloop.quit()
@dbus.service.method("org.moblin.connman.Counter",
- in_signature='oa{sv}', out_signature='')
- def Usage(self, path, stats):
+ in_signature='oa{sv}a{sv}', out_signature='')
+ def Usage(self, path, home, roaming):
print "%s" % (path)
-
- keys = stats.keys()
- keys.sort()
-
- for key in keys:
- val = int(stats[key])
- str = " %s = %s" % (key, val)
-
- if key in ["RX.Bytes", "TX.Bytes"]:
- hstr = make_bytes_readable(val)
- if hstr:
- str = "%s (%s)" % (str, hstr)
-
- print str
+ print_stats(home)
+ print_stats(roaming)
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)