How to declare use of a standard interface?

Robert Middleton robert.middleton at rm5248.com
Wed Sep 22 01:03:21 UTC 2021


Are you trying to generate code from introspection XMLs, or something
else?  This seems like it would be a highly specific question
depending on what library you are using to talk over the dbus.  Some
implementations/libraries will handle some of this for you
automatically.

If you just want to use them in general in your XML file, the spec may
make a bit more sense:
https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties

Querying the org.freedesktop.Notifications service on my system shows
the following for the properties interface:
  <interface name="org.freedesktop.DBus.Properties">
    <method name="Get">
      <arg type="s" name="interface_name" direction="in"/>
      <arg type="s" name="property_name" direction="in"/>
      <arg type="v" name="value" direction="out"/>
    </method>
    <method name="GetAll">
      <arg type="s" name="interface_name" direction="in"/>
      <arg type="a{sv}" name="properties" direction="out"/>
    </method>
    <method name="Set">
      <arg type="s" name="interface_name" direction="in"/>
      <arg type="s" name="property_name" direction="in"/>
      <arg type="v" name="value" direction="in"/>
    </method>
    <signal name="PropertiesChanged">
      <arg type="s" name="interface_name"/>
      <arg type="a{sv}" name="changed_properties"/>
      <arg type="as" name="invalidated_properties"/>
    </signal>
  </interface>


-Robert Middleton

On Tue, Sep 21, 2021 at 8:15 PM Lawrence D'Oliveiro
<ldo at geek-central.gen.nz> wrote:
>
> 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