User Tools

Site Tools


Sidebar

Network and communication

k24:k24.9:k24.9.8:start

24.9.8.0 DBusVariant - DBusValues

The DBusVariant (gb.dbus) class allows a D-Bus variant value to be defined for a given D-Bus signature. The class DBusValues (gb.dbus) inherits from DBusVariant and provides you with a list of several D-Bus values. The two classes each have only the property DBusValues.Value and one constant each.

The reason for having two classes is that this is the only way to make a distinction between, for example, two methods, one of which returns an array of three values of type Variant and the other of which returns three values, each of which is of type Variant. In both cases, however, there are exactly three D-Bus values!

Therefore, for a signature such as “(ia{sv}av)” you will use the class DBusVariant and for a signature such as “u(ia{sv}av)” you will use the class DBusValues.

24.9.8.0.1 DBusVariant

The DBusVariant (gb.dbus) class allows you to define a D-Bus Variant value with a given D-Bus signature. For example, in the gb.dbus.trayicon component, the definition of a specific signature is done in the _DBusMenuItem.class. The class DBusVariant is used because an array of values is returned:

' Gambas class file
 
Export
Inherits DBusVariant
 
Public Const Signature As String = "(ia{sv}av)"

24.9.8.0.2 DBusValues

Good to know: The DBusValues (gb.dbus) class inherits from DBusVariant and provides you with a list of multiple D-Bus values.

The DBusValues class is used, for example, in the _DBusMenuLayout.class of the gb.dbus.trayicon component:

' Gambas class file
 
Export
Inherits DBusValues
 
Public Const Signature As String = "u(ia{sv}av)"

Note:Use the table at http://gambaswiki.org/wiki/doc/dbus#t10 to learn how Gambas data types are converted to D-Bus data types and vice versa.

In the following 2 chapters with 4 Gambas projects you will learn how to define D-Bus objects for a data server, how to export to the D-Bus and how to use the offered services with a d-bus capable client. In the methods used, complex data types are also used as return values.

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

Page Tools