# FPC and DBus/fr

English (en) español (es) français (fr)

### Documentation

DBUS is a very new GNU library that implements inter-process communication. It's the default library of this kind for GNU applications.

This library provides a simple way for applications to talk to one another, using a bus sytem. This headers are the translation of the low-level c API for dbus. In the future it is desirable that this headers be wrapped around a class to make their use easier.

#### Common Code

Independently from what you want to achieve, a lot of the code for a software that uses DBUS will be very similar. This is the startup and finalization code. On the startup you need to connect to the bus. Usually there is a system and a session bus. Depending on the configuration of the system you may not have access to the system bus. Next you need to request a name on the bus. Bellow is a simple startup code.

var
err: DBusError;
conn: PDBusConnection;
ret: cint;
begin
{ Initializes the errors }
dbus_error_init(@err);

{ Connection }
conn := dbus_bus_get(DBUS_BUS_SESSION, @err);

if dbus_error_is_set(@err) <> 0 then
begin
WriteLn('Connection Error: ' + err.message);
dbus_error_free(@err);
end;

if conn = nil then Exit;

{ Request the name of the bus }
ret := dbus_bus_request_name(conn, 'test.method.server', DBUS_NAME_FLAG_REPLACE_EXISTING, @err);

if dbus_error_is_set(@err) <> 0 then
begin
WriteLn('Name Error: ' + err.message);
dbus_error_free(@err);
end;

if ret <> DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER then Exit;

....


After you no longer need the bus you should close the connect. A good place to do this on most cases is right before the application terminates.

  { Finalization }
dbus_connection_close(conn);


Status: Beta

### Subversion

You can download the subversion version of this project using this command:

svn checkout http://svn.freepascal.org/svn/fpc/trunk/packages/base/dbus dbus

You can also download the full fpc 2.1.1 repository and it will be included.

### Bug Reporting

Tests are necessary to verify if all functions and structures are declared properly. Tests were done on Windows and Linux operating systems. It is necessary to test if the modules work correctly in other operating system.

You can post Bug Reports here:

### Change Log

• ??.??.06 DBus headers version 0.1
1. Under construction

### Help

Please send help requests to the Free Pascal mailling list or on apache-modules mailling list.