dbus: Nodes and Interfaces

 
 2.4 Detecting object paths and interfaces.
 ==========================================
 
 The first elements, to be introspected for a D-Bus object, are further
 object paths and interfaces.
 
  -- Function: dbus-introspect-get-node-names bus service path
      All node names of SERVICE in D-Bus BUS at object path PATH are
      returned as list of strings.  Example:
 
           (dbus-introspect-get-node-names
             :session "org.gnome.seahorse" "/org/gnome/seahorse")
 
           ⇒ ("crypto" "keys")
 
      The node names stand for further object paths of the D-Bus SERVICE,
      relative to PATH.  In the example, ‘/org/gnome/seahorse/crypto’ and
      ‘/org/gnome/seahorse/keys’ are also object paths of the D-Bus
      service ‘org.gnome.seahorse’.
 
  -- Function: dbus-introspect-get-all-nodes bus service path
      This function returns all node names of SERVICE in D-Bus BUS at
      object path PATH.  It returns a list of strings with all object
      paths of SERVICE, starting at PATH.  Example:
 
           (dbus-introspect-get-all-nodes :session "org.gnome.seahorse" "/")
 
           ⇒ ("/" "/org" "/org/gnome" "/org/gnome/seahorse"
               "/org/gnome/seahorse/crypto"
               "/org/gnome/seahorse/keys"
               "/org/gnome/seahorse/keys/openpgp"
               "/org/gnome/seahorse/keys/openpgp/local"
               "/org/gnome/seahorse/keys/openssh"
               "/org/gnome/seahorse/keys/openssh/local")
 
  -- Function: dbus-introspect-get-interface-names bus service path
      There will be returned a list strings of all interface names of
      SERVICE in D-Bus BUS at object path PATH.  This list will contain
      the default interface ‘org.freedesktop.DBus.Introspectable’.
 
      Another default interface is ‘org.freedesktop.DBus.Properties’.  If
      present, ‘interface’ elements can also have ‘property’ children.
      Example:
 
           (dbus-introspect-get-interface-names
             :system "org.freedesktop.Hal"
             "/org/freedesktop/Hal/devices/computer")
 
           ⇒ ("org.freedesktop.DBus.Introspectable"
               "org.freedesktop.Hal.Device"
               "org.freedesktop.Hal.Device.SystemPowerManagement"
               "org.freedesktop.Hal.Device.CPUFreq")
 
  -- Function: dbus-introspect-get-interface bus service path interface
      Return INTERFACE of SERVICE in D-Bus BUS at object path PATH.  The
      return value is an XML element.  INTERFACE must be a string,
      element of the list returned by
      ‘dbus-introspect-get-interface-names’.  Example:
 
           (dbus-introspect-get-interface
             :session "org.freedesktop.xesam.searcher"
             "/org/freedesktop/xesam/searcher/main"
             "org.freedesktop.xesam.Search")
 
           ⇒ (interface ((name . "org.freedesktop.xesam.Search"))
                (method ((name . "GetHitData"))
                  (arg ((name . "search") (type . "s") (direction . "in")))
                  (arg ((name . "hit_ids") (type . "au") (direction . "in")))
                  (arg ((name . "fields") (type . "as") (direction . "in")))
                  (arg ((name . "hit_data") (type . "aav") (direction . "out")))
                )
                ...
                (signal ((name . "HitsAdded"))
                  (arg ((name . "search") (type . "s")))
                  (arg ((name . "count") (type . "u")))
                )
              )
 
 With these functions, it is possible to retrieve all introspection data
 from a running system:
 
      (with-current-buffer (switch-to-buffer "*introspect*")
        (erase-buffer)
        (dolist (service (dbus-list-known-names :session))
          (dolist (path (dbus-introspect-get-all-nodes :session service "/"))
            ;; We want to introspect only elements, which have more than
            ;; the default interface "org.freedesktop.DBus.Introspectable".
            (when (delete
                   "org.freedesktop.DBus.Introspectable"
                   (dbus-introspect-get-interface-names :session service path))
              (insert (message "\nservice: \"%s\" path: \"%s\"\n" service path)
                      (dbus-introspect :session service path))
              (redisplay t)))))