Openmoko uses D-Bus, a message bus system which provides a simple way for applications to talk to one another and to be available as services in the system. If the application providing the service is not running when a message is sent, the application will be started.
There are two separate busses:
- a system bus for root which runs whenever the phone is on
- a session bus which is started for the user when X starts
Session bus services
These can at least be defined in /usr/share/dbus-1.0/services/ and /usr/share/dbus-1/services/
System bus services
There is information about these in /etc/dbus-1/system.d/
Accessing the services
For simple uses, there's a command mdbus. Try
to explore the DBus environment.
For example, to dial a number (using FSO milestone 3):
mdbus -s org.freesmartphone.ogsmd /org/freesmartphone/GSM/Device org.freesmartphone.GSM.Call.Initiate '12345' 'voice'
To use D-Bus in Python, the package python-dbus needs to be compiled and installed.
Note: This example does not work! Please update if you know how to get it working. See also 'discussion' tab.
To dial a number:
#!/usr/bin/env python import dbus bus = dbus.SessionBus() proxy = bus.get_object("org.openmoko.Dialer", "/org/openmoko/Dialer") interface = dbus.Interface(proxy, "org.openmoko.Dialer") interface.Dial("12345") # or this: proxy.Dial("12345", dbus_interface="org.openmoko.Dialer")
The first "org.openmoko.Dialer" is the bus name of the service on the bus and "/org/openmoko/Dialer" is an object path in the service. Before calling a method on the object via the proxy object we still need to specify which interface the method belongs to: the second (and third) "org.openmoko.Dialer". Finally "Dial" is the method in the interface.
To run the program use the following:
dbus-launch python my_program.py