test: Add get-icon script
authorDenis Kenzior <denkenz@gmail.com>
Wed, 13 Oct 2010 07:41:53 +0000 (02:41 -0500)
committerDenis Kenzior <denkenz@gmail.com>
Wed, 13 Oct 2010 10:04:47 +0000 (05:04 -0500)
Makefile.am
test/get-icon [new file with mode: 0755]

index 6c56459..fd791cf 100644 (file)
@@ -407,7 +407,8 @@ test_scripts = test/backtrace \
                test/lock-pin \
                test/unlock-pin \
                test/enable-gprs \
-               test/disable-gprs
+               test/disable-gprs \
+               test/get-icon
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/get-icon b/test/get-icon
new file mode 100755 (executable)
index 0000000..eb6f096
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 2:
+       id = sys.argv[1]
+else:
+       print "%s <icon id>" % (sys.argv[0])
+       sys.exit(0)
+
+manager = dbus.Interface(bus.get_object("org.ofono", "/"),
+                                                       "org.ofono.Manager")
+
+modems = manager.GetModems()
+
+for path, properties in modems:
+       if "org.ofono.SimManager" not in properties["Interfaces"]:
+               continue
+
+sim = dbus.Interface(bus.get_object('org.ofono', path),
+                               'org.ofono.SimManager')
+
+icon = sim.GetIcon(dbus.Byte(int(sys.argv[1])))
+print icon