comparison doc/misc/dbus.texi @ 109186:29eae48799da

* dbus.texi (Top): Introduce Index. Emphasize "nil" whereever forgotten. (Type Conversion): Precise conversion of natural numbers. (Errors and Events): Add "debugging" to concept index. Add variable `dbus-debug'.
author Michael Albinus <albinus@detlef>
date Fri, 09 Jul 2010 21:24:38 +0200
parents 89fa0d8c2e83
children 8a3f86c30b0c
comparison
equal deleted inserted replaced
109185:908904655a40 109186:29eae48799da
2 @setfilename ../../info/dbus 2 @setfilename ../../info/dbus
3 @c %**start of header 3 @c %**start of header
4 @settitle Using of D-Bus 4 @settitle Using of D-Bus
5 @c @setchapternewpage odd 5 @c @setchapternewpage odd
6 @c %**end of header 6 @c %**end of header
7
8 @syncodeindex vr cp
9 @syncodeindex fn cp
7 10
8 @copying 11 @copying
9 Copyright @copyright{} 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 12 Copyright @copyright{} 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
10 13
11 @quotation 14 @quotation
49 * Synchronous Methods:: Calling methods in a blocking way. 52 * Synchronous Methods:: Calling methods in a blocking way.
50 * Asynchronous Methods:: Calling methods non-blocking. 53 * Asynchronous Methods:: Calling methods non-blocking.
51 * Receiving Method Calls:: Offering own methods. 54 * Receiving Method Calls:: Offering own methods.
52 * Signals:: Sending and receiving signals. 55 * Signals:: Sending and receiving signals.
53 * Errors and Events:: Errors and events. 56 * Errors and Events:: Errors and events.
57 * Index:: Index including concepts, functions, variables.
58
54 * GNU Free Documentation License:: The license for this documentation. 59 * GNU Free Documentation License:: The license for this documentation.
55 @end menu 60 @end menu
56 61
57 62
58 @node Overview 63 @node Overview
416 "name") 421 "name")
417 422
418 @result{} "/org/freedesktop/SystemToolsBackends/UsersConfig" 423 @result{} "/org/freedesktop/SystemToolsBackends/UsersConfig"
419 @end lisp 424 @end lisp
420 425
421 If @var{object} has no @var{attribute}, the function returns nil. 426 If @var{object} has no @var{attribute}, the function returns
427 @code{nil}.
422 @end defun 428 @end defun
423 429
424 430
425 @node Nodes and Interfaces 431 @node Nodes and Interfaces
426 @section Detecting object paths and interfaces. 432 @section Detecting object paths and interfaces.
667 @end defun 673 @end defun
668 674
669 @defun dbus-get-property bus service path interface property 675 @defun dbus-get-property bus service path interface property
670 This function returns the value of @var{property} of @var{interface}. 676 This function returns the value of @var{property} of @var{interface}.
671 It will be checked at @var{bus}, @var{service}, @var{path}. The 677 It will be checked at @var{bus}, @var{service}, @var{path}. The
672 result can be any valid D-Bus value, or nil if there is no 678 result can be any valid D-Bus value, or @code{nil} if there is no
673 @var{property}. Example: 679 @var{property}. Example:
674 680
675 @lisp 681 @lisp
676 (dbus-get-property 682 (dbus-get-property
677 :session "org.kde.kded" "/modules/networkstatus" 683 :session "org.kde.kded" "/modules/networkstatus"
861 Input parameters for D-Bus methods and signals occur as arguments of a 867 Input parameters for D-Bus methods and signals occur as arguments of a
862 Lisp function call. The following mapping to D-Bus types is 868 Lisp function call. The following mapping to D-Bus types is
863 applied, when the corresponding D-Bus message is created: 869 applied, when the corresponding D-Bus message is created:
864 870
865 @example 871 @example
866 @multitable {@code{t} and @code{nil}} {@expansion{}} {DBUS_TYPE_BOOLEAN} 872 @multitable {negative integer} {@expansion{}} {DBUS_TYPE_BOOLEAN}
867 @item Lisp type @tab @tab D-Bus type 873 @item Lisp type @tab @tab D-Bus type
868 @item 874 @item
869 @item @code{t} and @code{nil} @tab @expansion{} @tab DBUS_TYPE_BOOLEAN 875 @item @code{t} and @code{nil} @tab @expansion{} @tab DBUS_TYPE_BOOLEAN
870 @item number @tab @expansion{} @tab DBUS_TYPE_UINT32 876 @item natural number @tab @expansion{} @tab DBUS_TYPE_UINT32
871 @item integer @tab @expansion{} @tab DBUS_TYPE_INT32 877 @item negative integer @tab @expansion{} @tab DBUS_TYPE_INT32
872 @item float @tab @expansion{} @tab DBUS_TYPE_DOUBLE 878 @item float @tab @expansion{} @tab DBUS_TYPE_DOUBLE
873 @item string @tab @expansion{} @tab DBUS_TYPE_STRING 879 @item string @tab @expansion{} @tab DBUS_TYPE_STRING
874 @item list @tab @expansion{} @tab DBUS_TYPE_ARRAY 880 @item list @tab @expansion{} @tab DBUS_TYPE_ARRAY
875 @end multitable 881 @end multitable
876 @end example 882 @end example
887 893
888 @noindent 894 @noindent
889 Example: 895 Example:
890 896
891 @lisp 897 @lisp
892 (dbus-call-method @dots{} @var{NUMBER} @var{STRING}) 898 (dbus-call-method @dots{} @var{NAT-NUMBER} @var{STRING})
893 @end lisp 899 @end lisp
894 900
895 is equivalent to 901 is equivalent to
896 902
897 @lisp 903 @lisp
898 (dbus-call-method @dots{} :uint32 @var{NUMBER} :string @var{STRING}) 904 (dbus-call-method @dots{} :uint32 @var{NAT-NUMBER} :string @var{STRING})
899 @end lisp 905 @end lisp
900 906
901 but different to 907 but different to
902 908
903 @lisp 909 @lisp
904 (dbus-call-method @dots{} :int32 @var{NUMBER} :signature @var{STRING}) 910 (dbus-call-method @dots{} :int32 @var{NAT-NUMBER} :signature @var{STRING})
905 @end lisp 911 @end lisp
906 912
907 The value for a byte D-Bus type can be any integer in the range 0 913 The value for a byte D-Bus type can be any integer in the range 0
908 through 255. If a character is used as argument, modifiers 914 through 255. If a character is used as argument, modifiers
909 represented outside this range are stripped of. For example, 915 represented outside this range are stripped of. For example,
992 998
993 Output parameters of D-Bus methods and signals are mapped to Lisp 999 Output parameters of D-Bus methods and signals are mapped to Lisp
994 objects. 1000 objects.
995 1001
996 @example 1002 @example
997 @multitable {DBUS_TYPE_OBJECT_PATH} {@expansion{}} {@code{t} or @code{nil}} 1003 @multitable {DBUS_TYPE_OBJECT_PATH} {@expansion{}} {natural number or float}
998 @item D-Bus type @tab @tab Lisp type 1004 @item D-Bus type @tab @tab Lisp type
999 @item 1005 @item
1000 @item DBUS_TYPE_BOOLEAN @tab @expansion{} @tab @code{t} or @code{nil} 1006 @item DBUS_TYPE_BOOLEAN @tab @expansion{} @tab @code{t} or @code{nil}
1001 @item DBUS_TYPE_BYTE @tab @expansion{} @tab number 1007 @item DBUS_TYPE_BYTE @tab @expansion{} @tab natural number
1002 @item DBUS_TYPE_UINT16 @tab @expansion{} @tab number 1008 @item DBUS_TYPE_UINT16 @tab @expansion{} @tab natural number
1003 @item DBUS_TYPE_INT16 @tab @expansion{} @tab number 1009 @item DBUS_TYPE_INT16 @tab @expansion{} @tab integer
1004 @item DBUS_TYPE_UINT32 @tab @expansion{} @tab number or float 1010 @item DBUS_TYPE_UINT32 @tab @expansion{} @tab natural number or float
1005 @item DBUS_TYPE_INT32 @tab @expansion{} @tab number or float 1011 @item DBUS_TYPE_INT32 @tab @expansion{} @tab integer or float
1006 @item DBUS_TYPE_UINT64 @tab @expansion{} @tab number or float 1012 @item DBUS_TYPE_UINT64 @tab @expansion{} @tab natural number or float
1007 @item DBUS_TYPE_INT64 @tab @expansion{} @tab number or float 1013 @item DBUS_TYPE_INT64 @tab @expansion{} @tab integer or float
1008 @item DBUS_TYPE_DOUBLE @tab @expansion{} @tab float 1014 @item DBUS_TYPE_DOUBLE @tab @expansion{} @tab float
1009 @item DBUS_TYPE_STRING @tab @expansion{} @tab string 1015 @item DBUS_TYPE_STRING @tab @expansion{} @tab string
1010 @item DBUS_TYPE_OBJECT_PATH @tab @expansion{} @tab string 1016 @item DBUS_TYPE_OBJECT_PATH @tab @expansion{} @tab string
1011 @item DBUS_TYPE_SIGNATURE @tab @expansion{} @tab string 1017 @item DBUS_TYPE_SIGNATURE @tab @expansion{} @tab string
1012 @item DBUS_TYPE_ARRAY @tab @expansion{} @tab list 1018 @item DBUS_TYPE_ARRAY @tab @expansion{} @tab list
1028 The signal @code{PropertyModified}, discussed as example in 1034 The signal @code{PropertyModified}, discussed as example in
1029 @ref{Inspection}, would offer as Lisp data the following object 1035 @ref{Inspection}, would offer as Lisp data the following object
1030 (@var{BOOL} stands here for either @code{nil} or @code{t}): 1036 (@var{BOOL} stands here for either @code{nil} or @code{t}):
1031 1037
1032 @lisp 1038 @lisp
1033 (@var{NUMBER} ((@var{STRING} @var{BOOL} @var{BOOL}) (@var{STRING} @var{BOOL} @var{BOOL}) @dots{})) 1039 (@var{INTEGER} ((@var{STRING} @var{BOOL} @var{BOOL}) (@var{STRING} @var{BOOL} @var{BOOL}) @dots{}))
1034 @end lisp 1040 @end lisp
1035 1041
1036 @defun dbus-byte-array-to-string byte-array 1042 @defun dbus-byte-array-to-string byte-array
1037 If a D-Bus method or signal returns an array of bytes, which are known 1043 If a D-Bus method or signal returns an array of bytes, which are known
1038 to represent an UTF8 string, this function converts @var{byte-array} 1044 to represent an UTF8 string, this function converts @var{byte-array}
1386 @code{:readwrite} can be changed by @code{dbus-set-property}. 1392 @code{:readwrite} can be changed by @code{dbus-set-property}.
1387 1393
1388 The interface @samp{org.freedesktop.DBus.Properties} is added to 1394 The interface @samp{org.freedesktop.DBus.Properties} is added to
1389 @var{path}, including a default handler for the @samp{Get}, 1395 @var{path}, including a default handler for the @samp{Get},
1390 @samp{GetAll} and @samp{Set} methods of this interface. When 1396 @samp{GetAll} and @samp{Set} methods of this interface. When
1391 @var{emits-signal} is non-nil, the signal @samp{PropertiesChanged} is 1397 @var{emits-signal} is non-@code{nil}, the signal
1392 sent when the property is changed by @code{dbus-set-property}. 1398 @samp{PropertiesChanged} is sent when the property is changed by
1399 @code{dbus-set-property}.
1393 1400
1394 @noindent Example: 1401 @noindent Example:
1395 1402
1396 @lisp 1403 @lisp
1397 (dbus-register-property 1404 (dbus-register-property
1572 @end defun 1579 @end defun
1573 1580
1574 1581
1575 @node Errors and Events 1582 @node Errors and Events
1576 @chapter Errors and events. 1583 @chapter Errors and events.
1584 @cindex debugging
1577 @cindex errors 1585 @cindex errors
1578 @cindex events 1586 @cindex events
1587
1588 The internal actions can be traced by running in a debug mode.
1589
1590 @defvar dbus-debug
1591 If this variable is non-@code{nil}, D-Bus specific debug messages are raised.
1592 @end defvar
1579 1593
1580 Input parameters of @code{dbus-call-method}, 1594 Input parameters of @code{dbus-call-method},
1581 @code{dbus-call-method-non-blocking}, 1595 @code{dbus-call-method-non-blocking},
1582 @code{dbus-call-method-asynchronously}, and 1596 @code{dbus-call-method-asynchronously}, and
1583 @code{dbus-register-signal} are checked for correct D-Bus types. If 1597 @code{dbus-register-signal} are checked for correct D-Bus types. If
1589 appended to the @code{dbus-error}. 1603 appended to the @code{dbus-error}.
1590 1604
1591 @defspec dbus-ignore-errors forms@dots{} 1605 @defspec dbus-ignore-errors forms@dots{}
1592 This executes @var{forms} exactly like a @code{progn}, except that 1606 This executes @var{forms} exactly like a @code{progn}, except that
1593 @code{dbus-error} errors are ignored during the @var{forms}. These 1607 @code{dbus-error} errors are ignored during the @var{forms}. These
1594 errors can be made visible when variable @code{dbus-debug} is set to 1608 errors can be made visible when @code{dbus-debug} is set to @code{t}.
1595 @code{t}.
1596 @end defspec 1609 @end defspec
1597 1610
1598 Incoming D-Bus messages are handled as Emacs events, see @pxref{Misc 1611 Incoming D-Bus messages are handled as Emacs events, see @pxref{Misc
1599 Events, , , elisp}. They are retrieved only, when Emacs runs in 1612 Events, , , elisp}. They are retrieved only, when Emacs runs in
1600 interactive mode. The generated event has this form: 1613 interactive mode. The generated event has this form:
1638 The result is either the symbol @code{:system} or the symbol @code{:session}. 1651 The result is either the symbol @code{:system} or the symbol @code{:session}.
1639 @end defun 1652 @end defun
1640 1653
1641 @defun dbus-event-message-type event 1654 @defun dbus-event-message-type event
1642 Returns the message type of the corresponding D-Bus message. The 1655 Returns the message type of the corresponding D-Bus message. The
1643 result is a number. 1656 result is a natural number.
1644 @end defun 1657 @end defun
1645 1658
1646 @defun dbus-event-serial-number event 1659 @defun dbus-event-serial-number event
1647 Returns the serial number of the corresponding D-Bus message. 1660 Returns the serial number of the corresponding D-Bus message.
1648 The result is a number. 1661 The result is a natural number.
1649 @end defun 1662 @end defun
1650 1663
1651 @defun dbus-event-service-name event 1664 @defun dbus-event-service-name event
1652 Returns the unique name of the D-Bus object @var{event} is coming from. 1665 Returns the unique name of the D-Bus object @var{event} is coming from.
1653 @end defun 1666 @end defun
1693 Hook functions shall take into account, that there might be other 1706 Hook functions shall take into account, that there might be other
1694 D-Bus applications running. Therefore, they shall check carefully, 1707 D-Bus applications running. Therefore, they shall check carefully,
1695 whether a given D-Bus error is related to them. 1708 whether a given D-Bus error is related to them.
1696 1709
1697 1710
1711 @node Index
1712 @unnumbered Index
1713
1714 @printindex cp
1715
1716
1698 @node GNU Free Documentation License 1717 @node GNU Free Documentation License
1699 @appendix GNU Free Documentation License 1718 @appendix GNU Free Documentation License
1700 @include doclicense.texi 1719 @include doclicense.texi
1701 1720
1702 @bye 1721 @bye