D-Bus Server

XBMC can receive and send commands through our internally embedded D-Bus Server and its API.

The D-Bus Server in Kodi is currently "limited" but it supports MPRIS (Media Player Remote Interfacing Specification) which is somewhat standardized. The D-Bus Server in Kodi can do more or less same as the EventServer but the D-Bus interface is standard on most Linux distribution so a program that can control i.e. VLC through its D-Bus interface could quite easily control Kodi as well without modification. Note that in the context of this page, interface refers to interface in the sense of an API, not an interface through which a user interacts with a program.

Introduction
D-Bus (Desktop Bus) is a simple inter-process communication (IPC) system for software applications to communicate with one another. D-Bus was heavily influenced by KDE2–3's DCOP system and has replaced it in the KDE 4 release; it is supported on Linux, Microsoft Windows and Apple OS X operating systems and is used by Qt 4 and GNOME. In GNOME it has gradually replaced most parts of the earlier Bonobo mechanism. D-Bus is primarily developed by Red Hat, as part of the freedesktop.org project. Released under the terms of the GNU General Public License and the Academic Free License, D-Bus is free software.

D-Bus allows programs to register on it for offering services to others. It also offers client programs the possibility to look up which services are available. Programs can also register as waiting for events of the kernel like hot swapping hardware.

D-Bus is implemented as a daemon. Users can run several instances of it, each called a channel. There will usually be a privileged system channel, and a private instance for each logged in user. The private instances are required because the system channel has access restrictions.

The main mission of the system channel is to deliver the signals from the HAL (hardware abstraction layer) daemon to the processes interested in them. The mission of the private instances is to provide unrestricted communication among any applications of the user.

Why the D-Bus Server and its API is needed in Kodi
XBMC can receive and send commands through our internally embedded D-Bus Server and its API.

The D-Bus Server in Kodi is currently "limited" but it supports MPRIS (Media Player Remote Interfacing Specification) which is somewhat standardized. The D-Bus Server in Kodi can do more or less same as the EventServer but the D-Bus interface is standard on most Linux distribution so a program that can control i.e. VLC through its D-Bus interface could quite easily control Kodi as well without modification.

Pros and Cons with D-Bus
The D-Bus Server in Kodi is currently "limited" but it supports MPRIS (Media Player Remote Interfacing Specification) which is somewhat standardized. The D-Bus Server in Kodi can do more or less same as the EventServer but the D-Bus interface is standard on most Linux distribution so a program that can control i.e. VLC through its D-Bus interface could quite easily control Kodi as well without modification.

Known caveats
The D-Bus Server in Kodi is currently "limited".

= Development of the D-Bus Server API and D-Bus Clients for Kodi = http://trac.kodi.tv/ticket/6076 here is the ticket for the server, it shows the functionality.

Example demos of DBus usage (open source code)
First implementation of D-Bus in XBMC.

The server is "org.mpris.xbmc"

You have 3 path: / -> rootPath for version and identity /Player -> PlayerPath for send command /TrackList -> to manipulate the tracklist

Only few command have been implemented : for RootPath : org.freedesktop.DBus.Identity and org.freedesktop.DBus.MprisVersion for PlayerPath: org.freedesktop.MediaPlayer.VolumeSet in percentage org.freedesktop.MediaPlayer.VolumeGet in percentage org.freedesktop.MediaPlayer.Stop org.freedesktop.MediaPlayer.GetStatus return 0=playing, 1=paused, 2=stopped.

and for TrackListPath: there is nothing made yet.

You can use this with: dbus-send --print-reply --session --dest="org.mpris.xbmc" / org.freedesktop.DBus.Introspectable.Introspect

dbus-send --print-reply --session --dest="org.mpris.xbmc" /Player org.freedesktop.MediaPlayer.VolumeGet

dbus-send --print-reply --session --dest="org.mpris.xbmc" /Player org.freedesktop.MediaPlayer.VolumeSet int32:50

dbus-send --print-reply --session --dest="org.mpris.xbmc" /Player org.freedesktop.MediaPlayer.GetStatus

dbus-send --print-reply --session --dest="org.mpris.xbmc" /Player org.freedesktop.MediaPlayer.Stop