added caller module
authorMax Usachev <maxusachev@gmail.com>
Tue, 22 Jun 2010 12:21:25 +0000 (15:21 +0300)
committerMax Usachev <maxusachev@gmail.com>
Tue, 22 Jun 2010 12:21:25 +0000 (15:21 +0300)
caller.py [new file with mode: 0644]

diff --git a/caller.py b/caller.py
new file mode 100644 (file)
index 0000000..6ec15f7
--- /dev/null
+++ b/caller.py
@@ -0,0 +1,18 @@
+import dbus
+
+class PhoneCaller:
+    def __init__(self):
+        self.caller = None
+
+    def call(self, number):
+        """Make Phone call."""
+
+        # lazy creation
+        if self.caller is None:
+            import dbus
+            try:
+                self.caller = dbus.Interface(dbus.SystemBus().get_object( \
+                'com.nokia.csd', '/com/nokia/csd/call'), 'com.nokia.csd.Call')
+            except dbus.exceptions.DBusException:
+                return
+        self.caller.CreateWith(number, dbus.UInt32(0))