This is ../../info/dbus, produced by makeinfo version 4.8 from
dbus.texi.

   Copyright (C) 2007, 2008 Free Software Foundation, Inc.

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.2 or any later version published by the Free Software
     Foundation; with no Invariant Sections, with the Front-Cover texts
     being "A GNU Manual", and with the Back-Cover Texts as in (a)
     below.  A copy of the license is included in the section entitled
     "GNU Free Documentation License" in the Emacs manual.

     (a) The FSF's Back-Cover Text is: "You have freedom to copy and
     modify this GNU Manual, like GNU software.  Copies published by
     the Free Software Foundation raise funds for GNU development."

     This document is part of a collection distributed under the GNU
     Free Documentation License.  If you want to distribute this
     document separately from the collection, you can do so by adding a
     copy of the license to the document, as described in section 6 of
     the license.

INFO-DIR-SECTION Emacs
START-INFO-DIR-ENTRY
* D-Bus: (dbus).                Using D-Bus in Emacs.
END-INFO-DIR-ENTRY


File: dbus,  Node: Top,  Next: Overview,  Prev: (dir),  Up: (dir)

D-Bus integration in Emacs
**************************

This manual documents an API for usage of D-Bus in Emacs.(1)  D-Bus is
a message bus system, a simple way for applications to talk to one
another.  An overview of D-Bus can be found at
`http://dbus.freedesktop.org/'.

   Copyright (C) 2007, 2008 Free Software Foundation, Inc.

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.2 or any later version published by the Free Software
     Foundation; with no Invariant Sections, with the Front-Cover texts
     being "A GNU Manual", and with the Back-Cover Texts as in (a)
     below.  A copy of the license is included in the section entitled
     "GNU Free Documentation License" in the Emacs manual.

     (a) The FSF's Back-Cover Text is: "You have freedom to copy and
     modify this GNU Manual, like GNU software.  Copies published by
     the Free Software Foundation raise funds for GNU development."

     This document is part of a collection distributed under the GNU
     Free Documentation License.  If you want to distribute this
     document separately from the collection, you can do so by adding a
     copy of the license to the document, as described in section 6 of
     the license.

* Menu:

* Overview::                    An overview of D-Bus.
* Inspection::                  Inspection of the bus names.
* Type Conversion::             Mapping Lisp types and D-Bus types.
* Synchronous Methods::         Calling methods in a blocking way.
* Receiving Method Calls::      Offering own methods.
* Signals::                     Sending and receiving signals.
* Errors and Events::           Errors and events.
* GNU Free Documentation License:: The license for this documentation.

   ---------- Footnotes ----------

   (1) D-Bus is not enabled by default.  You must run `./configure
--with-dbus' in Emacs' top level directory, before you compile Emacs.


File: dbus,  Node: Overview,  Next: Inspection,  Prev: Top,  Up: Top

1 An overview of D-Bus
**********************

D-Bus is an inter-process communication mechanism for applications
residing on the same host.  The communication is based on "messages".
Data in the messages is carried in a structured way, it is not just a
byte stream.

   The communication is connection oriented to two kinds of message
buses: a so called "system bus", and a "session bus".  On a given
machine, there is always one single system bus for miscellaneous
system-wide communication, like changing of hardware configuration.  On
the other hand, the session bus is always related to a single user's
session.

   Every client application, which is connected to a bus, registers
under a "unique name" at the bus.  This name is used for identifying the
client application.  Such a unique name starts always with a colon, and
looks like `:1.42'.

   Additionally, a client application can register itself to a so called
"known name", which is a series of identifiers separated by dots, as in
`org.gnu.Emacs'.  If several applications register to the same known
name, these registrations are queued, and only the first application
which has registered for the known name is reachable via this name.  If
this application disconnects from the bus, the next queued unique name
becomes the owner of this known name.

   An application can install one or several objects under its name.
Such objects are identified by an "object path", which looks similar to
paths in a filesystem.  An example of such an object path could be
`/org/gnu/Emacs/'.

   Applications might send a request to an object, that means sending a
message with some data as input parameters, and receiving a message
from that object with the result of this message, the output
parameters.  Such a request is called "method" in D-Bus.

   The other form of communication are "signals".  The underlying
message is emitted from an object and will be received by all other
applications which have registered for such a signal.

   All methods and signals an object supports are called "interface" of
the object.  Interfaces are specified under a hierarchical name in
D-Bus; an object can support several interfaces.  Such an interface
name could be `org.gnu.Emacs.TextEditor' or `org.gnu.Emacs.FileManager'.


File: dbus,  Node: Inspection,  Next: Type Conversion,  Prev: Overview,  Up: Top

2 Inspection of the bus names.
******************************

There are several basic functions which inspect the buses for
registered names.  Internally they use the basic interface
`org.freedesktop.DBus', which is supported by all objects of a bus.

 -- Function: dbus-list-activatable-names
     This function returns the D-Bus service names, which can be
     activated.  An activatable service is described in a service
     registration file.  Under GNU/Linux, such files are located at
     `/usr/share/dbus-1/services/'.

     The result is a list of strings, which is `nil' when there are no
     activatable service names at all.

 -- Function: dbus-list-names bus
     All service names, which are registered at D-Bus BUS, are
     returned.  The result is a list of strings, which is `nil' when
     there are no registered service names at all.  Well known names are
     strings like `org.freedesktop.DBus'.  Names starting with `:' are
     unique names for services.

     BUS must be either the symbol `:system' or the symbol `:session'.

 -- Function: dbus-list-known-names bus
     Retrieves all services which correspond to a known name in BUS.  A
     service has a known name if it doesn't start with `:'.  The result
     is a list of strings, which is `nil' when there are no known names
     at all.

     BUS must be either the symbol `:system' or the symbol `:session'.

 -- Function: dbus-list-queued-owners bus service
     For a given service, registered at D-Bus BUS under the name
     SERVICE, all queued unique names are returned.  The result is a
     list of strings, or `nil' when there are no queued names for
     SERVICE at all.

     BUS must be either the symbol `:system' or the symbol `:session'.
     SERVICE must be a known service name as string.

 -- Function: dbus-get-name-owner bus service
     For a given service, registered at D-Bus BUS under the name
     SERVICE, the unique name of the name owner is returned.  The
     result is a string, or `nil' when there exist no name owner of
     SERVICE.

     BUS must be either the symbol `:system' or the symbol `:session'.
     SERVICE must be a known service name as string.

 -- Function: dbus-ping bus service
     Check whether the service name SERVICE is registered at D-Bus BUS.
     SERVICE might not have been started yet.  The result is either
     `t' or `nil'.

     BUS must be either the symbol `:system' or the symbol `:session'.
     SERVICE must be a string.  Example:

          (message
             "%s screensaver on board."
             (cond
               ((dbus-ping :session "org.gnome.ScreenSaver") "Gnome")
               ((dbus-ping :session "org.freedesktop.ScreenSaver") "KDE")
               (t "No")))

 -- Function: dbus-get-unique-name bus
     The unique name, under which Emacs is registered at D-Bus BUS, is
     returned as string.

     BUS must be either the symbol `:system' or the symbol `:session'.

 -- Function: dbus-introspect bus service path
     Objects can publish there interfaces to the D-Bus.  This function
     returns all interfaces of SERVICE, registered at object path PATH
     at bus BUS.

     BUS must be either the symbol `:system' or the symbol `:session'.
     SERVICE must be a known service name, and PATH must be a valid
     object path.  The last two parameters are strings.  The result,
     the introspection data, is a string in XML format. Example:

          (dbus-introspect
            :system "org.freedesktop.Hal"
            "/org/freedesktop/Hal/devices/computer")

          => "<!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.Hal.Device\">
                  <method name=\"GetAllProperties\">
                    <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>
                  </method>
                  ...
                  <signal name=\"PropertyModified\">
                    <arg name=\"num_updates\" type=\"i\"/>
                    <arg name=\"updates\" type=\"a(sbb)\"/>
                  </signal>
                </interface>
                ...
              </node>"

     This example informs us, that the service `org.freedesktop.Hal' at
     object path `/org/freedesktop/Hal/devices/computer' offers the
     interface `org.freedesktop.Hal.Device' (and 2 other interfaces not
     documented here).  This interface contains the method
     `GetAllProperties', which needs no input parameters, but returns
     as output parameter an array of dictionary entries (key-value
     pairs).  Every dictionary entry has a string as key, and a variant
     as value.

     The interface offers also a signal, which returns 2 parameters: an
     integer, and an array consisting of elements which are a struct of
     a string and 2 boolean values.

     Such type descriptions are called "signature" in D-Bus.  For a
     discussion of D-Bus types and their Lisp representation see *Note
     Type Conversion::.(1)

   ---------- Footnotes ----------

   (1) D-Bus signatures are explained in the D-Bus specification
`http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-signatures'.
The interfaces of the service `org.freedesktop.Hal' are described at
`http://people.freedesktop.org/~david/hal-spec/hal-spec.html#interfaces'.


File: dbus,  Node: Type Conversion,  Next: Synchronous Methods,  Prev: Inspection,  Up: Top

3 Mapping Lisp types and D-Bus types.
*************************************

D-Bus method calls and signals accept usually several arguments as
parameters, either as input parameter, or as output parameter.  Every
argument belongs to a D-Bus type.

   Such arguments must be mapped between the value encoded as a D-Bus
type, and the corresponding type of Lisp objects.  The mapping is
applied Lisp object ==> D-Bus type for input parameters, and D-Bus type
==> Lisp object for output parameters.

3.1 Input parameters.
=====================

Input parameters for D-Bus methods and signals occur as arguments of a
Lisp function call.  The following mapping to D-Bus types is applied,
when the corresponding D-Bus message is created:

     Lisp type             D-Bus type

     `t' and `nil'   ==>   DBUS_TYPE_BOOLEAN
     number          ==>   DBUS_TYPE_UINT32
     integer         ==>   DBUS_TYPE_INT32
     float           ==>   DBUS_TYPE_DOUBLE
     string          ==>   DBUS_TYPE_STRING
     list            ==>   DBUS_TYPE_ARRAY

   Other Lisp objects, like symbols or hash tables, are not accepted as
input parameter.

   If it is necessary to use another D-Bus type, a corresponding type
symbol can be preceeded to the corresponding Lisp object. Basic D-Bus
types are represented by the type symbols `:byte', `:boolean',
`:int16', `:uint16', `:int32', `:uint32', `:int64', `:uint64',
`:double', `:string', `:object-path' and `:signature'.

Example:

     (dbus-call-method ... NUMBER STRING)

   is equivalent to

     (dbus-call-method ... :uint32 NUMBER :string STRING)

   but different to

     (dbus-call-method ... :int32 NUMBER :signature STRING)

   The value for a byte D-Bus type can be any integer in the range 0
through 255.  If a character is used as argument, modifiers represented
outside this range are stripped of.  For example, `:byte ?x' is equal
to `:byte ?\M-x', but it is not equal to `:byte ?\C-x' or `:byte
?\M-\C-x'.

   A D-Bus compound type is always represented as a list.  The CAR of
this list can be the type symbol `:array', `:variant', `:struct' or
`:dict-entry', which would result in a corresponding D-Bus container.
`:array' is optional, because this is the default compound D-Bus type
for a list.

   The objects being elements of the list are checked according to the
D-Bus compound type rules.

   * An array must contain only elements of the same D-Bus type.  It
     can be empty.

   * A variant must contain only one single element.

   * A dictionary entry must be element of an array, and it must
     contain only a key-value pair of two elements, with a basic D-Bus
     type key.

   * There is no restriction for structs.

   If an empty array needs an element D-Bus type other than string, it
can contain exactly one element of D-Bus type `:signature'.  The value
of this element (a string) is used as the signature of the elements of
this array.  Example:

     (dbus-call-method
       :session "org.freedesktop.Notifications"
       "/org/freedesktop/Notifications"
       "org.freedesktop.Notifications" "Notify"
       "GNU Emacs"                 ;; Application name.
       0                           ;; No replacement of other notifications.
       ""                          ;; No icon.
       "Notification summary"      ;; Summary.
       (format                     ;; Body.
         "This is a test notification, raised from %s" (emacs-version))
       '(:array)                   ;; No actions (empty array of strings).
       '(:array :signature "{sv}") ;; No hints
                                   ;; (empty array of dictionary entries).
       ':int32 -1)                 ;; Default timeout.

     => 3

3.2 Output parameters.
======================

Output parameters of D-Bus methods and signals are mapped to Lisp
objects.

     D-Bus type                    Lisp type

     DBUS_TYPE_BOOLEAN       ==>   `t' or `nil'
     DBUS_TYPE_BYTE          ==>   number
     DBUS_TYPE_UINT16        ==>   number
     DBUS_TYPE_INT16         ==>   number
     DBUS_TYPE_UINT32        ==>   number or float
     DBUS_TYPE_INT32         ==>   number or float
     DBUS_TYPE_UINT64        ==>   number or float
     DBUS_TYPE_INT64         ==>   number or float
     DBUS_TYPE_DOUBLE        ==>   float
     DBUS_TYPE_STRING        ==>   string
     DBUS_TYPE_OBJECT_PATH   ==>   string
     DBUS_TYPE_SIGNATURE     ==>   string
     DBUS_TYPE_ARRAY         ==>   list
     DBUS_TYPE_VARIANT       ==>   list
     DBUS_TYPE_STRUCT        ==>   list
     DBUS_TYPE_DICT_ENTRY    ==>   list

   A float object in case of `DBUS_TYPE_UINT32', `DBUS_TYPE_INT32',
`DBUS_TYPE_UINT64' and `DBUS_TYPE_INT6432' is returned, when the C
value exceeds the Emacs number size range.

   The resulting list of the last 4 D-Bus compound types contains as
elements the elements of the D-Bus container, mapped according to the
same rules.

   The signal `PropertyModified', discussed as example in *Note
Inspection::, would offer as Lisp data the following object (BOOL
stands here for either `nil' or `t'):

     (NUMBER ((STRING BOOL BOOL) (STRING BOOL BOOL) ...))


File: dbus,  Node: Synchronous Methods,  Next: Receiving Method Calls,  Prev: Type Conversion,  Up: Top

4 Calling methods in a blocking way.
************************************

Methods can be called synchronously ("blocking") or asynchronously
("non-blocking").  Currently, just synchronous methods are implemented.

   At D-Bus level, a method call consist of two messages: one message
which carries the input parameters to the object owning the method to
be called, and a reply message returning the resulting output
parameters from the object.

 -- Function: dbus-call-method bus service path interface method
          &optional :timeout timeout &rest args
     This function calls METHOD on the D-Bus BUS.  BUS is either the
     symbol `:system' or the symbol `:session'.

     SERVICE is the D-Bus service name to be used.  PATH is the D-Bus
     object path, SERVICE is registered at.  INTERFACE is an interface
     offered by SERVICE.  It must provide METHOD.

     If the parameter `:timeout' is given, the following integer
     TIMEOUT specifies the maximun number of milliseconds the method
     call must return.  The default value is 25.000.  If the method call
     doesn't return in time, a D-Bus error is raised (*note Errors and
     Events::).

     All other arguments args are passed to METHOD as arguments.  They
     are converted into D-Bus types as described in *Note Type
     Conversion::.

     The function returns the resulting values of METHOD as a list of
     Lisp objects, according to the type conversion rules described in
     *Note Type Conversion::.  Example:

          (dbus-call-method
            :session "org.gnome.seahorse" "/org/gnome/seahorse/keys/openpgp"
            "org.gnome.seahorse.Keys" "GetKeyField"
            "openpgp:657984B8C7A966DD" "simple-name")

          => (t ("Philip R. Zimmermann"))

     If the result of the method call is just one value, the converted
     Lisp object is returned instead of a list containing this single
     Lisp object.  Example:

          (dbus-call-method
            :system "org.freedesktop.Hal"
            "/org/freedesktop/Hal/devices/computer"
            "org.freedesktop.Hal.Device" "GetPropertyString"
            "system.kernel.machine")

          => "i686"

     With the `dbus-introspect' function it is possible to explore the
     interfaces of `org.freedesktop.Hal' service. It offers the
     interfaces `org.freedesktop.Hal.Manager' for the object at the
     path `/org/freedesktop/Hal/Manager' as well as the interface
     `org.freedesktop.Hal.Device' for all objects prefixed with the
     path `/org/freedesktop/Hal/devices'.  With the methods
     `GetAllDevices' and `GetAllProperties', it is simple to emulate
     the `lshal' command on GNU/Linux systems:

          (dolist (device
                    (dbus-call-method
                      :system "org.freedesktop.Hal"
                      "/org/freedesktop/Hal/Manager"
                      "org.freedesktop.Hal.Manager" "GetAllDevices"))
            (message "\nudi = %s" device)
            (dolist (properties
                      (dbus-call-method
                        :system "org.freedesktop.Hal" device
                        "org.freedesktop.Hal.Device" "GetAllProperties"))
              (message "  %s = %S"
                       (car properties) (or (caar (cdr properties)) ""))))

          -| "udi = /org/freedesktop/Hal/devices/computer
                info.addons = (\"hald-addon-acpi\")
                info.bus = \"unknown\"
                info.product = \"Computer\"
                info.subsystem = \"unknown\"
                info.udi = \"/org/freedesktop/Hal/devices/computer\"
                linux.sysfs_path_device = \"(none)\"
                power_management.acpi.linux.version = \"20051216\"
                power_management.can_suspend_to_disk = t
                power_management.can_suspend_to_ram = \"\"
                power_management.type = \"acpi\"
                smbios.bios.release_date = \"11/07/2001\"
                system.chassis.manufacturer = \"COMPAL\"
                system.chassis.type = \"Notebook\"
                system.firmware.release_date = \"03/19/2005\"
                ..."


File: dbus,  Node: Receiving Method Calls,  Next: Signals,  Prev: Synchronous Methods,  Up: Top

5 Offering own methods.
***********************

Emacs can also offer own methods, which can be called by other
applications.  These methods could be an implementation of an interface
of a well known service, like `org.freedesktop.TextEditor'.

   It could be also an implementation of an own interface.  In this
case, the service name must be `org.gnu.Emacs'.  The object path shall
begin with `/org/gnu/Emacs/*Application*/', and the interface name
shall be `org.gnu.Emacs.*Application*'.  `*Application*' is the name of
the application which provides the interface.

 -- Function: dbus-register-method bus service path interface method
          handler
     With this function, an application registers METHOD on the D-Bus
     BUS.

     BUS is either the symbol `:system' or the symbol `:session'.

     SERVICE is the D-Bus service name of the D-Bus object METHOD is
     registered for.  It must be a known name.

     PATH is the D-Bus object path SERVICE is registered.

     INTERFACE is the interface offered by SERVICE.  It must provide
     METHOD.

     HANDLER is a Lisp function to be called when when a METHOD call is
     is received.  It must accept as arguments the input arguments of
     METHOD.  HANDLER must return a list, which elements are used as
     arguments for the reply message of METHOD.  This list can be
     composed like the input parameters in *Note Type Conversion::.

     The default D-Bus timeout when waiting for a message reply is 25
     seconds.  This value could be even smaller, depending on the
     calling client.  Therefore, HANDLER shall not last longer than
     absolutely necessary.

     `dbus-register-method' returns a Lisp symbol, which can be used as
     argument in `dbus-unregister-object' for removing the registration
     for METHOD.  Example:

          (defun my-dbus-method-handler (filename)
            (let (result)
              (if (find-file filename)
                  (setq result '(:boolean t))
                (setq result '(:boolean nil)))
              result))

          => my-dbus-method-handler

          (dbus-register-method
            :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
            "org.freedesktop.TextEditor" "OpenFile"
            'my-dbus-method-handler)

          => ((:system "org.freedesktop.TextEditor" "OpenFile")
              ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
               my-method-handler))

     If you invoke the method `org.freedesktop.TextEditor.OpenFile'
     from another D-Bus application with a filename as parameter, the
     file is opened in Emacs, and the method returns either TRUE or
     FALSE, indicating the success if the method.  As test tool one
     could use the command line tool `dbus-send' in a shell:

          # dbus-send --session --print-reply \
              --dest="org.freedesktop.TextEditor" \
              "/org/freedesktop/TextEditor" \
              "org.freedesktop.TextEditor.OpenFile" string:"/etc/hosts"

          -| method return sender=:1.22 -> dest=:1.23 reply_serial=2
               boolean true


File: dbus,  Node: Signals,  Next: Errors and Events,  Prev: Receiving Method Calls,  Up: Top

6 Sending and receiving signals.
********************************

Signals are broadcast messages.  They carry input parameters, which are
received by all objects which have registered for such a signal.

 -- Function: dbus-send-signal bus service path interface signal &rest
          args
     This function is similar to `dbus-call-method'.  The difference
     is, that there are no returning output parameters.

     The function emits SIGNAL on the D-Bus BUS.  BUS is either the
     symbol `:system' or the symbol `:session'.  It doesn't matter
     whether another object has registered for SIGNAL.

     SERVICE is the D-Bus service name of the object the signal is
     emitted from.  PATH is the corresponding D-Bus object path,
     SERVICE is registered at.  INTERFACE is an interface offered by
     SERVICE.  It must provide SIGNAL.

     All other arguments args are passed to SIGNAL as arguments.  They
     are converted into D-Bus types as described in *Note Type
     Conversion::.  Example:

          (dbus-send-signal
            :session "org.gnu.Emacs" "/org/gnu/Emacs"
            "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs")

 -- Function: dbus-register-signal bus service path interface signal
          handler
     With this function, an application registers for SIGNAL on the
     D-Bus BUS.

     BUS is either the symbol `:system' or the symbol `:session'.

     SERVICE is the D-Bus service name used by the sending D-Bus
     object.  It can be either a known name or the unique name of the
     D-Bus object sending the signal.  In case of a unique name,
     signals won't be received any longer once the object owning this
     unique name has disappeared, and a new queued object has replaced
     it.

     When SERVICE is `nil', related signals from all D-Bus objects
     shall be accepted.

     PATH is the corresponding D-Bus object path, SERVICE is registered
     at.  It can also be `nil' if the path name of incoming signals
     shall not be checked.

     INTERFACE is an interface offered by SERVICE.  It must provide
     SIGNAL.

     HANDLER is a Lisp function to be called when the SIGNAL is
     received.  It must accept as arguments the output parameters
     SIGNAL is sending.  Example:

          (defun my-dbus-signal-handler (device)
            (message "Device %s added" device))

          => my-dbus-signal-handler

          (dbus-register-signal
            :system "org.freedesktop.Hal" "/org/freedesktop/Hal/Manager"
            "org.freedesktop.Hal.Manager" "DeviceAdded"
            'my-dbus-signal-handler)

          => ((:system "org.freedesktop.Hal.Manager" "DeviceAdded")
              ("org.freedesktop.Hal" "/org/freedesktop/Hal/Manager"
               my-signal-handler))

     As we know from the inspection data of interface
     `org.freedesktop.Hal.Manager', the signal `DeviceAdded' provides
     one single parameter, which is mapped into a Lisp string.  The
     callback function `my-dbus-signal-handler' must define one single
     string argument therefore.  Plugging an USB device to your
     machine, when registered for signal `DeviceAdded', will show you
     which objects the GNU/Linux `hal' daemon adds.

     `dbus-register-signal' returns a Lisp symbol, which can be used as
     argument in `dbus-unregister-object' for removing the registration
     for SIGNAL.

 -- Function: dbus-unregister-object object
     Unregister OBJECT from the the D-Bus.  OBJECT must be the result
     of a preceding `dbus-register-signal' or `dbus-register-method'
     call.  It returns `t' if OBJECT has been unregistered, `nil'
     otherwise.


File: dbus,  Node: Errors and Events,  Next: GNU Free Documentation License,  Prev: Signals,  Up: Top

7 Errors and events.
********************

Input parameters of `dbus-call-method' and `dbus-register-signal' are
checked for correct D-Bus types. If there is a type mismatch, the Lisp
error `wrong-type-argument' `D-Bus ARG' is raised.

   All errors raised by D-Bus are signaled with the error symbol
`dbus-error'.  If possible, error messages from D-Bus are appended to
the `dbus-error'.

 -- Special Form: dbus-ignore-errors forms...
     This executes FORMS exactly like a `progn', except that
     `dbus-error' errors are ignored during the FORMS.  These errors
     can be made visible when variable `dbus-debug' is set to `t'.

   Incoming D-Bus messages are handled as Emacs events (see *note Misc
Events: (elisp)Misc Events.).  The generated event has this form:

     (dbus-event BUS SERIAL SERVICE PATH INTERFACE MEMBER HANDLER &rest ARGS)

   BUS identifies the D-Bus the signal is coming from.  It is either
the symbol `:system' or the symbol `:session'.

   SERIAL is the serial number of the received D-Bus message if it is a
method call, or `nil'.

   SERVICE and PATH are the unique name and the object path of the
D-Bus object emitting the message.  INTERFACE and MEMBER denote the
message which has been sent.

   HANDLER is the callback function which has been registered for this
message (see *note Signals::).  When a `dbus-event' event arrives,
HANDLER is called with ARGS as arguments.

   In order to inspect the `dbus-event' data, you could extend the
definition of the callback function in *Note Signals:::

     (defun my-dbus-signal-handler (&rest args)
       (message "my-dbus-signal-handler: %S" last-input-event))

   There exist convenience functions which could be called inside a
callback function in order to retrieve the information from the event.

 -- Function: dbus-event-bus-name event
     Returns the bus name EVENT is coming from.  The result is either
     the symbol `:system' or the symbol `:session'.

 -- Function: dbus-event-serial-number event
     Returns the serial number of the corresponding D-Bus message.  The
     result is a number in case the D-Bus message is a method call, or
     `nil' for all other mesage types.

 -- Function: dbus-event-service-name event
     Returns the unique name of the D-Bus object EVENT is coming from.

 -- Function: dbus-event-path-name event
     Returns the object path of the D-Bus object EVENT is coming from.

 -- Function: dbus-event-interface-name event
     Returns the interface name of of the D-Bus object EVENT is coming
     from.

 -- Function: dbus-event-member-name event
     Returns the member name of of the D-Bus object EVENT is coming
     from.  It is either a signal name or a method name.

   D-Bus errors are not propagated during event handling, because it is
usually not desired.  D-Bus errors in events can be made visible by
setting the variable `dbus-debug' to `t'.


File: dbus,  Node: GNU Free Documentation License,  Prev: Errors and Events,  Up: Top

Appendix A GNU Free Documentation License
*****************************************

                      Version 1.2, November 2002

     Copyright (C) 2000,2001,2002  Free Software Foundation, Inc.
     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

     Everyone is permitted to copy and distribute verbatim copies
     of this license document, but changing it is not allowed.


  0. PREAMBLE

     The purpose of this License is to make a manual, textbook, or other
     functional and useful document "free" in the sense of freedom: to
     assure everyone the effective freedom to copy and redistribute it,
     with or without modifying it, either commercially or
     noncommercially.  Secondarily, this License preserves for the
     author and publisher a way to get credit for their work, while not
     being considered responsible for modifications made by others.

     This License is a kind of "copyleft," which means that derivative
     works of the document must themselves be free in the same sense.
     It complements the GNU General Public License, which is a copyleft
     license designed for free software.

     We have designed this License in order to use it for manuals for
     free software, because free software needs free documentation: a
     free program should come with manuals providing the same freedoms
     that the software does.  But this License is not limited to
     software manuals; it can be used for any textual work, regardless
     of subject matter or whether it is published as a printed book.
     We recommend this License principally for works whose purpose is
     instruction or reference.


  1. APPLICABILITY AND DEFINITIONS

     This License applies to any manual or other work, in any medium,
     that contains a notice placed by the copyright holder saying it
     can be distributed under the terms of this License.  Such a notice
     grants a world-wide, royalty-free license, unlimited in duration,
     to use that work under the conditions stated herein.  The
     "Document," below, refers to any such manual or work.  Any member
     of the public is a licensee, and is addressed as "you."  You
     accept the license if you copy, modify or distribute the work in a
     way requiring permission under copyright law.

     A "Modified Version" of the Document means any work containing the
     Document or a portion of it, either copied verbatim, or with
     modifications and/or translated into another language.

     A "Secondary Section" is a named appendix or a front-matter
     section of the Document that deals exclusively with the
     relationship of the publishers or authors of the Document to the
     Document's overall subject (or to related matters) and contains
     nothing that could fall directly within that overall subject.
     (Thus, if the Document is in part a textbook of mathematics, a
     Secondary Section may not explain any mathematics.)  The
     relationship could be a matter of historical connection with the
     subject or with related matters, or of legal, commercial,
     philosophical, ethical or political position regarding them.

     The "Invariant Sections" are certain Secondary Sections whose
     titles are designated, as being those of Invariant Sections, in
     the notice that says that the Document is released under this
     License.  If a section does not fit the above definition of
     Secondary then it is not allowed to be designated as Invariant.
     The Document may contain zero Invariant Sections.  If the Document
     does not identify any Invariant Sections then there are none.

     The "Cover Texts" are certain short passages of text that are
     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
     that says that the Document is released under this License.  A
     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
     be at most 25 words.

     A "Transparent" copy of the Document means a machine-readable copy,
     represented in a format whose specification is available to the
     general public, that is suitable for revising the document
     straightforwardly with generic text editors or (for images
     composed of pixels) generic paint programs or (for drawings) some
     widely available drawing editor, and that is suitable for input to
     text formatters or for automatic translation to a variety of
     formats suitable for input to text formatters.  A copy made in an
     otherwise Transparent file format whose markup, or absence of
     markup, has been arranged to thwart or discourage subsequent
     modification by readers is not Transparent.  An image format is
     not Transparent if used for any substantial amount of text.  A
     copy that is not "Transparent" is called "Opaque."

     Examples of suitable formats for Transparent copies include plain
     ASCII without markup, Texinfo input format, LaTeX input format,
     SGML or XML using a publicly available DTD, and
     standard-conforming simple HTML, PostScript or PDF designed for
     human modification.  Examples of transparent image formats include
     PNG, XCF and JPG.  Opaque formats include proprietary formats that
     can be read and edited only by proprietary word processors, SGML
     or XML for which the DTD and/or processing tools are not generally
     available, and the machine-generated HTML, PostScript or PDF
     produced by some word processors for output purposes only.

     The "Title Page" means, for a printed book, the title page itself,
     plus such following pages as are needed to hold, legibly, the
     material this License requires to appear in the title page.  For
     works in formats which do not have any title page as such, "Title
     Page" means the text near the most prominent appearance of the
     work's title, preceding the beginning of the body of the text.

     A section "Entitled XYZ" means a named subunit of the Document
     whose title either is precisely XYZ or contains XYZ in parentheses
     following text that translates XYZ in another language.  (Here XYZ
     stands for a specific section name mentioned below, such as
     "Acknowledgements," "Dedications," "Endorsements," or "History.")
     To "Preserve the Title" of such a section when you modify the
     Document means that it remains a section "Entitled XYZ" according
     to this definition.

     The Document may include Warranty Disclaimers next to the notice
     which states that this License applies to the Document.  These
     Warranty Disclaimers are considered to be included by reference in
     this License, but only as regards disclaiming warranties: any other
     implication that these Warranty Disclaimers may have is void and
     has no effect on the meaning of this License.

  2. VERBATIM COPYING

     You may copy and distribute the Document in any medium, either
     commercially or noncommercially, provided that this License, the
     copyright notices, and the license notice saying this License
     applies to the Document are reproduced in all copies, and that you
     add no other conditions whatsoever to those of this License.  You
     may not use technical measures to obstruct or control the reading
     or further copying of the copies you make or distribute.  However,
     you may accept compensation in exchange for copies.  If you
     distribute a large enough number of copies you must also follow
     the conditions in section 3.

     You may also lend copies, under the same conditions stated above,
     and you may publicly display copies.

  3. COPYING IN QUANTITY

     If you publish printed copies (or copies in media that commonly
     have printed covers) of the Document, numbering more than 100, and
     the Document's license notice requires Cover Texts, you must
     enclose the copies in covers that carry, clearly and legibly, all
     these Cover Texts: Front-Cover Texts on the front cover, and
     Back-Cover Texts on the back cover.  Both covers must also clearly
     and legibly identify you as the publisher of these copies.  The
     front cover must present the full title with all words of the
     title equally prominent and visible.  You may add other material
     on the covers in addition.  Copying with changes limited to the
     covers, as long as they preserve the title of the Document and
     satisfy these conditions, can be treated as verbatim copying in
     other respects.

     If the required texts for either cover are too voluminous to fit
     legibly, you should put the first ones listed (as many as fit
     reasonably) on the actual cover, and continue the rest onto
     adjacent pages.

     If you publish or distribute Opaque copies of the Document
     numbering more than 100, you must either include a
     machine-readable Transparent copy along with each Opaque copy, or
     state in or with each Opaque copy a computer-network location from
     which the general network-using public has access to download
     using public-standard network protocols a complete Transparent
     copy of the Document, free of added material.  If you use the
     latter option, you must take reasonably prudent steps, when you
     begin distribution of Opaque copies in quantity, to ensure that
     this Transparent copy will remain thus accessible at the stated
     location until at least one year after the last time you
     distribute an Opaque copy (directly or through your agents or
     retailers) of that edition to the public.

     It is requested, but not required, that you contact the authors of
     the Document well before redistributing any large number of
     copies, to give them a chance to provide you with an updated
     version of the Document.

  4. MODIFICATIONS

     You may copy and distribute a Modified Version of the Document
     under the conditions of sections 2 and 3 above, provided that you
     release the Modified Version under precisely this License, with
     the Modified Version filling the role of the Document, thus
     licensing distribution and modification of the Modified Version to
     whoever possesses a copy of it.  In addition, you must do these
     things in the Modified Version:

     A. Use in the Title Page (and on the covers, if any) a title
     distinct    from that of the Document, and from those of previous
     versions    (which should, if there were any, be listed in the
     History section    of the Document).  You may use the same title
     as a previous version    if the original publisher of that version
     gives permission.
     B. List on the Title Page, as authors, one or more persons or
     entities    responsible for authorship of the modifications in the
     Modified    Version, together with at least five of the principal
     authors of the    Document (all of its principal authors, if it
     has fewer than five),    unless they release you from this
     requirement.
     C. State on the Title page the name of the publisher of the
     Modified Version, as the publisher.
     D. Preserve all the copyright notices of the Document.
     E. Add an appropriate copyright notice for your modifications
     adjacent to the other copyright notices.
     F. Include, immediately after the copyright notices, a license
     notice    giving the public permission to use the Modified Version
     under the    terms of this License, in the form shown in the
     Addendum below.
     G. Preserve in that license notice the full lists of Invariant
     Sections    and required Cover Texts given in the Document's
     license notice.
     H. Include an unaltered copy of this License.
     I. Preserve the section Entitled "History," Preserve its Title,
     and add    to it an item stating at least the title, year, new
     authors, and    publisher of the Modified Version as given on the
     Title Page.  If    there is no section Entitled "History" in the
     Document, create one    stating the title, year, authors, and
     publisher of the Document as    given on its Title Page, then add
     an item describing the Modified    Version as stated in the
     previous sentence.
     J. Preserve the network location, if any, given in the Document for
       public access to a Transparent copy of the Document, and
     likewise    the network locations given in the Document for
     previous versions    it was based on.  These may be placed in the
     "History" section.     You may omit a network location for a work
     that was published at    least four years before the Document
     itself, or if the original    publisher of the version it refers
     to gives permission.
     K. For any section Entitled "Acknowledgements" or "Dedications,"
     Preserve the Title of the section, and preserve in the section all
       the substance and tone of each of the contributor
     acknowledgements    and/or dedications given therein.
     L. Preserve all the Invariant Sections of the Document,
     unaltered in their text and in their titles.  Section numbers
     or the equivalent are not considered part of the section titles.
     M. Delete any section Entitled "Endorsements."  Such a section
     may not be included in the Modified Version.
     N. Do not retitle any existing section to be Entitled
     "Endorsements"    or to conflict in title with any Invariant
     Section.
     O. Preserve any Warranty Disclaimers.

     If the Modified Version includes new front-matter sections or
     appendices that qualify as Secondary Sections and contain no
     material copied from the Document, you may at your option
     designate some or all of these sections as invariant.  To do this,
     add their titles to the list of Invariant Sections in the Modified
     Version's license notice.  These titles must be distinct from any
     other section titles.

     You may add a section Entitled "Endorsements," provided it contains
     nothing but endorsements of your Modified Version by various
     parties-for example, statements of peer review or that the text has
     been approved by an organization as the authoritative definition
     of a standard.

     You may add a passage of up to five words as a Front-Cover Text,
     and a passage of up to 25 words as a Back-Cover Text, to the end
     of the list of Cover Texts in the Modified Version.  Only one
     passage of Front-Cover Text and one of Back-Cover Text may be
     added by (or through arrangements made by) any one entity.  If the
     Document already includes a cover text for the same cover,
     previously added by you or by arrangement made by the same entity
     you are acting on behalf of, you may not add another; but you may
     replace the old one, on explicit permission from the previous
     publisher that added the old one.

     The author(s) and publisher(s) of the Document do not by this
     License give permission to use their names for publicity for or to
     assert or imply endorsement of any Modified Version.

  5. COMBINING DOCUMENTS

     You may combine the Document with other documents released under
     this License, under the terms defined in section 4 above for
     modified versions, provided that you include in the combination
     all of the Invariant Sections of all of the original documents,
     unmodified, and list them all as Invariant Sections of your
     combined work in its license notice, and that you preserve all
     their Warranty Disclaimers.

     The combined work need only contain one copy of this License, and
     multiple identical Invariant Sections may be replaced with a single
     copy.  If there are multiple Invariant Sections with the same name
     but different contents, make the title of each such section unique
     by adding at the end of it, in parentheses, the name of the
     original author or publisher of that section if known, or else a
     unique number.  Make the same adjustment to the section titles in
     the list of Invariant Sections in the license notice of the
     combined work.

     In the combination, you must combine any sections Entitled
     "History" in the various original documents, forming one section
     Entitled "History"; likewise combine any sections Entitled
     "Acknowledgements," and any sections Entitled "Dedications."  You
     must delete all sections Entitled "Endorsements."

  6. COLLECTIONS OF DOCUMENTS

     You may make a collection consisting of the Document and other
     documents released under this License, and replace the individual
     copies of this License in the various documents with a single copy
     that is included in the collection, provided that you follow the
     rules of this License for verbatim copying of each of the
     documents in all other respects.

     You may extract a single document from such a collection, and
     distribute it individually under this License, provided you insert
     a copy of this License into the extracted document, and follow
     this License in all other respects regarding verbatim copying of
     that document.

  7. AGGREGATION WITH INDEPENDENT WORKS

     A compilation of the Document or its derivatives with other
     separate and independent documents or works, in or on a volume of
     a storage or distribution medium, is called an "aggregate" if the
     copyright resulting from the compilation is not used to limit the
     legal rights of the compilation's users beyond what the individual
     works permit.  When the Document is included in an aggregate, this
     License does not apply to the other works in the aggregate which
     are not themselves derivative works of the Document.

     If the Cover Text requirement of section 3 is applicable to these
     copies of the Document, then if the Document is less than one half
     of the entire aggregate, the Document's Cover Texts may be placed
     on covers that bracket the Document within the aggregate, or the
     electronic equivalent of covers if the Document is in electronic
     form.  Otherwise they must appear on printed covers that bracket
     the whole aggregate.

  8. TRANSLATION

     Translation is considered a kind of modification, so you may
     distribute translations of the Document under the terms of section
     4.  Replacing Invariant Sections with translations requires special
     permission from their copyright holders, but you may include
     translations of some or all Invariant Sections in addition to the
     original versions of these Invariant Sections.  You may include a
     translation of this License, and all the license notices in the
     Document, and any Warranty Disclaimers, provided that you also
     include the original English version of this License and the
     original versions of those notices and disclaimers.  In case of a
     disagreement between the translation and the original version of
     this License or a notice or disclaimer, the original version will
     prevail.

     If a section in the Document is Entitled "Acknowledgements,"
     "Dedications," or "History," the requirement (section 4) to
     Preserve its Title (section 1) will typically require changing the
     actual title.

  9. TERMINATION

     You may not copy, modify, sublicense, or distribute the Document
     except as expressly provided for under this License.  Any other
     attempt to copy, modify, sublicense or distribute the Document is
     void, and will automatically terminate your rights under this
     License.  However, parties who have received copies, or rights,
     from you under this License will not have their licenses
     terminated so long as such parties remain in full compliance.

 10. FUTURE REVISIONS OF THIS LICENSE

     The Free Software Foundation may publish new, revised versions of
     the GNU Free Documentation License from time to time.  Such new
     versions will be similar in spirit to the present version, but may
     differ in detail to address new problems or concerns.  See
     http://www.gnu.org/copyleft/.

     Each version of the License is given a distinguishing version
     number.  If the Document specifies that a particular numbered
     version of this License "or any later version" applies to it, you
     have the option of following the terms and conditions either of
     that specified version or of any later version that has been
     published (not as a draft) by the Free Software Foundation.  If
     the Document does not specify a version number of this License,
     you may choose any version ever published (not as a draft) by the
     Free Software Foundation.


ADDENDUM: How to use this License for your documents
====================================================

To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and license
notices just after the title page:

     Copyright (C)  YEAR  YOUR NAME.
     Permission is granted to copy, distribute and/or modify this document
     under the terms of the GNU Free Documentation License, Version 1.2
     or any later version published by the Free Software Foundation;
     with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
     A copy of the license is included in the section entitled ``GNU
     Free Documentation License.''

   If you have Invariant Sections, Front-Cover Texts and Back-Cover
Texts, replace the "with...Texts." line with this:

     with the Invariant Sections being LIST THEIR TITLES, with the
     Front-Cover Texts being LIST, and with the Back-Cover Texts being
     LIST.

   If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.

   If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License, to
permit their use in free software.



Tag Table:
Node: Top1230
Ref: Top-Footnote-13144
Node: Overview3282
Node: Inspection5628
Ref: Inspection-Footnote-110873
Node: Type Conversion11169
Node: Synchronous Methods16379
Node: Receiving Method Calls20608
Node: Signals23820
Node: Errors and Events27573
Node: GNU Free Documentation License30566

End Tag Table
