2. About me
Marius Bugge Monsen
Senior Software Engineer
5 years for TT
Msc. comp. sci. NTNU
Projects
Itemviews
QtDBus
WebKit
2
3. Contents
What is InterProcess Communication ?
What is DBus ?
What is QtDBus ?
Exposing Interfaces
Calling Interfaces
Messages
More IPC
3
4. What is InterProcess Communication ?
What is DBus ?
What is QtDBus ?
Exposing Interfaces
Calling Interfaces
Messages
More IPC
4
17. Exposing Functionality
Service
Represent a process connected to a bus.
Has a unique (base) name chosen by the bus.
Uses a “:n.nnn” naming scheme (e.g. :1.32).
Has a wellknown name chosen by the process.
Uses “reverse domain name” naming scheme (e.g.
com.trolltech.appname).
Multiple services per process
17
18. Exposing Functionality
Object
Multiple objects per service.
Specified by a path.
/path/to/ObjectName
The path structure is arbitrary.
Provides namespaces for objects.
18
19. Exposing Functionality
Interface
Multiple interfaces per object.
Dotseparated name.
com.trolltech.Assistant.HelpViewer
Defines a set of methods, signals and properties.
names
parameters
return values
Can be described by XML.
19
20. Exposing Functionality
Methods
A method can be called by sending a message to the process
exposing the functionality (the caller does not have to register
a service).
Manytoone.
Signals
A signal is emitted by the process which is exposing the
interface and is available to any application on the same bus.
Onetomany.
20
21. Exposing Functionality
Properties
org.freedesktop.DBus.Properties
The Properties interface that provides Get and Set methods.
21
24. Activation
The Bus can start clients automatically
by explicitly requesting the Bus to activate the client.
by invoking a method on an object belonging to the client.
24
25. Introspection
Objects may provide the introspection interface
org.freedesktop.DBus.Introspectable
The Introspect method returns an XML description.
25
26. What is InterProcess Communication ?
What is DBus ?
What is QtDBus ?
Exposing Interfaces
Calling Interfaces
Messages
More IPC
26
27. What is QtDBus ?
Objectoriented Qt API for DBus.
Maps Qt properties, signals and slots to DBus.
Maps DBus properties, signals and methods to Qt.
27
29. QtDBus Tools
qdbusxml2cpp
Compiles XML interface description to an interface or adaptor
class.
qdbuscpp2xml
Compiles an interface or adaptor class to an XML interface
description file.
29
30. What is InterProcess Communication ?
What is DBus ?
What is QtDBus ?
Exposing Interfaces
Calling Interfaces
Messages
More IPC
30
31. QtDBus Approaches
Highlevel
Interface representations generated from XML descriptions
Midlevel
Direct calls to a generic interface class
Lowlevel
Constructing and sending messages
31
32. Connecting To DBus
QDBusConnection
Represents a connection to the DBus bus daemon.
QDBusConnection::BusType
QDBusConnection::SessionBus
QDBusConnection::SystemBus
QDBusConnection::ActivationBus
32
37. Exposing Interfaces
Adaptor Class
Special class attached to a QObject
Exposes an interface to the bus
Lightweight
Inherits QDBusAbstractAdaptor
37
44. XML To Adaptor
test.xml
qdbusxml2cpp a adaptor test.xml
adaptor.h adaptor.cpp
44
45. XML To Proxy
test.xml
qdbusxml2cpp p proxy test.xml
proxy.h proxy.cpp
45
46. Using Interfaces
Interface Proxy
Interface Message Bus Proxy
Interface Proxy
46
47. What is InterProcess Communication ?
What is DBus ?
What is QtDBus ?
Exposing Interfaces
Calling Interfaces
Messages
More IPC
47
48. Using Interfaces
Proxy Class
Represents a DBus interface
Represented as a normal QObject
signals
slots
properties
Inherits QDBusAbstractInterface
48