6 from dbus.mainloop.glib import DBusGMainLoop
7 DBusGMainLoop(set_as_default=True)
9 def onCallStatus(sender = "", *args, **kwargs):
11 if (args[1].has_key("peer")):
12 caller = str(args[1]["peer"])
22 def fso_listen_for_calls():
23 bus = dbus.SystemBus()
25 usage_obj = bus.get_object("org.freesmartphone.ousaged", "/org/freesmartphone/Usage")
26 usage_iface = dbus.Interface(usage_obj, "org.freesmartphone.Usage")
27 usage_iface.RequestResource("GSM")
29 gsm_device_obj = bus.get_object("org.freesmartphone.ogsmd", "/org/freesmartphone/GSM/Device")
30 gsm_device_iface = dbus.Interface(gsm_device_obj, "org.freesmartphone.GSM.Device")
31 gsm_call_iface = dbus.Interface(gsm_device_obj, "org.freesmartphone.GSM.Call")
33 print "Set Functionality: full"
34 gsm_device_iface.SetFunctionality("full", True, "")
36 gsm_call_iface.connect_to_signal('CallStatus', onCallStatus)
38 print "starting the main loop"
39 loop = gobject.MainLoop()
42 except KeyboardInterrupt:
46 gsm_device_iface.SetFunctionality("minimal", True, "")
47 usage_iface.ReleaseResource("GSM")
49 if __name__ == "__main__":
50 fso_listen_for_calls()