User Tools

Site Tools


Network and communication

k24:k24.9:k24.9.5:start DBusObserver

The class DBusObserver (gb.dbus) enables you to intercept and evaluate every message sent via the D-Bus.
The class DBusObserver has two properties, two methods and an event. Properties

The class DBusObserver has these two properties:

PropertyData typeDescription
EnabledBooleanThe default value is True. This means that a D-Bus Observer is always on when you start a program that uses this class. You can read and set the value.
MessageDBusObserver.MessageMessage of type.DBusObserver.Message contains the message received from the Observer.

Table Properties of the class DBusObserver Properties of the class .DBusObserver.Message

The virtual class .DbusObserver.Message, which cannot be created, represents a message received from the DBusObserver object. It has the following properties, which can only be read out and are to be understood as metadata except for'Arguments':

PropertyData typeDescription
ArgumentsVariant[] A variant array containing all arguments of a message. It returns NULL if the received message has no arguments.
DestinationStringMessage destination.
InterfaceStringMessage interface.
MemberStringMessage member (method or signal).
ObjectStringPath of the message object.
SenderStringNews station.
SerialIntegerMessage serial number.
TypeIntegerMessage type which can take one of the following values represented by one of the following constants: DBus.Method (1), DBus.Reply (2), DBus.Error (3) or DBus.Signal (4).

Table Properties of the virtual class .DBusObserver.Message Methods

The class DBusObserver has only these two methods:

Error ( [ Error As String, Type As String ] )The response to a message is an error message. The following applies to both parameters: Error is the error message. Type is the error type. By default it is “org.freedesktop.DBus.Error.Failed”. See the list of permitted error types in the D-Bus documentation.
Reply ( [ Signature As String, Arguments As Array ))Reply to the call of the method message. The following applies to both parameters: Signature is the signature of the response. It should be the identification of the output arguments of the method call. argument is an array of the returned response values.

Table Methods of the class DBusObserver Event

The class DBusObserver only has the event Message(). This event is triggered when the DBus observer receives a message from a specific object. The received message is stored in the message property of type.DBusObserver.Message.

You can create this class. You should use this class if you need additional information - such as the meta data mentioned above - about the observed messages. Otherwise, use the class DBusSignal. Create DBusObserver

The following example shows you how to formally create a new DBus observer with New DBusObserver( parameterliste ):

Dim hDBusObserver As DBusObserver

hDBusObserver = New DBusObserver ( Connection As DBusConnection, Type As Integer 
[ , Object As String, Member As String, Interface As String, Destination As String ] ) As "ObserverEventName"

The above source code creates a new D-Bus observer to intercept messages on the specified DBus. The following applies to the parameters:

  • Connection is the DBus Connection object representing the D-Bus.
  • Type is one of the 4 possible message types.
  • Object is the object to be observed. If the optional parameter is not specified, all objects are observed.
  • Member is the method or name of the signal to be observed. If the optional parameter is not specified, all method calls and all signals are observed.
  • Interface is the interface to watch. If the optional parameter is not specified, all interfaces are monitored.
  • Destination is the destination of the message. Unless otherwise specified, only the messages sent to your application are intercepted. If the pattern “*” is declared for the optional value of Destination, all messages are intercepted by all registered applications.

To create a new Observer to intercept signals from the object whose object path is specified with /org/gtk/Private/RemoteVolumeMonitor:

Dim hDBusObserver As DBusObserver

hDBusObserver = New DBusObserver(DBus.Session, DBus.Signal, "/org/gtk/Private/RemoteVolumeMonitor", 
"VolumeAdded", "org.gtk.Private.RemoteVolumeMonitor", "*") As "hDBusObserver"


The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k24/k24.9/k24.9.5/start.txt · Last modified: 02.07.2018 (external edit)

Page Tools