User Tools

Site Tools


Network and communication


24.9.3 DBusApplication

The class DBusApplication (gb.dbus) represents an application registered on the D-Bus. You can create this class. It behaves like an array that you can only read. Properties

The class DBusApplication has the following properties:

PropertyData typeDescription
ConnectionDBusConnectionDBusConnection type object whose application is connected to the D-Bus.
IndexIntegerIndex in the (internal) application cache.
NameStringName of the application on the D-Bus (

Table Properties of Class DBusApplication Methods

The class DBusApplication has these three methods:

Register ( Object As DBusObject, Path As String [, Interfaces As String[] ] )Registers a D-Bus object on the D-Bus - since Gambas 3.9. The following applies to the parameters: Object is the D-Bus object to be registered, Path is the D-Bus path for the D-Bus object and Interface (optional) allows the names of additional interfaces to be specified if they exist for the D-Bus object used.
Unregister ( Object As DBusObject )Deregisters the D-Bus object specified in the parameter from the D-Bus.
Raise ( Object As DBusObject, Signal As String [ , Arguments As Variant[] ))Triggers a D-Bus signal. For the parameters: Object is the D-Bus object that transmits the signal, Signal is the name of the transmitted signal and Argument (optional) represents the arguments of the signal of data type Variant Array.

Table Methods of Class DBusApplication Example 1 - New DBusApplication

With New DBusApplication(parameter list) you can create a DBusApplication object:

  Dim hDBusApplication As DBusApplication

  hDBusApplication = New DBusApplication ( Connection As DBusConnection, ApplicationName As String )

The created object represents an application that is connected to the session bus or the system bus. The following applies to both parameters:

  • Connection is a D-Bus connection object (DBus.Session or DBus.System)
  • ApplicationName is the name of the application on the D-Bus.

Alternatively, you can also use DBus[ ApplicationName ] as an array. Example 2 - DBusApplication[ ]

The class DBusApplication behaves like a read-only array. The following two source texts use this fact - the first only formally:

  Dim hDBusApplication As DBusApplication
  Dim hDBusProxy As DBusProxy

  hDBusProxy = hDBusApplication [ ObjectPath As String [ , Interface As String ] ]

hDBusProxy returns a proxy to an (existing) D-Bus object specified in the first parameter.

  • ObjectPath is the D-Bus path to the object.
  • Interface is the interface of the object you want to use.

If the argument for the optional parameter Interface is not specified, you have access to each method and all properties of the (exported) object. Otherwise, you only have access to methods and properties of the specified interface - as in the following example:

  Dim hDBusApplication As DBusApplication
  Dim hDBusProxy As DBusProxy
  Dim sDBusName, sDBusObjectPath, sDBusInterface As String
  Dim hConnection As DBusConnection
  hConnection =  DBus.Session
  sDBusName = "org.freedesktop.Notifications"
  sDBusObjectPath = "/org/freedesktop/Notifications"
  sDBusInterface = "org.freedesktop.Notifications"
  hDBusApplication = New DBusApplication(hConnection, sDBusName)
  hDBusProxy = New DBusProxy(hDBusApplication, sDBusObjectPath, sDBusInterface)

In terms of good data encapsulation, the generation of an interface on the side of the application that exports the object to the D-Bus is always an advantage.


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.3/start.txt · Last modified: 02.07.2018 (external edit)

Page Tools