Documentation/Maemo 5 Developer Guide/DBus/DBus in Freemantle

Line 1: Line 1:
-
<div style="border: 1px solid red; background-color: #faa; padding: 20px;">Please be aware that the recommended way to use the phone functionality is Telepathy:
+
#REDIRECT [[PyMaemo/Phone call and SMS examples]]
-
 
+
-
* [http://telepathy.freedesktop.org/wiki/ Telepathy wiki]
+
-
* [http://maemo.org/api_refs/5.0/5.0-final/telepathy-glib/ Telepathy-glib API]
+
-
* [http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Architecture/RTCOM RTCOM architecture]
+
-
</div>
+
-
 
+
-
 
+
-
 
+
-
== SMS ==
+
-
 
+
-
 
+
-
*Method calls:
+
-
**Method: Send
+
-
***Description: Use method to send messages
+
-
***Parameters: (string, string) - (message, '')
+
-
***Interface: com.nokia.csd.SMS.Outgoing
+
-
***Path: /com/nokia/phone/SMS/ba212ae1
+
-
***Destination: com.nokia.phone.SMS
+
-
**Code: Python
+
-
<code>
+
-
        import dbus
+
-
        bus = dbus.SystemBus()
+
-
        smsobject = bus.get_object('com.nokia.phone.SMS', '/com/nokia/phone/SMS/ba212ae1')
+
-
        smsiface = dbus.Interface(smsobject, 'com.nokia.csd.SMS.Outgoing')
+
-
        arr = dbus.Array(pdu_array)
+
-
        msg = dbus.Array([arr])
+
-
        smsiface.Send(msg,'')
+
-
</code>
+
-
 
+
-
*Signals:
+
-
**Signal name: IncomingSegment
+
-
***Description: Can be used to listen to incoming messages
+
-
***Callback Parameters: (string, string, string, string)
+
-
***Interface: Phone.SMS
+
-
***Path: /com/nokia/phone/SMS
+
-
**Code: Python
+
-
<code>
+
-
    import gobject, dbus
+
-
    from dbus.mainloop.glib import DBusGMainLoop
+
-
   
+
-
    def handle_sms(pdu, msgcenter, somestring, sendernumber):
+
-
        print 'New message from %s' % sendernumber
+
-
       
+
-
    DBusGMainLoop(set_as_default=True)
+
-
    bus = dbus.SystemBus()
+
-
    bus.add_signal_receiver(handle_sms, path='/com/nokia/phone/SMS',  dbus_interface='Phone.SMS', signal_name='IncomingSegment')
+
-
    gobject.MainLoop().run()
+
-
</code>
+
-
 
+
-
 
+
-
== Call ==
+
-
 
+
-
 
+
-
*Method calls:
+
-
**Method: Release
+
-
***Description: Reject call
+
-
***Parameters: () 
+
-
***Interface: com.nokia.csd.Call.Instance
+
-
***Path: /com/nokia/csd/call/1
+
-
***Destination: com.nokia.csd.Call
+
-
**Code: Python
+
-
<code>
+
-
    bus = dbus.SystemBus()
+
-
    callobject = bus.get_object('com.nokia.csd.Call', '/com/nokia/csd/call/1')
+
-
    smsiface = dbus.Interface(callobject, 'com.nokia.csd.Call.Instance')
+
-
    smsiface.Release()
+
-
</code>
+
-
 
+
-
*Signals:
+
-
**Signal name: Coming
+
-
***Description: Can be used to listen to incoming calls
+
-
***Callback Parameters: (string, string) - (obj_path, callernumber)
+
-
***Interface: com.nokia.csd.Call
+
-
***Path: /com/nokia/csd/call
+
-
**Code: Python
+
-
<code>
+
-
    import gobject, dbus
+
-
    from dbus.mainloop.glib import DBusGMainLoop
+
-
   
+
-
    def handle_call(obj_path, callernumber):
+
-
        print '%s is calling' % callernumber
+
-
       
+
-
    DBusGMainLoop(set_as_default=True)
+
-
    bus = dbus.SystemBus()
+
-
    bus.add_signal_receiver(handle_call, path='/com/nokia/csd/call', dbus_interface='com.nokia.csd.Call', signal_name='Coming')
+
-
    gobject.MainLoop().run()
+
-
</code>
+

Revision as of 13:52, 27 January 2010

  1. REDIRECT PyMaemo/Phone call and SMS examples