anyRemote · Control your computer with your phone
Description: anyRemote project page - Bluetooth remote control tool

Skip to content

# anyRemote

# Dbus(...) command

This command used to support D-BUS natively.

## Format description

    Dbus(connect,_id_,_service_,_path_,_interface_)
    Dbus(set,_id_,_method_,[int|uint|double|bool|string,_value_])
    Dbus(get,_id_,_method_,int|double|bool|string,_variable_name_)
    Dbus(signal,_id_,_method_,_int|double|bool|string,_callback_key_)
    Dbus(close,_id_)

Several examples:

    (Connect)=Dbus(connect,rhythmbox_connection,\
                    org.gnome.Rhythmbox,\
                    /org/gnome/Rhythmbox/Player,\
                    org.gnome.Rhythmbox.Player);
    (Disconnect)=Dbus(close,rhythmbox_connection);

    1=Dbus(set,rhythmbox_connection,previous);
    3=Dbus(set,rhythmbox_connection,next);

    % rewind +/-10 seconds
    4=Dbus(get,rhythmbox_connection,getElapsed,uint,elapsed);\
    	Make(var,elapsed,echo "$(elapsed)-10"|bc);\
    	Dbus(set,rhythmbox_connection,setElapsed,uint,$(elapsed));
    6=Dbus(get,rhythmbox_connection,getElapsed,uint,elapsed);\
    	Make(var,elapsed,echo "$(elapsed)+10"|bc);\
    	Dbus(set,rhythmbox_connection,setElapsed,uint,$(elapsed));

    0=Dbus(signal,rhythmbox_connection,playingUriChanged,string,RHYTHMBOX_SETTITLE);
    RHYTHMBOX_SETTITLE=ExecAndSet(title,rhythmbox-client --print-playing);

## Dbus(connect,...)

This command used to establish permanent D-BUS connection.

    (Connect)=Dbus(connect,rhythmbox_connection,\
                    org.gnome.Rhythmbox,\
                    /org/gnome/Rhythmbox/Player,\
                    org.gnome.Rhythmbox.Player);

## Dbus(close,...)

This command used to close existing D-BUS connection.

    (Connect)=Dbus(close,rhythmbox_connection);

## Dbus(set,...)

This command used to invoke some method on existing D-BUS connection. Called method can not have more than one input parameter. Only int, uint, double, bool or string parameters are supported. Called method can not return any values.

    1=Dbus(set,rhythmbox_connection,previous);
    2=Dbus(set,rhythmbox_connection,setElapsed,uint,$(elapsed_time));

## Dbus(get,...)

This command used to invoke some method which can returns some value on existing D-BUS connection. Called method can not have input parameters. Only int, uint, double, bool or string return values are supported.

    3=Dbus(get,rhythmbox_connection,getElapsed,uint,elapsed);\
      Exec(echo "Elapsed time is $(elapsed)");

## Dbus(signal,...)

This command used to register signal handler on existing D-BUS connection. A specified key definition will be searched upon receiving of the signal.

    0=Dbus(signal,rhythmbox_connection,playingUriChanged,string,RHYTHMBOX_SETTITLE);
    RHYTHMBOX_SETTITLE=ExecAndSet(title,rhythmbox-client --print-playing);

## How to find appropriate D-BUS methods ?

The simplest way to do that is to use qdbus utility.

Just run qdbus to see something like:

    qdbus
    :1.1
    org.kde.klauncher
    :1.10
    org.kde.knotify
    ...
    org.kde.juk
    ...
    org.kde.kmix
    ...

Then run qdbus org.kde.juk to see available interfaces of Juk:

    qdbus org.kde.juk
    /
    /AudioOutputs
    /AudioOutputs/8
    /KIO
    /KIO/Scheduler
    /MainApplication
    /Player
    /Search
    /internal
    /internal/PhononXine
    /juk
    /juk/MainWindow_1
    ...

To see available methods of /Player interface run:

    qdbus org.kde.juk /Player
    method void org.kde.juk.player.back()
    method int org.kde.juk.player.currentTime()
    method void org.kde.juk.player.forward()
    method void org.kde.juk.player.mute()
    method void org.kde.juk.player.pause()
    method bool org.kde.juk.player.paused()
    method void org.kde.juk.player.play()
    method void org.kde.juk.player.play(QString file)
    ...

Now we are ready to create a part of configuration file:

    (Connect)=Dbus(connect,juk_connection,\
                    org.kde.juk,/Player,org.kde.juk.player);
    1=Dbus(set,juk_connection,back);
    2=Dbus(set,juk_connection,play);
    3=Dbus(set,juk_connection,forward);

Maintained by anyRemote. Website by m.lettner.