XBMC will be renamed to Kodi for v14. Read here for more details

D-Bus Server

From Kodi
Jump to: navigation, search
Home icon grey.png   ▶ Development ▶ D-Bus Server
Incomplete.png INCOMPLETE:
This page or section is incomplete. Please add information or correct uncertain data which is marked with a ?

Contents


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

The D-Bus Server in XBMC is currently "limited" but it supports MPRIS (Media Player Remote Interfacing Specification) which is somewhat standardized. The D-Bus Server in XBMC 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 XBMC 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.

1 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.


1.1 Why the D-Bus Server and its API is needed in XBMC

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

The D-Bus Server in XBMC is currently "limited" but it supports MPRIS (Media Player Remote Interfacing Specification) which is somewhat standardized. The D-Bus Server in XBMC 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 XBMC as well without modification.

1.2 Pros and Cons with D-Bus

The D-Bus Server in XBMC is currently "limited" but it supports MPRIS (Media Player Remote Interfacing Specification) which is somewhat standardized. The D-Bus Server in XBMC 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 XBMC as well without modification.

1.3 Known caveats

The D-Bus Server in XBMC is currently "limited".

2 Development of the D-Bus Server API and D-Bus Clients for XBMC

http://trac.xbmc.org/ticket/6076 here is the ticket for the server, it shows the functionality.

2.1 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
Personal tools
Namespaces

Variants
Actions
Navigation
Wiki help
Toolbox