Specifications

CHAPTER 5. IMPLEMENTATION 33
void event_callback(DBusConnection *connection, DBusMessage *dbus_message,
void *user_data)
{
/* Create abstract input event. */
IalEvent event;
/* Read arguments from D-BUS message. */
dbus_message_get_args(dbus_message, &dbus_error,
DBUS_TYPE_STRING, &event.sender,
DBUS_TYPE_STRING, &event.source,
DBUS_TYPE_STRING, &event.name,
DBUS_TYPE_INT32, &event.raw,
DBUS_TYPE_INVALID);
}
The abstract input event is represented by event using the IalEvent structure. Each ar-
gument of the message dbus message is defined by two fields: the first field defines the D-BUS
data type of the argument, the second field defines where the value of the argument should be
stored. In this case, the message arguments are copied to the corresponding members of event.
The last argument, DBUS TYPE INVALID, states that no further arguments of the D-BUS mes-
sage are expected. The library libial provides a wrapper function called event receive()
which relieves the receiving of Input Abstraction Layer messages. Applications which want to
utilize this function have to be linked against libial.
Recapitulating, Figure 5.3 shows the interprocess communication between the Input Ab-
straction Layer and applications. Abstract input events are sent as messages to the D-BUS
interface com.novell.Ial.Event by the modules. Applications can receive these messages
either by using the event receive() function provided by the library libial, or by accessing
the D-BUS interface directly.
Input Abstraction Layer
System Message Bus
Interface (com.novell.Ial.Event)
D-BUS
Module Module Module
Library (libial) Library (libial)
Application
Application
Figure 5.3: Input Abstraction Layer Using D-BUS
Logging System
Apart from providing the wrapper functions for the interprocess communication, the library
implements a logging system which is used by both the daemon and the modules. The code of
the log system was originally based on code from the HAL project (http://hal.freedesktop.