How to declare use of a standard interface?

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Wed Sep 22 00:08:23 UTC 2021


On Tue, 21 Sep 2021 23:13:48 +0000, Chris Eich wrote:

> The API Design Guidelines recommend using standard interfaces
> <https://dbus.freedesktop.org/doc/dbus-api-design.html#standard-interfaces>
>  like org.freedesktop.DBus.Properties​ and
> org.freedesktop.DBus.ObjectManager​ to avoid declaring boilerplate
> methods.
> 
> However, it's not clear how to use those interfaces if defining
> interfaces using introspection XML. Am I missing something?

An object path <node> tag can include any number of <interface> tags
indicating the interfaces that it supports. For a quick example, this
one has two:

    ldo at theon:dbussy_examples> ./introspect session org.kde.KWin /
    <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
    "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
    <node>
      <interface name="org.freedesktop.DBus.Introspectable">
        <method name="Introspect">
          <arg name="xml_data" type="s" direction="out"/>
        </method>
      </interface>
      <interface name="org.freedesktop.DBus.Peer">
        <method name="Ping"/>
        <method name="GetMachineId">
          <arg name="machine_uuid" type="s" direction="out"/>
        </method>
      </interface>
      <node name="ColorCorrect"/>
      <node name="ColorPicker"/>
      <node name="Compositor"/>
      <node name="Effects"/>
      <node name="FTrace"/>
      <node name="KWin"/>
      <node name="Plugins"/>
      <node name="Screenshot"/>
      <node name="Scripting"/>
      <node name="Session"/>
      <node name="VirtualDesktopManager"/>
      <node name="WindowsRunner"/>
    </node>


More information about the dbus mailing list