|
m |
(2 intermediate revisions not shown) |
Line 1: |
Line 1: |
- | == SMS ==
| + | #REDIRECT [[Phone control#D-Bus]] |
- | | + | |
- | | + | |
- | *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>
| + | |