Next: Arguments and Signatures, Previous: Methods and Signal, Up: Inspection

### 2.5 What else to know about interfaces.

Interfaces can have properties. These can be exposed via the ‘`org.freedesktop.DBus.Properties`’ interface1. That is, properties can be retrieved and changed during lifetime of an element.

Annotations, on the other hand, are static values for an element. Often, they are used to instruct generators, how to generate code from the interface for a given language binding.

— Function: dbus-introspect-get-property-names bus service path interface

> Return a list of strings with all property names of interface of service in D-Bus bus at object path path. Example:

>               (dbus-introspect-get-property-names
>                 :session "org.kde.kded" "/modules/networkstatus"
>                 "org.kde.Solid.Networking.Client")

>               ⇒ ("Status")

> If an interface declares properties, the corresponding element supports also the ‘`org.freedesktop.DBus.Properties`’ interface.

— Function: dbus-introspect-get-property bus service path interface property

> This function returns property of interface as XML element. It must be located at service in D-Bus bus at object path path. property must be a string, element of the list returned by `dbus-introspect-get-property-names`.

> A property value can be retrieved by the function `dbus-introspect-get-attribute`. Example:

>               (dbus-introspect-get-property
>                 :session "org.kde.kded" "/modules/networkstatus"
>                 "org.kde.Solid.Networking.Client" "Status")

>               ⇒ (property ((access . "read") (type . "u") (name . "Status")))

>               (dbus-introspect-get-attribute
>                 (dbus-introspect-get-property
>                   :session "org.kde.kded" "/modules/networkstatus"
>                   "org.kde.Solid.Networking.Client" "Status")
>                 "access")

>               ⇒ "read"

— Function: dbus-get-property bus service path interface property

> This function returns the value of property of interface. It will be checked at bus, service, path. The result can be any valid D-Bus value, or `nil` if there is no property. Example:

>               (dbus-get-property
>                 :session "org.kde.kded" "/modules/networkstatus"
>                 "org.kde.Solid.Networking.Client" "Status")

>               ⇒ 4

— Function: dbus-set-property bus service path interface property value

> Set value of property of interface to value. It will be checked at bus, service, path. When the value has been set successful, the result is value. Otherwise, `nil` is returned. Example:

>               (dbus-set-property
>                 :session "org.kde.kaccess" "/MainApplication"
>                 "com.trolltech.Qt.QApplication" "doubleClickInterval" 500)

>               ⇒ 500

— Function: dbus-get-all-properties bus service path interface

> This function returns all properties of interface. It will be checked at bus, service, path. The result is a list of cons. Every cons contains the name of the property, and its value. If there are no properties, `nil` is returned. Example:

>               (dbus-get-all-properties
>                 :session "org.kde.kaccess" "/MainApplication"
>                 "com.trolltech.Qt.QApplication")

>               ⇒ (("cursorFlashTime" . 1000) ("doubleClickInterval" . 500)
>                   ("keyboardInputInterval" . 400) ("wheelScrollLines" . 3)
>                   ("globalStrut" 0 0) ("startDragTime" . 500)
>                   ("startDragDistance" . 4) ("quitOnLastWindowClosed" . t)
>                   ("styleSheet" . ""))

— Function: dbus-introspect-get-annotation-names bus service path interface &optional name

> Return a list of all annotation names as list of strings. If name is `nil`, the annotations are children of interface, otherwise name must be a `method`, `signal`, or `property` XML element, where the annotations belong to. Example:

>               (dbus-introspect-get-annotation-names
>                 :session "de.berlios.Pinot" "/de/berlios/Pinot"
>                 "de.berlios.Pinot" "GetStatistics")

>               ⇒ ("de.berlios.Pinot.GetStatistics")

> Default annotation names2 are

> ‘`org.freedesktop.DBus.Deprecated`’
>   Whether or not the entity is deprecated; defaults to `nil`
> ‘`org.freedesktop.DBus.GLib.CSymbol`’
>   The C symbol; may be used for `methods` and `interfaces`
> ‘`org.freedesktop.DBus.Method.NoReply`’
>   If set, don't expect a reply to the `method` call; defaults to `nil`

— Function: dbus-introspect-get-annotation bus service path interface name annotation

> Return annotation ANNOTATION as XML object. If name is `nil`, ANNOTATION is a child of interface, otherwise name must be the name of a `method`, `signal`, or `property` XML element, where the ANNOTATION belongs to.

> An attribute value can be retrieved by `dbus-introspect-get-attribute`. Example:

>               (dbus-introspect-get-annotation
>                 :session "de.berlios.Pinot" "/de/berlios/Pinot"
>                 "de.berlios.Pinot" "GetStatistics"
>                 "de.berlios.Pinot.GetStatistics")

>               ⇒ (annotation ((name . "de.berlios.Pinot.GetStatistics")
>                               (value . "pinotDBus")))

>               (dbus-introspect-get-attribute
>                 (dbus-introspect-get-annotation
>                   :session "de.berlios.Pinot" "/de/berlios/Pinot"
>                   "de.berlios.Pinot" "GetStatistics"
>                   "de.berlios.Pinot.GetStatistics")
>                 "value")

>               ⇒ "pinotDBus"

#### Footnotes

[1] See http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties

[2] See http://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format