aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/misc/ChangeLog6
-rw-r--r--doc/misc/dbus.texi656
2 files changed, 627 insertions, 35 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index c9e7c3671ca..6df3f5b19a6 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,9 @@
12008-07-18 Michael Albinus <michael.albinus@gmx.de>
2
3 * dbus.texi (Inspection): Rework, introduce submenus.
4 (Bus names, Introspection, Nodes and Interfaces, Methods and Signal)
5 (Properties and Annotations, Arguments and Signatures): New nodes.
6
12008-07-13 Michael Albinus <michael.albinus@gmx.de> 72008-07-13 Michael Albinus <michael.albinus@gmx.de>
2 8
3 * dbus.texi (Receiving Method Calls): Fix description of 9 * dbus.texi (Receiving Method Calls): Fix description of
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi
index 2baf6d68d60..32eb32da719 100644
--- a/doc/misc/dbus.texi
+++ b/doc/misc/dbus.texi
@@ -27,6 +27,7 @@ developing GNU and promoting software freedom.''
27* D-Bus: (dbus). Using D-Bus in Emacs. 27* D-Bus: (dbus). Using D-Bus in Emacs.
28@end direntry 28@end direntry
29 29
30
30@node Top, Overview, (dir), (dir) 31@node Top, Overview, (dir), (dir)
31@top D-Bus integration in Emacs 32@top D-Bus integration in Emacs
32 33
@@ -41,7 +42,7 @@ be found at @uref{http://dbus.freedesktop.org/}.
41 42
42@menu 43@menu
43* Overview:: An overview of D-Bus. 44* Overview:: An overview of D-Bus.
44* Inspection:: Inspection of the bus names. 45* Inspection:: Inspection of D-Bus services.
45* Type Conversion:: Mapping Lisp types and D-Bus types. 46* Type Conversion:: Mapping Lisp types and D-Bus types.
46* Synchronous Methods:: Calling methods in a blocking way. 47* Synchronous Methods:: Calling methods in a blocking way.
47* Receiving Method Calls:: Offering own methods. 48* Receiving Method Calls:: Offering own methods.
@@ -50,6 +51,7 @@ be found at @uref{http://dbus.freedesktop.org/}.
50* GNU Free Documentation License:: The license for this documentation. 51* GNU Free Documentation License:: The license for this documentation.
51@end menu 52@end menu
52 53
54
53@node Overview 55@node Overview
54@chapter An overview of D-Bus 56@chapter An overview of D-Bus
55@cindex overview 57@cindex overview
@@ -101,9 +103,22 @@ name could be @samp{org.gnu.Emacs.TextEditor} or
101 103
102 104
103@node Inspection 105@node Inspection
104@chapter Inspection of the bus names. 106@chapter Inspection of D-Bus services.
105@cindex inspection 107@cindex inspection
106 108
109@menu
110* Bus names:: Discovering D-Bus names.
111* Introspection:: Knowing the details of D-Bus services.
112* Nodes and Interfaces:: Detecting object paths and interfaces.
113* Methods and Signal:: Applying the functionality.
114* Properties and Annotations:: What else to know about interfaces.
115* Arguments and Signatures:: The final details.
116@end menu
117
118
119@node Bus names
120@section Bus names.
121
107There are several basic functions which inspect the buses for 122There are several basic functions which inspect the buses for
108registered names. Internally they use the basic interface 123registered names. Internally they use the basic interface
109@samp{org.freedesktop.DBus}, which is supported by all objects of a bus. 124@samp{org.freedesktop.DBus}, which is supported by all objects of a bus.
@@ -187,16 +202,126 @@ is returned as string.
187@code{:session}. 202@code{:session}.
188@end defun 203@end defun
189 204
205
206@node Introspection
207@section Knowing the details of D-Bus services.
208
209D-Bus services publish their interfaces. This can be retrieved and
210analyzed during runtime, in order to understand the used
211implementation.
212
213The resulting introspection data are in XML format. The root
214introspection element is always a @code{node} element. It might have
215a @code{name} attribute, which denotes the (absolute) object path an
216interface is introspected.
217
218The root @code{node} element may have @code{node} and @code{interface}
219children. A child @code{node} element must have a @code{name}
220attribute, this case it is the relative object path to the root
221@code{node} element.
222
223An @code{interface} element has just one attribute, @code{name}, which
224is the full name of that interface. The default interface
225@samp{org.freedesktop.DBus.Introspectable} is always present. Example:
226
227@example
228<node name="/org/bluez">
229 <interface name="org.freedesktop.DBus.Introspectable">
230 @dots{}
231 </interface>
232 <interface name="org.bluez.Manager">
233 @dots{}
234 </interface>
235 <interface name="org.bluez.Database">
236 @dots{}
237 </interface>
238 <interface name="org.bluez.Security">
239 @dots{}
240 </interface>
241 <node name="service_audio"/>
242 <node name="service_input"/>
243 <node name="service_network"/>
244 <node name="service_serial"/>
245</node>
246@end example
247
248Children of an @code{interface} element can be @code{method},
249@code{signal} and @code{property} elements. A @code{method} element
250stands for a D-Bus method of the surrounding interface. The element
251itself has a @code{name} attribute, showing the method name. Children
252elements @code{arg} stand for the arguments of a method. Example:
253
254@example
255<method name="ResolveHostName">
256 <arg name="interface" type="i" direction="in"/>
257 <arg name="protocol" type="i" direction="in"/>
258 <arg name="name" type="s" direction="in"/>
259 <arg name="aprotocol" type="i" direction="in"/>
260 <arg name="flags" type="u" direction="in"/>
261 <arg name="interface" type="i" direction="out"/>
262 <arg name="protocol" type="i" direction="out"/>
263 <arg name="name" type="s" direction="out"/>
264 <arg name="aprotocol" type="i" direction="out"/>
265 <arg name="address" type="s" direction="out"/>
266 <arg name="flags" type="u" direction="out"/>
267</method>
268@end example
269
270@code{arg} elements can have the attributes @code{name}, @code{type}
271and @code{direction}. The @code{name} attribute is optional. The
272@code{type} attribute stands for the @dfn{signature} of the argument
273in D-Bus. For a discussion of D-Bus types and their Lisp
274representation see @ref{Type Conversion}.@footnote{D-Bus signatures
275are explained in the D-Bus specification
276@uref{http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-signatures}.}
277The @code{direction} attribute of an @code{arg} element can be only
278@samp{in} or @samp{out}; in case it is omitted, it defaults to
279@samp{in}.
280
281A @code{signal} element of an @code{interface} has a similar
282structure. The @code{direction} attribute of an @code{arg} child
283element can be only @samp{out} here; which is also the default value.
284Example:
285
286@example
287<signal name="StateChanged">
288 <arg name="state" type="i"/>
289 <arg name="error" type="s"/>
290</signal>
291@end example
292
293A @code{property} element has no @code{arg} child
294element. It just has the attributes @code{name}, @code{type} and
295@code{access}, which are all mandatory. The @code{access} attribute
296allows the values @samp{readwrite}, @samp{read}, and @samp{write}.
297Example:
298
299@example
300<property name="Status" type="u" direction="read"/>
301@end example
302
303@code{annotation} elements can be children of @code{interface},
304@code{method}, @code{signal}, and @code{property} elements. Unlike
305properties, which can change their values during lifetime of a D-Bus
306object, annotations are static. Often they are used for code
307generators of D-Bus langugae bindings. Example:
308
309@example
310<annotation name="de.berlios.Pinot.GetStatistics" value="pinotDBus"/>
311@end example
312
313Annotations have just @code{name} and @code{value} attributes, both
314must be strings.
315
190@defun dbus-introspect bus service path 316@defun dbus-introspect bus service path
191Objects can publish there interfaces to the D-Bus. This function 317This function returns all interfaces and sub-nodes of @var{service},
192returns all interfaces of @var{service}, registered at object path 318registered at object path @var{path} at bus @var{bus}.
193@var{path} at bus @var{bus}.
194 319
195@var{bus} must be either the symbol @code{:system} or the symbol 320@var{bus} must be either the symbol @code{:system} or the symbol
196@code{:session}. @var{service} must be a known service name, and 321@code{:session}. @var{service} must be a known service name, and
197@var{path} must be a valid object path. The last two parameters are 322@var{path} must be a valid object path. The last two parameters are
198strings. The result, the introspection data, is a string in XML 323strings. The result, the introspection data, is a string in XML
199format. Example: 324format. Example:
200 325
201@lisp 326@lisp
202(dbus-introspect 327(dbus-introspect
@@ -204,45 +329,506 @@ format. Example:
204 "/org/freedesktop/Hal/devices/computer") 329 "/org/freedesktop/Hal/devices/computer")
205 330
206@result{} "<!DOCTYPE node PUBLIC 331@result{} "<!DOCTYPE node PUBLIC
207 \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\" 332 "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
208 \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\"> 333 "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
209 <node> 334 <node>
210 <interface name=\"org.freedesktop.Hal.Device\"> 335 <interface name="org.freedesktop.Hal.Device">
211 <method name=\"GetAllProperties\"> 336 <method name="GetAllProperties">
212 <arg name=\"properties\" direction=\"out\" type=\"a@{sv@}\"/> 337 <arg name="properties" direction="out" type="a@{sv@}"/>
213 </method> 338 </method>
214 @dots{} 339 @dots{}
215 <signal name=\"PropertyModified\"> 340 <signal name="PropertyModified">
216 <arg name=\"num_updates\" type=\"i\"/> 341 <arg name="num_updates" type="i"/>
217 <arg name=\"updates\" type=\"a(sbb)\"/> 342 <arg name="updates" type="a(sbb)"/>
218 </signal> 343 </signal>
219 </interface> 344 </interface>
220 @dots{} 345 @dots{}
221 </node>" 346 </node>"
222@end lisp 347@end lisp
223 348
224This example informs us, that the service @code{org.freedesktop.Hal} 349This example informs us, that the service @samp{org.freedesktop.Hal}
225at object path @code{/org/freedesktop/Hal/devices/computer} offers the 350at object path @samp{/org/freedesktop/Hal/devices/computer} offers the
226interface @code{org.freedesktop.Hal.Device} (and 2 other interfaces 351interface @samp{org.freedesktop.Hal.Device} (and 2 other interfaces
227not documented here). This interface contains the method 352not documented here). This interface contains the method
228@code{GetAllProperties}, which needs no input parameters, but returns 353@samp{GetAllProperties}, which needs no input parameters, but returns
229as output parameter an array of dictionary entries (key-value pairs). 354as output parameter an array of dictionary entries (key-value pairs).
230Every dictionary entry has a string as key, and a variant as value. 355Every dictionary entry has a string as key, and a variant as value.
231 356
232The interface offers also a signal, which returns 2 parameters: an 357The interface offers also a signal, which returns 2 parameters: an
233integer, and an array consisting of elements which are a struct of a 358integer, and an array consisting of elements which are a struct of a
234string and 2 boolean values. 359string and 2 boolean values.@footnote{ The interfaces of the service
235 360@samp{org.freedesktop.Hal} are described at
236Such type descriptions are called @dfn{signature} in D-Bus. For a
237discussion of D-Bus types and their Lisp representation see @ref{Type
238Conversion}.@footnote{D-Bus signatures are explained in the D-Bus
239specification
240@uref{http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-signatures}.
241The interfaces of the service @code{org.freedesktop.Hal} are described
242at
243@uref{http://people.freedesktop.org/~david/hal-spec/hal-spec.html#interfaces}.} 361@uref{http://people.freedesktop.org/~david/hal-spec/hal-spec.html#interfaces}.}
244@end defun 362@end defun
245 363
364@defun dbus-introspect-xml bus service path
365This function has the same intention as function
366@code{dbus-introspect}. The returned value is a parsed XML tree,
367which can be used for further analysis. Example:
368
369@lisp
370(dbus-introspect-xml
371 :session "org.freedesktop.xesam.searcher"
372 "/org/freedesktop/xesam/searcher/main")
373
374@result{} (node ((name . "/org/freedesktop/xesam/searcher/main"))
375 (interface ((name . "org.freedesktop.xesam.Search"))
376 (method ((name . "GetHitData"))
377 (arg ((name . "search") (type . "s") (direction . "in")))
378 (arg ((name . "hit_ids") (type . "au") (direction . "in")))
379 (arg ((name . "fields") (type . "as") (direction . "in")))
380 (arg ((name . "hit_data") (type . "aav") (direction . "out")))
381 )
382 @dots{}
383 (signal ((name . "HitsAdded"))
384 (arg ((name . "search") (type . "s")))
385 (arg ((name . "count") (type . "u")))
386 )
387 )
388 @dots{}
389 )
390@end lisp
391@end defun
392
393@defun dbus-introspect-get-attribute object attribute
394It returns the @var{attribute} value of a D-Bus introspection
395@var{object}. @var{object} can be every subtree of a parsed XML tree
396as retrieved with @code{dbus-introspect-xml}. @var{attribute} must be
397a string according to the attribute names in the D-Bus specification.
398Example:
399
400@lisp
401(dbus-introspect-get-attribute
402 (dbus-introspect-xml :system "org.freedesktop.SystemToolsBackends"
403 "/org/freedesktop/SystemToolsBackends/UsersConfig")
404 "name")
405
406@result{} "/org/freedesktop/SystemToolsBackends/UsersConfig"
407@end lisp
408
409If @var{object} has no @var{attribute}, the function returns nil.
410@end defun
411
412
413@node Nodes and Interfaces
414@section Detecting object paths and interfaces.
415
416The first elements, to be introspected for a D-Bus object, are further
417object paths and interfaces.
418
419@defun dbus-introspect-get-node-names bus service path
420All node names of @var{service} in D-Bus @var{bus} at object path
421@var{path} are returned as list of strings. Example:
422
423@lisp
424(dbus-introspect-get-node-names
425 :session "org.gnome.seahorse" "/org/gnome/seahorse")
426
427@result{} ("crypto" "keys")
428@end lisp
429
430The node names stand for further object paths of the D-Bus
431@var{service}, relative to @var{path}. In the example,
432@samp{/org/gnome/seahorse/crypto} and @samp{/org/gnome/seahorse/keys}
433are also object paths of the D-Bus service @samp{org.gnome.seahorse}.
434@end defun
435
436@defun dbus-introspect-get-all-nodes bus service path
437This function returns all node names of @var{service} in D-Bus
438@var{bus} at object path @var{path}. It returns a list of strings
439with all object paths of @var{service}, starting at @var{path}.
440Example:
441
442@lisp
443(dbus-introspect-get-all-nodes :session "org.gnome.seahorse" "/")
444
445@result{} ("/" "/org" "/org/gnome" "/org/gnome/seahorse"
446 "/org/gnome/seahorse/crypto"
447 "/org/gnome/seahorse/keys"
448 "/org/gnome/seahorse/keys/openpgp"
449 "/org/gnome/seahorse/keys/openpgp/local"
450 "/org/gnome/seahorse/keys/openssh"
451 "/org/gnome/seahorse/keys/openssh/local")
452@end lisp
453@end defun
454
455@defun dbus-introspect-get-interface-names bus service path
456There will be returned a list strings of all interface names of
457@var{service} in D-Bus @var{bus} at object path @var{path}. This list
458will contain the default interface @samp{org.freedesktop.DBus.Introspectable}.
459
460Another default interface is @samp{org.freedesktop.DBus.Properties}.
461If present, @code{interface} elements can also have @code{property}
462children. Example:
463
464@lisp
465(dbus-introspect-get-interface-names
466 :system "org.freedesktop.Hal"
467 "/org/freedesktop/Hal/devices/computer")
468
469@result{} ("org.freedesktop.DBus.Introspectable"
470 "org.freedesktop.Hal.Device"
471 "org.freedesktop.Hal.Device.SystemPowerManagement"
472 "org.freedesktop.Hal.Device.CPUFreq")
473@end lisp
474@end defun
475
476@defun dbus-introspect-get-interface bus service path interface
477Return @var{interface} of @var{service} in D-Bus @var{bus} at object
478path @var{path}. The return value is an XML element. @var{interface}
479must be a string, element of the list returned by
480@code{dbus-introspect-get-interface-names}. Example:
481
482@lisp
483(dbus-introspect-get-interface
484 :session "org.freedesktop.xesam.searcher"
485 "/org/freedesktop/xesam/searcher/main"
486 "org.freedesktop.xesam.Search")
487
488@result{} (interface ((name . "org.freedesktop.xesam.Search"))
489 (method ((name . "GetHitData"))
490 (arg ((name . "search") (type . "s") (direction . "in")))
491 (arg ((name . "hit_ids") (type . "au") (direction . "in")))
492 (arg ((name . "fields") (type . "as") (direction . "in")))
493 (arg ((name . "hit_data") (type . "aav") (direction . "out")))
494 )
495 @dots{}
496 (signal ((name . "HitsAdded"))
497 (arg ((name . "search") (type . "s")))
498 (arg ((name . "count") (type . "u")))
499 )
500 )
501@end lisp
502@end defun
503
504@noindent
505With these functions, it is possible to retrieve all introspection
506data from a running system:
507
508@lisp
509(with-current-buffer (switch-to-buffer "*introspect*")
510 (erase-buffer)
511 (dolist (service (dbus-list-known-names :session))
512 (dolist (path (dbus-introspect-get-all-nodes :session service "/"))
513 ;; We want to introspect only elements, which have more than
514 ;; the default interface "org.freedesktop.DBus.Introspectable".
515 (when (delete
516 "org.freedesktop.DBus.Introspectable"
517 (dbus-introspect-get-interface-names :session service path))
518 (insert (message "\nservice: \"%s\" path: \"%s\"\n" service path)
519 (dbus-introspect :session service path))
520 (redisplay t)))))
521@end lisp
522
523
524@node Methods and Signal
525@section Applying the functionality.
526
527Methods and signals are the communicatione means to D-Bus. The
528following functions return their specifications.
529
530@defun dbus-introspect-get-method-names bus service path interface
531Return a list of strings of all method names of @var{interface} of
532@var{service} in D-Bus @var{bus} at object path @var{path}. Example:
533
534@lisp
535(dbus-introspect-get-method-names
536 :session "org.freedesktop.xesam.searcher"
537 "/org/freedesktop/xesam/searcher/main"
538 "org.freedesktop.xesam.Search")
539
540@result{} ("GetState" "StartSearch" "GetHitCount" "GetHits" "NewSession"
541 "CloseSession" "GetHitData" "SetProperty" "NewSearch"
542 "GetProperty" "CloseSearch")
543@end lisp
544@end defun
545
546@defun dbus-introspect-get-method bus service path interface method
547This function returns @var{method} of @var{interface} as XML element.
548It must be located at @var{service} in D-Bus @var{bus} at object path
549@var{path}. @var{method} must be a string, element of the list
550returned by @code{dbus-introspect-get-method-names}. Example:
551
552@lisp
553(dbus-introspect-get-method
554 :session "org.freedesktop.xesam.searcher"
555 "/org/freedesktop/xesam/searcher/main"
556 "org.freedesktop.xesam.Search" "GetHitData")
557
558@result{} (method ((name . "GetHitData"))
559 (arg ((name . "search") (type . "s") (direction . "in")))
560 (arg ((name . "hit_ids") (type . "au") (direction . "in")))
561 (arg ((name . "fields") (type . "as") (direction . "in")))
562 (arg ((name . "hit_data") (type . "aav") (direction . "out")))
563 )
564@end lisp
565@end defun
566
567@defun dbus-introspect-get-signal-names bus service path interface
568Return a list of strings of all signal names of @var{interface} of
569@var{service} in D-Bus @var{bus} at object path @var{path}. Example:
570
571@lisp
572(dbus-introspect-get-signal-names
573 :session "org.freedesktop.xesam.searcher"
574 "/org/freedesktop/xesam/searcher/main"
575 "org.freedesktop.xesam.Search")
576
577@result{} ("StateChanged" "SearchDone" "HitsModified"
578 "HitsRemoved" "HitsAdded")
579@end lisp
580@end defun
581
582@defun dbus-introspect-get-signal bus service path interface signal
583This function returns @var{signal} of @var{interface} as XML element.
584It must be located at @var{service} in D-Bus @var{bus} at object path
585@var{path}. @var{signal} must be a string, element of the list
586returned by @code{dbus-introspect-get-signal-names}. Example:
587
588@lisp
589(dbus-introspect-get-signal
590 :session "org.freedesktop.xesam.searcher"
591 "/org/freedesktop/xesam/searcher/main"
592 "org.freedesktop.xesam.Search" "HitsAdded")
593
594@result{} (signal ((name . "HitsAdded"))
595 (arg ((name . "search") (type . "s")))
596 (arg ((name . "count") (type . "u")))
597 )
598@end lisp
599@end defun
600
601
602@node Properties and Annotations
603@section What else to know about interfaces.
604
605Interfaces can have properties. These can be exposed via the
606@samp{org.freedesktop.DBus.Properties} interface@footnote{See
607@uref{http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties}}.
608That is, properties can be retrieved and changed during lifetime of an
609element.
610
611Annotations, on the other hand, are static values for an element.
612Often, they are used to instruct generators, how to generate code from
613the interface for a given language binding.
614
615@defun dbus-introspect-get-property-names bus service path interface
616Return a list of strings with all property names of @var{interface} of
617@var{service} in D-Bus @var{bus} at object path @var{path}. Example:
618
619@lisp
620(dbus-introspect-get-property-names
621 :session "org.kde.kded" "/modules/networkstatus"
622 "org.kde.Solid.Networking.Client")
623
624@result{} ("Status")
625@end lisp
626
627If an interface declares properties, the corresponding element supports
628also the @samp{org.freedesktop.DBus.Properties} interface.
629@end defun
630
631@defun dbus-introspect-get-property bus service path interface property
632This function returns @var{property} of @var{interface} as XML element.
633It must be located at @var{service} in D-Bus @var{bus} at object path
634@var{path}. @var{property} must be a string, element of the list
635returned by @code{dbus-introspect-get-property-names}.
636
637A @var{property} value can be retrieved by the function
638@code{dbus-introspect-get-attribute}. Example:
639
640@lisp
641(dbus-introspect-get-property
642 :session "org.kde.kded" "/modules/networkstatus"
643 "org.kde.Solid.Networking.Client" "Status")
644
645@result{} (property ((access . "read") (type . "u") (name . "Status")))
646
647(dbus-introspect-get-attribute
648 (dbus-introspect-get-property
649 :session "org.kde.kded" "/modules/networkstatus"
650 "org.kde.Solid.Networking.Client" "Status")
651 "access")
652
653@result{} "read"
654@end lisp
655@end defun
656
657@defun dbus-get-property bus service path interface property
658This function returns the value of @var{property} of @var{interface}.
659It will be checked at @var{bus}, @var{service}, @var{path}. The
660result can be any valid D-Bus value, or nil if there is no
661@var{property}. Example:
662
663@lisp
664(dbus-get-property
665 :session "org.kde.kded" "/modules/networkstatus"
666 "org.kde.Solid.Networking.Client" "Status")
667
668@result{} 4
669@end lisp
670@end defun
671
672@defun dbus-set-property bus service path interface property value
673Set value of @var{property} of @var{interface} to @var{value}. It
674will be checked at @var{bus}, @var{service}, @var{path}. When the
675value has been set successful, the result is @var{value}. Otherwise,
676@code{nil} is returned. Example:
677
678@lisp
679(dbus-set-property
680 :session "org.kde.kaccess" "/MainApplication"
681 "com.trolltech.Qt.QApplication" "doubleClickInterval" 500)
682
683@result{} 500
684@end lisp
685@end defun
686
687@defun dbus-get-all-properties bus service path interface
688This function returns all properties of @var{interface}. It will be
689checked at @var{bus}, @var{service}, @var{path}. The result is a list
690of cons. Every cons contains the name of the property, and its value.
691If there are no properties, @code{nil} is returned. Example:
692
693@lisp
694(dbus-get-all-properties
695 :session "org.kde.kaccess" "/MainApplication"
696 "com.trolltech.Qt.QApplication")
697
698@result{} (("cursorFlashTime" . 1000) ("doubleClickInterval" . 500)
699 ("keyboardInputInterval" . 400) ("wheelScrollLines" . 3)
700 ("globalStrut" 0 0) ("startDragTime" . 500)
701 ("startDragDistance" . 4) ("quitOnLastWindowClosed" . t)
702 ("styleSheet" . ""))
703@end lisp
704@end defun
705
706@defun dbus-introspect-get-annotation-names bus service path interface &optional name
707Return a list of all annotation names as list of strings. If
708@var{name} is @code{nil}, the annotations are children of
709@var{interface}, otherwise @var{name} must be a @code{method},
710@code{signal}, or @code{property} XML element, where the annotations
711belong to. Example:
712
713@lisp
714(dbus-introspect-get-annotation-names
715 :session "de.berlios.Pinot" "/de/berlios/Pinot"
716 "de.berlios.Pinot" "GetStatistics")
717
718@result{} ("de.berlios.Pinot.GetStatistics")
719@end lisp
720
721Default annotation names@footnote{See
722@uref{http://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format}}
723are
724
725@table @samp
726@item org.freedesktop.DBus.Deprecated
727Whether or not the entity is deprecated; defaults to @code{nil}
728
729@item org.freedesktop.DBus.GLib.CSymbol
730The C symbol; may be used for @code{methods} and @code{interfaces}
731
732@item org.freedesktop.DBus.Method.NoReply
733If set, don't expect a reply to the @code{method} call; defaults to @code{nil}
734@end table
735@end defun
736
737@defun dbus-introspect-get-annotation bus service path interface name annotation
738Return annotation @var{ANNOTATION} as XML object. If @var{name} is
739@code{nil}, @var{ANNOTATION} is a child of @var{interface}, otherwise
740@var{name} must be the name of a @code{method}, @code{signal}, or
741@code{property} XML element, where the @var{ANNOTATION} belongs to.
742
743An attribute value can be retrieved by
744@code{dbus-introspect-get-attribute}. Example:
745
746@lisp
747(dbus-introspect-get-annotation
748 :session "de.berlios.Pinot" "/de/berlios/Pinot"
749 "de.berlios.Pinot" "GetStatistics"
750 "de.berlios.Pinot.GetStatistics")
751
752@result{} (annotation ((name . "de.berlios.Pinot.GetStatistics")
753 (value . "pinotDBus")))
754
755(dbus-introspect-get-attribute
756 (dbus-introspect-get-annotation
757 :session "de.berlios.Pinot" "/de/berlios/Pinot"
758 "de.berlios.Pinot" "GetStatistics"
759 "de.berlios.Pinot.GetStatistics")
760 "value")
761
762@result{} "pinotDBus"
763@end lisp
764@end defun
765
766
767@node Arguments and Signatures
768@section The final details.
769
770Methods and signals have arguments. They are described in the
771@code{arg} XML elements.
772
773@defun dbus-introspect-get-argument-names bus service path interface name
774Return a list of all argument names as list of strings. @var{name}
775must be a @code{method} or @code{signal} XML element. Example:
776
777@lisp
778(dbus-introspect-get-argument-names
779 :session "org.freedesktop.xesam.searcher"
780 "/org/freedesktop/xesam/searcher/main"
781 "org.freedesktop.xesam.Search" "GetHitData")
782
783@result{} ("search" "hit_ids" "fields" "hit_data")
784@end lisp
785
786Argument names are optional; the function can return @code{nil}
787therefore, even if the method or signal has arguments.
788@end defun
789
790@defun dbus-introspect-get-argument bus service path interface name arg
791Return argument @var{ARG} as XML object. @var{name}
792must be a @code{method} or @code{signal} XML element. Example:
793
794@lisp
795(dbus-introspect-get-argument
796 :session "org.freedesktop.xesam.searcher"
797 "/org/freedesktop/xesam/searcher/main"
798 "org.freedesktop.xesam.Search" "GetHitData" "search")
799
800@result{} (arg ((name . "search") (type . "s") (direction . "in")))
801@end lisp
802@end defun
803
804@defun dbus-introspect-get-signature bus service path interface name &optional direction
805Return signature of a @code{method} or @code{signal}, represented by
806@var{name}, as string.
807
808If @var{name} is a @code{method}, @var{direction} can be either
809@samp{in} or @samp{out}. If @var{direction} is @code{nil}, @samp{in}
810is assumed.
811
812If @var{name} is a @code{signal}, and @var{direction} is
813non-@code{nil}, @var{direction} must be @samp{out}. Example:
814
815@lisp
816(dbus-introspect-get-signature
817 :session "org.freedesktop.xesam.searcher"
818 "/org/freedesktop/xesam/searcher/main"
819 "org.freedesktop.xesam.Search" "GetHitData" "in")
820
821@result{} "sauas"
822
823(dbus-introspect-get-signature
824 :session "org.freedesktop.xesam.searcher"
825 "/org/freedesktop/xesam/searcher/main"
826 "org.freedesktop.xesam.Search" "HitsAdded")
827
828@result{} \"su\""
829@end lisp
830@end defun
831
246 832
247@node Type Conversion 833@node Type Conversion
248@chapter Mapping Lisp types and D-Bus types. 834@chapter Mapping Lisp types and D-Bus types.
@@ -514,13 +1100,13 @@ emulate the @code{lshal} command on GNU/Linux systems:
514 1100
515Emacs can also offer own methods, which can be called by other 1101Emacs can also offer own methods, which can be called by other
516applications. These methods could be an implementation of an 1102applications. These methods could be an implementation of an
517interface of a well known service, like @code{org.freedesktop.TextEditor}. 1103interface of a well known service, like @samp{org.freedesktop.TextEditor}.
518 1104
519It could be also an implementation of an own interface. In this case, 1105It could be also an implementation of an own interface. In this case,
520the service name must be @code{org.gnu.Emacs}. The object path shall 1106the service name must be @samp{org.gnu.Emacs}. The object path shall
521begin with @code{/org/gnu/Emacs/@strong{Application}/}, and the 1107begin with @samp{/org/gnu/Emacs/@strong{Application}/}, and the
522interface name shall be @code{org.gnu.Emacs.@strong{Application}}. 1108interface name shall be @code{org.gnu.Emacs.@strong{Application}}.
523@code{@strong{Application}} is the name of the application which 1109@samp{@strong{Application}} is the name of the application which
524provides the interface. 1110provides the interface.
525 1111
526@defun dbus-register-method bus service path interface method handler 1112@defun dbus-register-method bus service path interface method handler
@@ -574,7 +1160,7 @@ registration for @var{method}. Example:
574 my-method-handler)) 1160 my-method-handler))
575@end lisp 1161@end lisp
576 1162
577If you invoke the method @code{org.freedesktop.TextEditor.OpenFile} 1163If you invoke the method @samp{org.freedesktop.TextEditor.OpenFile}
578from another D-Bus application with a filename as parameter, the file 1164from another D-Bus application with a filename as parameter, the file
579is opened in Emacs, and the method returns either @var{true} or 1165is opened in Emacs, and the method returns either @var{true} or
580@var{false}, indicating the success if the method. As test tool one 1166@var{false}, indicating the success if the method. As test tool one
@@ -675,12 +1261,12 @@ registration for @var{signal}. Example:
675 my-signal-handler)) 1261 my-signal-handler))
676@end lisp 1262@end lisp
677 1263
678As we know from the inspection data of interface 1264As we know from the introspection data of interface
679@code{org.freedesktop.Hal.Manager}, the signal @code{DeviceAdded} 1265@samp{org.freedesktop.Hal.Manager}, the signal @samp{DeviceAdded}
680provides one single parameter, which is mapped into a Lisp string. 1266provides one single parameter, which is mapped into a Lisp string.
681The callback function @code{my-dbus-signal-handler} must define one 1267The callback function @code{my-dbus-signal-handler} must define one
682single string argument therefore. Plugging an USB device to your 1268single string argument therefore. Plugging an USB device to your
683machine, when registered for signal @code{DeviceAdded}, will show you 1269machine, when registered for signal @samp{DeviceAdded}, will show you
684which objects the GNU/Linux @code{hal} daemon adds. 1270which objects the GNU/Linux @code{hal} daemon adds.
685@end defun 1271@end defun
686 1272