Openmoko Power Management‎ > ‎Log‎ > ‎

Apr. 13th,2009 Get information and call method using DBus-glib API in G_TYPE int, string,and array string

posted Apr 13, 2009, 10:23 AM by Diming Lu   [ updated Apr 13, 2009, 11:25 AM ]
Today, I make a progress in this project. I can get some information and control some functions using call method or signal using DBus, but restrict the following return parameter type - string and array string.
 
First, I run the command in the terminal to get all the Bus names.
# dbus-send --system --print-reply --dest=org.freedesktop.DBus / org.freedesktop.DBus.ListActivatableNames
Bus example
 
method return sender=org.freedesktop.DBus -> dest=:1.50 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string "org.pyneo.muxer"
      string "fi.epitest.hostap.WPASupplicant"
      string "org.freesmartphone.DBus"
   ]
method return sender=org.freedesktop.DBus -> dest=:1.51 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string ":1.7"
      string ":1.8"
      string "org.freesmartphone.odeviced"
      string "org.freesmartphone.onetworkd"
      string "org.freesmartphone.ophoned"
      string ":1.9"
      string ":1.51"
      string "org.pyneo.muxer"
      string ":1.20"
      string "org.freedesktop.Avahi"
      string ":1.21"
      string "org.freesmartphone.ogpsd"
      string ":1.10"
      string "org.bluez"
      string ":1.11"
      string "org.freesmartphone.opreferencesd"
      string ":1.12"
      string "org.tichy.launcher"
      string ":1.13"
      string ":1.0"
      string "org.freesmartphone.frameworkd"
      string ":1.14"
      string ":1.1"
      string ":1.15"
      string "org.moblin.connman"
      string ":1.2"
      string "org.freesmartphone.otimed"
      string "org.freedesktop.Gypsy"
      string ":1.16"
      string ":1.3"
      string "org.freesmartphone.testing"
      string ":1.17"
      string ":1.18"
      string ":1.5"
      string ":1.19"
      string "org.freesmartphone.ousaged"
      string "org.freesmartphone.ogsmd"
      string "org.freesmartphone.oeventsd"
      string ":1.6"
   ]
 
Second, run the command to get apis
# ./dteeth.py [BUSNAME]
 
API example
org.freesmartphone.ousaged
    /org/freesmartphone/Usage
        org.freesmartphone.Usage
            signals
                ResourceAvailable( s resourcename , b state )
                SystemAction( s action )
                ResourceChanged( s resourcename , b state , a{sv} attributes )
            methods
                ReleaseResource( in s resourcename )
                Suspend( )
                GetResourceState( in s resourcename , out b )
                SetResourcePolicy( in s resourcename , in s policy )
                Reboot( )
                GetResourcePolicy( in s resourcename , out s )
                GetResourceUsers( in s resourcename , out as )
                ListResources( out as )
                RegisterResource( in s resourcename , in o path )
                RequestResource( in s resourcename )
                Shutdown( )
        org.freedesktop.DBus.Introspectable
            methods
                Introspect( out s )
Third, use the api to program
 
The following links are to download dteeth.py, APIs and sample dbus code(get the power status).
 
In this week, I will figure out call method parameter problem in TYPE boolean, a{sv} and int. Then, I will implement some basic features of power manager.
 
Comments