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_call_iface = dbus.Interface(gsm_device_obj, "org.freesmartphone.GSM.Call")
32 print "Set Functionality: full"
33 gsm_network_iface.SetFunctionality("full", True, "")
35 gsm_call_iface.connect_to_signal('CallStatus', onCallStatus)
37 print "starting the main loop"
38 loop = gobject.MainLoop()
41 except KeyboardInterrupt:
45 gsm_network_iface.SetFunctionality("minimal", True, "")
46 usage_iface.ReleaseResource("GSM")
48 if __name__ == "__main__":
49 fso_listen_for_calls()