aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBasil L. Contovounesios2020-06-06 00:58:37 +0100
committerBasil L. Contovounesios2020-06-08 18:19:50 +0100
commit43ad7dc1af327486963e5e3a3ae8efdb454fd38d (patch)
treef070853bb6c91f94d87a6b461a2d40fc26556c6f
parentc43e5ed60d93bbe3f5f3936ccce6e77409cd6140 (diff)
downloademacs-43ad7dc1af327486963e5e3a3ae8efdb454fd38d.tar.gz
emacs-43ad7dc1af327486963e5e3a3ae8efdb454fd38d.zip
Clean up D-Bus documentation (bug#41744)
* doc/lispref/errors.texi (Standard Errors): The error symbol dbus-error is defined even when Emacs is built without D-Bus. * doc/misc/dbus.texi (Bus Names, Introspection) (Nodes and Interfaces, Methods and Signal) (Properties and Annotations, Arguments and Signatures) (Synchronous Methods, Receiving Method Calls, Signals) (Alternative Buses, Errors and Events): Clarify wording. Fix indentation of and simplify examples where possible. Improve Texinfo markup and cross-referencing where possible. (Type Conversion): Ditto. Remove mentions of Emacs' fixnum range now that we have bignums. * lisp/net/dbus.el (dbus-return-values-table) (dbus-call-method-asynchronously, dbus-send-signal) (dbus-register-signal, dbus-register-method) (dbus-string-to-byte-array, dbus-byte-array-to-string) (dbus-escape-as-identifier, dbus-check-event, dbus-event-bus-name) (dbus-event-message-type, dbus-event-serial-number) (dbus-event-service-name, dbus-event-path-name) (dbus-event-interface-name, dbus-event-member-name) (dbus-list-activatable-names, dbus-list-queued-owners, dbus-ping) (dbus-introspect-get-interface-names, dbus-introspect-get-interface) (dbus-introspect-get-method, dbus-introspect-get-signal) (dbus-introspect-get-property, dbus-introspect-get-annotation-names) (dbus-introspect-get-annotation, dbus-introspect-get-argument-names) (dbus-introspect-get-argument, dbus-introspect-get-signature) (dbus-set-property, dbus-register-property) (dbus-get-all-managed-objects, dbus-init-bus): Clarify docstring and improve formatting where possible. (dbus-call-method): Ditto. Remove mentions of Emacs' fixnum range now that we have bignums.
-rw-r--r--doc/lispref/errors.texi5
-rw-r--r--doc/misc/dbus.texi826
-rw-r--r--lisp/net/dbus.el228
3 files changed, 531 insertions, 528 deletions
diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi
index dc6877c9eca..cd8694be8a3 100644
--- a/doc/lispref/errors.texi
+++ b/doc/lispref/errors.texi
@@ -79,9 +79,8 @@ The message is @samp{Symbol's chain of variable indirections contains
79a loop}. @xref{Variable Aliases}. 79a loop}. @xref{Variable Aliases}.
80 80
81@item dbus-error 81@item dbus-error
82The message is @samp{D-Bus error}. This is only defined if Emacs was 82The message is @samp{D-Bus error}. @xref{Errors and Events,,, dbus,
83compiled with D-Bus support. @xref{Errors and Events,,, dbus, D-Bus 83D-Bus integration in Emacs}.
84integration in Emacs}.
85 84
86@item end-of-buffer 85@item end-of-buffer
87The message is @samp{End of buffer}. @xref{Character Motion}. 86The message is @samp{End of buffer}. @xref{Character Motion}.
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi
index 9e5f1ccc6fd..167d2bd5ac1 100644
--- a/doc/misc/dbus.texi
+++ b/doc/misc/dbus.texi
@@ -167,7 +167,7 @@ default) or the symbol @code{:session}. An activatable service is
167described in a service registration file. Under GNU/Linux, such files 167described in a service registration file. Under GNU/Linux, such files
168are located at @file{/usr/share/dbus-1/system-services/} (for the 168are located at @file{/usr/share/dbus-1/system-services/} (for the
169@code{:system} bus) or @file{/usr/share/dbus-1/services/}. An 169@code{:system} bus) or @file{/usr/share/dbus-1/services/}. An
170activatable service is not necessarily registered at @var{bus} at already. 170activatable service is not necessarily registered at @var{bus} already.
171 171
172The result is a list of strings, which is @code{nil} when there are no 172The result is a list of strings, which is @code{nil} when there are no
173activatable service names at all. Example: 173activatable service names at all. Example:
@@ -180,8 +180,8 @@ activatable service names at all. Example:
180@end defun 180@end defun
181 181
182@defun dbus-list-names bus 182@defun dbus-list-names bus
183All service names, which are registered at D-Bus @var{bus}, are 183This function returns all service names, which are registered at D-Bus
184returned. The result is a list of strings, which is @code{nil} when 184@var{bus}. The result is a list of strings, which is @code{nil} when
185there are no registered service names at all. Well known names are 185there are no registered service names at all. Well known names are
186strings like @samp{org.freedesktop.DBus}. Names starting with 186strings like @samp{org.freedesktop.DBus}. Names starting with
187@samp{:} are unique names for services. 187@samp{:} are unique names for services.
@@ -191,10 +191,10 @@ strings like @samp{org.freedesktop.DBus}. Names starting with
191@end defun 191@end defun
192 192
193@defun dbus-list-known-names bus 193@defun dbus-list-known-names bus
194Retrieves all registered services which correspond to a known name in @var{bus}. 194This function retrieves all registered services which correspond to a
195A service has a known name if it doesn't start with @samp{:}. The 195known name in @var{bus}. A service has a known name if it doesn't
196result is a list of strings, which is @code{nil} when there are no 196start with @samp{:}. The result is a list of strings, which is
197known names at all. 197@code{nil} when there are no known names at all.
198 198
199@var{bus} must be either the symbol @code{:system} or the symbol 199@var{bus} must be either the symbol @code{:system} or the symbol
200@code{:session}. 200@code{:session}.
@@ -202,9 +202,9 @@ known names at all.
202 202
203@defun dbus-list-queued-owners bus service 203@defun dbus-list-queued-owners bus service
204For a given service, registered at D-Bus @var{bus} under the name 204For a given service, registered at D-Bus @var{bus} under the name
205@var{service}, all queued unique names are returned. The result is a 205@var{service}, this function returns all queued unique names. The
206list of strings, or @code{nil} when there are no queued names for 206result is a list of strings, or @code{nil} when there are no queued
207@var{service} at all. 207names for @var{service} at all.
208 208
209@var{bus} must be either the symbol @code{:system} or the symbol 209@var{bus} must be either the symbol @code{:system} or the symbol
210@code{:session}. @var{service} must be a known service name as 210@code{:session}. @var{service} must be a known service name as
@@ -213,9 +213,9 @@ string.
213 213
214@defun dbus-get-name-owner bus service 214@defun dbus-get-name-owner bus service
215For a given service, registered at D-Bus @var{bus} under the name 215For a given service, registered at D-Bus @var{bus} under the name
216@var{service}, the unique name of the name owner is returned. The 216@var{service}, this function returns the unique name of the name
217result is a string, or @code{nil} when there exist no name owner of 217owner. The result is a string, or @code{nil} when there is no name
218@var{service}. 218owner of @var{service}.
219 219
220@var{bus} must be either the symbol @code{:system} or the symbol 220@var{bus} must be either the symbol @code{:system} or the symbol
221@code{:session}. @var{service} must be a known service name as 221@code{:session}. @var{service} must be a known service name as
@@ -223,26 +223,28 @@ string.
223@end defun 223@end defun
224 224
225@defun dbus-ping bus service &optional timeout 225@defun dbus-ping bus service &optional timeout
226Check whether the service name @var{service} is registered at D-Bus 226This function checks whether the service name @var{service} is
227@var{bus}. @var{service} might not have been started yet, it is 227registered at D-Bus @var{bus}. If @var{service} has not yet started,
228autostarted if possible. The result is either @code{t} or @code{nil}. 228it is autostarted if possible. The result is either @code{t} or
229@code{nil}.
229 230
230@var{bus} must be either the symbol @code{:system} or the symbol 231@var{bus} must be either the symbol @code{:system} or the symbol
231@code{:session}. @var{service} must be a string. @var{timeout}, a 232@code{:session}. @var{service} must be a string. @var{timeout}, a
232nonnegative integer, specifies the maximum number of milliseconds 233nonnegative integer, specifies the maximum number of milliseconds
233@code{dbus-ping} must return. The default value is 25,000. Example: 234before @code{dbus-ping} must return. The default value is 25,000.
235Example:
234 236
235@lisp 237@lisp
236(message 238(message
237 "%s screensaver on board." 239 "%s screensaver on board."
238 (cond 240 (cond
239 ((dbus-ping :session "org.gnome.ScreenSaver" 100) "Gnome") 241 ((dbus-ping :session "org.gnome.ScreenSaver" 100) "Gnome")
240 ((dbus-ping :session "org.freedesktop.ScreenSaver" 100) "KDE") 242 ((dbus-ping :session "org.freedesktop.ScreenSaver" 100) "KDE")
241 (t "No"))) 243 (t "No")))
242@end lisp 244@end lisp
243 245
244If it shall be checked whether @var{service} is already running 246To check whether @var{service} is already running without autostarting
245without autostarting it, one shall apply 247it, you can instead write:
246 248
247@lisp 249@lisp
248(member service (dbus-list-known-names bus)) 250(member service (dbus-list-known-names bus))
@@ -250,8 +252,9 @@ without autostarting it, one shall apply
250@end defun 252@end defun
251 253
252@defun dbus-get-unique-name bus 254@defun dbus-get-unique-name bus
253The unique name, under which Emacs is registered at D-Bus @var{bus}, 255@anchor{dbus-get-unique-name}
254is returned as string. 256This function returns the unique name, under which Emacs is registered
257at D-Bus @var{bus}, as a string.
255 258
256@var{bus} must be either the symbol @code{:system} or the symbol 259@var{bus} must be either the symbol @code{:system} or the symbol
257@code{:session}. 260@code{:session}.
@@ -380,8 +383,8 @@ format. Example:
380 383
381@lisp 384@lisp
382(dbus-introspect 385(dbus-introspect
383 :system "org.freedesktop.Hal" 386 :system "org.freedesktop.Hal"
384 "/org/freedesktop/Hal/devices/computer") 387 "/org/freedesktop/Hal/devices/computer")
385 388
386@result{} "<!DOCTYPE node PUBLIC 389@result{} "<!DOCTYPE node PUBLIC
387 "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" 390 "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
@@ -420,46 +423,51 @@ the HAL specification}.}
420@end defun 423@end defun
421 424
422@defun dbus-introspect-xml bus service path 425@defun dbus-introspect-xml bus service path
423This function has the same intention as function 426This function serves a similar purpose to the function
424@code{dbus-introspect}. The returned value is a parsed XML tree, 427@code{dbus-introspect}. The returned value is a parsed XML tree,
425which can be used for further analysis. Example: 428which can be used for further analysis. Example:
426 429
427@lisp 430@lisp
428(dbus-introspect-xml 431(dbus-introspect-xml
429 :session "org.freedesktop.xesam.searcher" 432 :session "org.freedesktop.xesam.searcher"
430 "/org/freedesktop/xesam/searcher/main") 433 "/org/freedesktop/xesam/searcher/main")
431 434
432@result{} (node ((name . "/org/freedesktop/xesam/searcher/main")) 435@result{} (node ((name . "/org/freedesktop/xesam/searcher/main"))
433 (interface ((name . "org.freedesktop.xesam.Search")) 436 (interface ((name . "org.freedesktop.xesam.Search"))
434 (method ((name . "GetHitData")) 437 (method ((name . "GetHitData"))
435 (arg ((name . "search") (type . "s") (direction . "in"))) 438 (arg ((name . "search")
436 (arg ((name . "hit_ids") (type . "au") (direction . "in"))) 439 (type . "s")
437 (arg ((name . "fields") (type . "as") (direction . "in"))) 440 (direction . "in")))
438 (arg ((name . "hit_data") (type . "aav") (direction . "out"))) 441 (arg ((name . "hit_ids")
439 ) 442 (type . "au")
440 @dots{} 443 (direction . "in")))
441 (signal ((name . "HitsAdded")) 444 (arg ((name . "fields")
442 (arg ((name . "search") (type . "s"))) 445 (type . "as")
443 (arg ((name . "count") (type . "u"))) 446 (direction . "in")))
444 ) 447 (arg ((name . "hit_data")
445 ) 448 (type . "aav")
446 @dots{} 449 (direction . "out"))))
447 ) 450 @dots{}
451 (signal ((name . "HitsAdded"))
452 (arg ((name . "search") (type . "s")))
453 (arg ((name . "count") (type . "u")))))
454 @dots{})
448@end lisp 455@end lisp
449@end defun 456@end defun
450 457
451@defun dbus-introspect-get-attribute object attribute 458@defun dbus-introspect-get-attribute object attribute
452It returns the @var{attribute} value of a D-Bus introspection 459This function returns the @var{attribute} value of a D-Bus
453@var{object}. @var{object} can be every subtree of a parsed XML tree 460introspection @var{object}. The value of @var{object} can be any
454as retrieved with @code{dbus-introspect-xml}. @var{attribute} must be 461subtree of a parsed XML tree as retrieved with
455a string according to the attribute names in the D-Bus specification. 462@code{dbus-introspect-xml}. @var{attribute} must be a string
456Example: 463according to the attribute names in the D-Bus specification. Example:
457 464
458@lisp 465@lisp
459(dbus-introspect-get-attribute 466(dbus-introspect-get-attribute
460 (dbus-introspect-xml :system "org.freedesktop.SystemToolsBackends" 467 (dbus-introspect-xml
461 "/org/freedesktop/SystemToolsBackends/UsersConfig") 468 :system "org.freedesktop.SystemToolsBackends"
462 "name") 469 "/org/freedesktop/SystemToolsBackends/UsersConfig")
470 "name")
463 471
464@result{} "/org/freedesktop/SystemToolsBackends/UsersConfig" 472@result{} "/org/freedesktop/SystemToolsBackends/UsersConfig"
465@end lisp 473@end lisp
@@ -476,12 +484,12 @@ The first elements, to be introspected for a D-Bus object, are further
476object paths and interfaces. 484object paths and interfaces.
477 485
478@defun dbus-introspect-get-node-names bus service path 486@defun dbus-introspect-get-node-names bus service path
479All node names of @var{service} in D-Bus @var{bus} at object path 487This function returns all node names of @var{service} in D-Bus
480@var{path} are returned as list of strings. Example: 488@var{bus} at object path @var{path} as a list of strings. Example:
481 489
482@lisp 490@lisp
483(dbus-introspect-get-node-names 491(dbus-introspect-get-node-names
484 :session "org.gnome.seahorse" "/org/gnome/seahorse") 492 :session "org.gnome.seahorse" "/org/gnome/seahorse")
485 493
486@result{} ("crypto" "keys") 494@result{} ("crypto" "keys")
487@end lisp 495@end lisp
@@ -512,9 +520,10 @@ Example:
512@end defun 520@end defun
513 521
514@defun dbus-introspect-get-interface-names bus service path 522@defun dbus-introspect-get-interface-names bus service path
515There will be returned a list strings of all interface names of 523This function returns a list strings of all interface names of
516@var{service} in D-Bus @var{bus} at object path @var{path}. This list 524@var{service} in D-Bus @var{bus} at object path @var{path}. This list
517will contain the default interface @samp{org.freedesktop.DBus.Introspectable}. 525will contain the default interface
526@samp{org.freedesktop.DBus.Introspectable}.
518 527
519Another default interface is @samp{org.freedesktop.DBus.Properties}. 528Another default interface is @samp{org.freedesktop.DBus.Properties}.
520If present, @code{interface} elements can also have @code{property} 529If present, @code{interface} elements can also have @code{property}
@@ -522,8 +531,8 @@ children. Example:
522 531
523@lisp 532@lisp
524(dbus-introspect-get-interface-names 533(dbus-introspect-get-interface-names
525 :system "org.freedesktop.Hal" 534 :system "org.freedesktop.Hal"
526 "/org/freedesktop/Hal/devices/computer") 535 "/org/freedesktop/Hal/devices/computer")
527 536
528@result{} ("org.freedesktop.DBus.Introspectable" 537@result{} ("org.freedesktop.DBus.Introspectable"
529 "org.freedesktop.Hal.Device" 538 "org.freedesktop.Hal.Device"
@@ -533,30 +542,27 @@ children. Example:
533@end defun 542@end defun
534 543
535@defun dbus-introspect-get-interface bus service path interface 544@defun dbus-introspect-get-interface bus service path interface
536Return @var{interface} of @var{service} in D-Bus @var{bus} at object 545This function returns @var{interface} of @var{service} in D-Bus
537path @var{path}. The return value is an XML element. @var{interface} 546@var{bus} at object path @var{path}. The return value is an XML
538must be a string, element of the list returned by 547element. @var{interface} must be a string and a member of the list
539@code{dbus-introspect-get-interface-names}. Example: 548returned by @code{dbus-introspect-get-interface-names}. Example:
540 549
541@lisp 550@lisp
542(dbus-introspect-get-interface 551(dbus-introspect-get-interface
543 :session "org.freedesktop.xesam.searcher" 552 :session "org.freedesktop.xesam.searcher"
544 "/org/freedesktop/xesam/searcher/main" 553 "/org/freedesktop/xesam/searcher/main"
545 "org.freedesktop.xesam.Search") 554 "org.freedesktop.xesam.Search")
546 555
547@result{} (interface ((name . "org.freedesktop.xesam.Search")) 556@result{} (interface ((name . "org.freedesktop.xesam.Search"))
548 (method ((name . "GetHitData")) 557 (method ((name . "GetHitData"))
549 (arg ((name . "search") (type . "s") (direction . "in"))) 558 (arg ((name . "search") (type . "s") (direction . "in")))
550 (arg ((name . "hit_ids") (type . "au") (direction . "in"))) 559 (arg ((name . "hit_ids") (type . "au") (direction . "in")))
551 (arg ((name . "fields") (type . "as") (direction . "in"))) 560 (arg ((name . "fields") (type . "as") (direction . "in")))
552 (arg ((name . "hit_data") (type . "aav") (direction . "out"))) 561 (arg ((name . "hit_data") (type . "aav") (direction . "out"))))
553 )
554 @dots{} 562 @dots{}
555 (signal ((name . "HitsAdded")) 563 (signal ((name . "HitsAdded"))
556 (arg ((name . "search") (type . "s"))) 564 (arg ((name . "search") (type . "s")))
557 (arg ((name . "count") (type . "u"))) 565 (arg ((name . "count") (type . "u")))))
558 )
559 )
560@end lisp 566@end lisp
561@end defun 567@end defun
562 568
@@ -565,7 +571,8 @@ With these functions, it is possible to retrieve all introspection
565data from a running system: 571data from a running system:
566 572
567@lisp 573@lisp
568(with-current-buffer (switch-to-buffer "*introspect*") 574(progn
575 (pop-to-buffer "*introspect*")
569 (erase-buffer) 576 (erase-buffer)
570 (dolist (service (dbus-list-known-names :session)) 577 (dolist (service (dbus-list-known-names :session))
571 (dolist (path (dbus-introspect-get-all-nodes :session service "/")) 578 (dolist (path (dbus-introspect-get-all-nodes :session service "/"))
@@ -574,7 +581,7 @@ data from a running system:
574 (when (delete 581 (when (delete
575 "org.freedesktop.DBus.Introspectable" 582 "org.freedesktop.DBus.Introspectable"
576 (dbus-introspect-get-interface-names :session service path)) 583 (dbus-introspect-get-interface-names :session service path))
577 (insert (message "\nservice: \"%s\" path: \"%s\"\n" service path) 584 (insert (format "\nservice: \"%s\" path: \"%s\"\n" service path)
578 (dbus-introspect :session service path)) 585 (dbus-introspect :session service path))
579 (redisplay t))))) 586 (redisplay t)))))
580@end lisp 587@end lisp
@@ -587,14 +594,15 @@ Methods and signals are the communication means to D-Bus. The
587following functions return their specifications. 594following functions return their specifications.
588 595
589@defun dbus-introspect-get-method-names bus service path interface 596@defun dbus-introspect-get-method-names bus service path interface
590Return a list of strings of all method names of @var{interface} of 597This function returns a list of strings of all method names of
591@var{service} in D-Bus @var{bus} at object path @var{path}. Example: 598@var{interface} of @var{service} in D-Bus @var{bus} at object path
599@var{path}. Example:
592 600
593@lisp 601@lisp
594(dbus-introspect-get-method-names 602(dbus-introspect-get-method-names
595 :session "org.freedesktop.xesam.searcher" 603 :session "org.freedesktop.xesam.searcher"
596 "/org/freedesktop/xesam/searcher/main" 604 "/org/freedesktop/xesam/searcher/main"
597 "org.freedesktop.xesam.Search") 605 "org.freedesktop.xesam.Search")
598 606
599@result{} ("GetState" "StartSearch" "GetHitCount" "GetHits" "NewSession" 607@result{} ("GetState" "StartSearch" "GetHitCount" "GetHits" "NewSession"
600 "CloseSession" "GetHitData" "SetProperty" "NewSearch" 608 "CloseSession" "GetHitData" "SetProperty" "NewSearch"
@@ -603,35 +611,36 @@ Return a list of strings of all method names of @var{interface} of
603@end defun 611@end defun
604 612
605@defun dbus-introspect-get-method bus service path interface method 613@defun dbus-introspect-get-method bus service path interface method
606This function returns @var{method} of @var{interface} as XML element. 614This function returns @var{method} of @var{interface} as an XML
607It must be located at @var{service} in D-Bus @var{bus} at object path 615element. It must be located at @var{service} in D-Bus @var{bus} at
608@var{path}. @var{method} must be a string, element of the list 616object path @var{path}. @var{method} must be a string and a member of
609returned by @code{dbus-introspect-get-method-names}. Example: 617the list returned by @code{dbus-introspect-get-method-names}.
618Example:
610 619
611@lisp 620@lisp
612(dbus-introspect-get-method 621(dbus-introspect-get-method
613 :session "org.freedesktop.xesam.searcher" 622 :session "org.freedesktop.xesam.searcher"
614 "/org/freedesktop/xesam/searcher/main" 623 "/org/freedesktop/xesam/searcher/main"
615 "org.freedesktop.xesam.Search" "GetHitData") 624 "org.freedesktop.xesam.Search" "GetHitData")
616 625
617@result{} (method ((name . "GetHitData")) 626@result{} (method ((name . "GetHitData"))
618 (arg ((name . "search") (type . "s") (direction . "in"))) 627 (arg ((name . "search") (type . "s") (direction . "in")))
619 (arg ((name . "hit_ids") (type . "au") (direction . "in"))) 628 (arg ((name . "hit_ids") (type . "au") (direction . "in")))
620 (arg ((name . "fields") (type . "as") (direction . "in"))) 629 (arg ((name . "fields") (type . "as") (direction . "in")))
621 (arg ((name . "hit_data") (type . "aav") (direction . "out"))) 630 (arg ((name . "hit_data") (type . "aav") (direction . "out"))))
622 )
623@end lisp 631@end lisp
624@end defun 632@end defun
625 633
626@defun dbus-introspect-get-signal-names bus service path interface 634@defun dbus-introspect-get-signal-names bus service path interface
627Return a list of strings of all signal names of @var{interface} of 635This function returns a list of strings of all signal names of
628@var{service} in D-Bus @var{bus} at object path @var{path}. Example: 636@var{interface} of @var{service} in D-Bus @var{bus} at object path
637@var{path}. Example:
629 638
630@lisp 639@lisp
631(dbus-introspect-get-signal-names 640(dbus-introspect-get-signal-names
632 :session "org.freedesktop.xesam.searcher" 641 :session "org.freedesktop.xesam.searcher"
633 "/org/freedesktop/xesam/searcher/main" 642 "/org/freedesktop/xesam/searcher/main"
634 "org.freedesktop.xesam.Search") 643 "org.freedesktop.xesam.Search")
635 644
636@result{} ("StateChanged" "SearchDone" "HitsModified" 645@result{} ("StateChanged" "SearchDone" "HitsModified"
637 "HitsRemoved" "HitsAdded") 646 "HitsRemoved" "HitsAdded")
@@ -639,21 +648,21 @@ Return a list of strings of all signal names of @var{interface} of
639@end defun 648@end defun
640 649
641@defun dbus-introspect-get-signal bus service path interface signal 650@defun dbus-introspect-get-signal bus service path interface signal
642This function returns @var{signal} of @var{interface} as XML element. 651This function returns @var{signal} of @var{interface} as an XML
643It must be located at @var{service} in D-Bus @var{bus} at object path 652element. It must be located at @var{service} in D-Bus @var{bus} at
644@var{path}. @var{signal} must be a string, element of the list 653object path @var{path}. @var{signal} must be a string and a member of
645returned by @code{dbus-introspect-get-signal-names}. Example: 654the list returned by @code{dbus-introspect-get-signal-names}.
655Example:
646 656
647@lisp 657@lisp
648(dbus-introspect-get-signal 658(dbus-introspect-get-signal
649 :session "org.freedesktop.xesam.searcher" 659 :session "org.freedesktop.xesam.searcher"
650 "/org/freedesktop/xesam/searcher/main" 660 "/org/freedesktop/xesam/searcher/main"
651 "org.freedesktop.xesam.Search" "HitsAdded") 661 "org.freedesktop.xesam.Search" "HitsAdded")
652 662
653@result{} (signal ((name . "HitsAdded")) 663@result{} (signal ((name . "HitsAdded"))
654 (arg ((name . "search") (type . "s"))) 664 (arg ((name . "search") (type . "s")))
655 (arg ((name . "count") (type . "u"))) 665 (arg ((name . "count") (type . "u"))))
656 )
657@end lisp 666@end lisp
658@end defun 667@end defun
659 668
@@ -664,8 +673,8 @@ returned by @code{dbus-introspect-get-signal-names}. Example:
664Interfaces can have properties. These can be exposed via the 673Interfaces can have properties. These can be exposed via the
665@samp{org.freedesktop.DBus.Properties} interface@footnote{See 674@samp{org.freedesktop.DBus.Properties} interface@footnote{See
666@uref{https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties}}. 675@uref{https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties}}.
667That is, properties can be retrieved and changed during lifetime of an 676That is, properties can be retrieved and changed during the lifetime
668element. 677of an element.
669 678
670A generalized interface is 679A generalized interface is
671@samp{org.freedesktop.DBus.Objectmanager}@footnote{See 680@samp{org.freedesktop.DBus.Objectmanager}@footnote{See
@@ -678,13 +687,14 @@ Often, they are used to instruct generators, how to generate code from
678the interface for a given language binding. 687the interface for a given language binding.
679 688
680@defun dbus-introspect-get-property-names bus service path interface 689@defun dbus-introspect-get-property-names bus service path interface
681Return a list of strings with all property names of @var{interface} of 690This function returns a list of strings with all property names of
682@var{service} in D-Bus @var{bus} at object path @var{path}. Example: 691@var{interface} of @var{service} in D-Bus @var{bus} at object path
692@var{path}. Example:
683 693
684@lisp 694@lisp
685(dbus-introspect-get-property-names 695(dbus-introspect-get-property-names
686 :session "org.kde.kded" "/modules/networkstatus" 696 :session "org.kde.kded" "/modules/networkstatus"
687 "org.kde.Solid.Networking.Client") 697 "org.kde.Solid.Networking.Client")
688 698
689@result{} ("Status") 699@result{} ("Status")
690@end lisp 700@end lisp
@@ -694,26 +704,26 @@ also the @samp{org.freedesktop.DBus.Properties} interface.
694@end defun 704@end defun
695 705
696@defun dbus-introspect-get-property bus service path interface property 706@defun dbus-introspect-get-property bus service path interface property
697This function returns @var{property} of @var{interface} as XML element. 707This function returns @var{property} of @var{interface} as an XML
698It must be located at @var{service} in D-Bus @var{bus} at object path 708element. It must be located at @var{service} in D-Bus @var{bus} at
699@var{path}. @var{property} must be a string, element of the list 709object path @var{path}. @var{property} must be a string and a member
700returned by @code{dbus-introspect-get-property-names}. 710of the list returned by @code{dbus-introspect-get-property-names}.
701 711
702A @var{property} value can be retrieved by the function 712A @var{property} value can be retrieved by the function
703@code{dbus-introspect-get-attribute}. Example: 713@code{dbus-introspect-get-attribute}. Example:
704 714
705@lisp 715@lisp
706(dbus-introspect-get-property 716(dbus-introspect-get-property
707 :session "org.kde.kded" "/modules/networkstatus" 717 :session "org.kde.kded" "/modules/networkstatus"
708 "org.kde.Solid.Networking.Client" "Status") 718 "org.kde.Solid.Networking.Client" "Status")
709 719
710@result{} (property ((access . "read") (type . "u") (name . "Status"))) 720@result{} (property ((access . "read") (type . "u") (name . "Status")))
711 721
712(dbus-introspect-get-attribute 722(dbus-introspect-get-attribute
713 (dbus-introspect-get-property 723 (dbus-introspect-get-property
714 :session "org.kde.kded" "/modules/networkstatus" 724 :session "org.kde.kded" "/modules/networkstatus"
715 "org.kde.Solid.Networking.Client" "Status") 725 "org.kde.Solid.Networking.Client" "Status")
716 "access") 726 "access")
717 727
718@result{} "read" 728@result{} "read"
719@end lisp 729@end lisp
@@ -727,23 +737,23 @@ result can be any valid D-Bus value, or @code{nil} if there is no
727 737
728@lisp 738@lisp
729(dbus-get-property 739(dbus-get-property
730 :session "org.kde.kded" "/modules/networkstatus" 740 :session "org.kde.kded" "/modules/networkstatus"
731 "org.kde.Solid.Networking.Client" "Status") 741 "org.kde.Solid.Networking.Client" "Status")
732 742
733@result{} 4 743@result{} 4
734@end lisp 744@end lisp
735@end defun 745@end defun
736 746
737@defun dbus-set-property bus service path interface property value 747@defun dbus-set-property bus service path interface property value
738Set value of @var{property} of @var{interface} to @var{value}. It 748This function sets the value of @var{property} of @var{interface} to
739will be checked at @var{bus}, @var{service}, @var{path}. When the 749@var{value}. It will be checked at @var{bus}, @var{service},
740value has been set successful, the result is @var{value}. Otherwise, 750@var{path}. When the value is successfully set, this function returns
741@code{nil} is returned. Example: 751@var{value}. Otherwise, it returns @code{nil}. Example:
742 752
743@lisp 753@lisp
744(dbus-set-property 754(dbus-set-property
745 :session "org.kde.kaccess" "/MainApplication" 755 :session "org.kde.kaccess" "/MainApplication"
746 "com.trolltech.Qt.QApplication" "doubleClickInterval" 500) 756 "com.trolltech.Qt.QApplication" "doubleClickInterval" 500)
747 757
748@result{} 500 758@result{} 500
749@end lisp 759@end lisp
@@ -757,8 +767,8 @@ If there are no properties, @code{nil} is returned. Example:
757 767
758@lisp 768@lisp
759(dbus-get-all-properties 769(dbus-get-all-properties
760 :session "org.kde.kaccess" "/MainApplication" 770 :session "org.kde.kaccess" "/MainApplication"
761 "com.trolltech.Qt.QApplication") 771 "com.trolltech.Qt.QApplication")
762 772
763@result{} (("cursorFlashTime" . 1000) ("doubleClickInterval" . 500) 773@result{} (("cursorFlashTime" . 1000) ("doubleClickInterval" . 500)
764 ("keyboardInputInterval" . 400) ("wheelScrollLines" . 3) 774 ("keyboardInputInterval" . 400) ("wheelScrollLines" . 3)
@@ -773,13 +783,13 @@ This function returns all objects at @var{bus}, @var{service},
773@var{path}, and the children of @var{path}. The result is a list of 783@var{path}, and the children of @var{path}. The result is a list of
774objects. Every object is a cons of an existing path name, and the 784objects. Every object is a cons of an existing path name, and the
775list of available interface objects. An interface object is another 785list of available interface objects. An interface object is another
776cons, which car is the interface name, and the cdr is the list of 786cons, whose car is the interface name and cdr is the list of
777properties as returned by @code{dbus-get-all-properties} for that path 787properties as returned by @code{dbus-get-all-properties} for that path
778and interface. Example: 788and interface. Example:
779 789
780@lisp 790@lisp
781(dbus-get-all-managed-objects 791(dbus-get-all-managed-objects
782 :session "org.gnome.SettingsDaemon" "/") 792 :session "org.gnome.SettingsDaemon" "/")
783 793
784@result{} (("/org/gnome/SettingsDaemon/MediaKeys" 794@result{} (("/org/gnome/SettingsDaemon/MediaKeys"
785 ("org.gnome.SettingsDaemon.MediaKeys") 795 ("org.gnome.SettingsDaemon.MediaKeys")
@@ -809,31 +819,28 @@ An overview of all existing object paths, their interfaces and
809properties could be retrieved by the following code: 819properties could be retrieved by the following code:
810 820
811@lisp 821@lisp
812(with-current-buffer (switch-to-buffer "*objectmanager*") 822(let ((result (mapcar (lambda (service)
823 (cons service
824 (dbus-get-all-managed-objects
825 :session service "/")))
826 (dbus-list-known-names :session))))
827 (pop-to-buffer "*objectmanager*")
813 (erase-buffer) 828 (erase-buffer)
814 (let (result) 829 (pp result (current-buffer)))
815 (dolist (service (dbus-list-known-names :session) result)
816 (message "%s" service)
817 (add-to-list
818 'result
819 (cons service
820 (dbus-get-all-managed-objects :session service "/"))))
821 (insert (message "%s" (pp result)))
822 (redisplay t)))
823@end lisp 830@end lisp
824@end defun 831@end defun
825 832
826@defun dbus-introspect-get-annotation-names bus service path interface &optional name 833@defun dbus-introspect-get-annotation-names bus service path interface &optional name
827Return a list of all annotation names as list of strings. If 834This function returns a list of all annotation names as list of
828@var{name} is @code{nil}, the annotations are children of 835strings. If @var{name} is @code{nil}, the annotations are children of
829@var{interface}, otherwise @var{name} must be a @code{method}, 836@var{interface}, otherwise @var{name} must be a @code{method},
830@code{signal}, or @code{property} XML element, where the annotations 837@code{signal}, or @code{property} XML element, where the annotations
831belong to. Example: 838belong to. Example:
832 839
833@lisp 840@lisp
834(dbus-introspect-get-annotation-names 841(dbus-introspect-get-annotation-names
835 :session "de.berlios.Pinot" "/de/berlios/Pinot" 842 :session "de.berlios.Pinot" "/de/berlios/Pinot"
836 "de.berlios.Pinot" "GetStatistics") 843 "de.berlios.Pinot" "GetStatistics")
837 844
838@result{} ("de.berlios.Pinot.GetStatistics") 845@result{} ("de.berlios.Pinot.GetStatistics")
839@end lisp 846@end lisp
@@ -855,29 +862,30 @@ If set, don't expect a reply to the @code{method} call; defaults to @code{nil}
855@end defun 862@end defun
856 863
857@defun dbus-introspect-get-annotation bus service path interface name annotation 864@defun dbus-introspect-get-annotation bus service path interface name annotation
858Return annotation @var{ANNOTATION} as XML object. If @var{name} is 865This function returns @var{annotation} as an XML object. If
859@code{nil}, @var{ANNOTATION} is a child of @var{interface}, otherwise 866@var{name} is @code{nil}, @var{annotation} is a child of
860@var{name} must be the name of a @code{method}, @code{signal}, or 867@var{interface}, otherwise @var{name} must be the name of a
861@code{property} XML element, where the @var{ANNOTATION} belongs to. 868@code{method}, @code{signal}, or @code{property} XML element, where
869the @var{annotation} belongs to.
862 870
863An attribute value can be retrieved by 871An attribute value can be retrieved by
864@code{dbus-introspect-get-attribute}. Example: 872@code{dbus-introspect-get-attribute}. Example:
865 873
866@lisp 874@lisp
867(dbus-introspect-get-annotation 875(dbus-introspect-get-annotation
868 :session "de.berlios.Pinot" "/de/berlios/Pinot" 876 :session "de.berlios.Pinot" "/de/berlios/Pinot"
869 "de.berlios.Pinot" "GetStatistics" 877 "de.berlios.Pinot" "GetStatistics"
870 "de.berlios.Pinot.GetStatistics") 878 "de.berlios.Pinot.GetStatistics")
871 879
872@result{} (annotation ((name . "de.berlios.Pinot.GetStatistics") 880@result{} (annotation ((name . "de.berlios.Pinot.GetStatistics")
873 (value . "pinotDBus"))) 881 (value . "pinotDBus")))
874 882
875(dbus-introspect-get-attribute 883(dbus-introspect-get-attribute
876 (dbus-introspect-get-annotation 884 (dbus-introspect-get-annotation
877 :session "de.berlios.Pinot" "/de/berlios/Pinot" 885 :session "de.berlios.Pinot" "/de/berlios/Pinot"
878 "de.berlios.Pinot" "GetStatistics" 886 "de.berlios.Pinot" "GetStatistics"
879 "de.berlios.Pinot.GetStatistics") 887 "de.berlios.Pinot.GetStatistics")
880 "value") 888 "value")
881 889
882@result{} "pinotDBus" 890@result{} "pinotDBus"
883@end lisp 891@end lisp
@@ -891,39 +899,41 @@ Methods and signals have arguments. They are described in the
891@code{arg} XML elements. 899@code{arg} XML elements.
892 900
893@defun dbus-introspect-get-argument-names bus service path interface name 901@defun dbus-introspect-get-argument-names bus service path interface name
894Return a list of all argument names as list of strings. @var{name} 902This function returns a list of all argument names as strings.
895must be a @code{method} or @code{signal} XML element. Example: 903@var{name} must be a @code{method} or @code{signal} XML element.
904Example:
896 905
897@lisp 906@lisp
898(dbus-introspect-get-argument-names 907(dbus-introspect-get-argument-names
899 :session "org.freedesktop.xesam.searcher" 908 :session "org.freedesktop.xesam.searcher"
900 "/org/freedesktop/xesam/searcher/main" 909 "/org/freedesktop/xesam/searcher/main"
901 "org.freedesktop.xesam.Search" "GetHitData") 910 "org.freedesktop.xesam.Search" "GetHitData")
902 911
903@result{} ("search" "hit_ids" "fields" "hit_data") 912@result{} ("search" "hit_ids" "fields" "hit_data")
904@end lisp 913@end lisp
905 914
906Argument names are optional; the function can return @code{nil} 915Argument names are optional; the function can therefore return
907therefore, even if the method or signal has arguments. 916@code{nil}, even if the method or signal has arguments.
908@end defun 917@end defun
909 918
910@defun dbus-introspect-get-argument bus service path interface name arg 919@defun dbus-introspect-get-argument bus service path interface name arg
911Return argument @var{ARG} as XML object. @var{name} 920This function returns the argument @var{arg} as an XML object.
912must be a @code{method} or @code{signal} XML element. Example: 921@var{name} must be a @code{method} or @code{signal} XML element.
922Example:
913 923
914@lisp 924@lisp
915(dbus-introspect-get-argument 925(dbus-introspect-get-argument
916 :session "org.freedesktop.xesam.searcher" 926 :session "org.freedesktop.xesam.searcher"
917 "/org/freedesktop/xesam/searcher/main" 927 "/org/freedesktop/xesam/searcher/main"
918 "org.freedesktop.xesam.Search" "GetHitData" "search") 928 "org.freedesktop.xesam.Search" "GetHitData" "search")
919 929
920@result{} (arg ((name . "search") (type . "s") (direction . "in"))) 930@result{} (arg ((name . "search") (type . "s") (direction . "in")))
921@end lisp 931@end lisp
922@end defun 932@end defun
923 933
924@defun dbus-introspect-get-signature bus service path interface name &optional direction 934@defun dbus-introspect-get-signature bus service path interface name &optional direction
925Return signature of a @code{method} or @code{signal}, represented by 935This function returns the signature of a @code{method} or
926@var{name}, as string. 936@code{signal}, represented by @var{name}, as a string.
927 937
928If @var{name} is a @code{method}, @var{direction} can be either 938If @var{name} is a @code{method}, @var{direction} can be either
929@samp{in} or @samp{out}. If @var{direction} is @code{nil}, @samp{in} 939@samp{in} or @samp{out}. If @var{direction} is @code{nil}, @samp{in}
@@ -934,16 +944,16 @@ non-@code{nil}, @var{direction} must be @samp{out}. Example:
934 944
935@lisp 945@lisp
936(dbus-introspect-get-signature 946(dbus-introspect-get-signature
937 :session "org.freedesktop.xesam.searcher" 947 :session "org.freedesktop.xesam.searcher"
938 "/org/freedesktop/xesam/searcher/main" 948 "/org/freedesktop/xesam/searcher/main"
939 "org.freedesktop.xesam.Search" "GetHitData" "in") 949 "org.freedesktop.xesam.Search" "GetHitData" "in")
940 950
941@result{} "sauas" 951@result{} "sauas"
942 952
943(dbus-introspect-get-signature 953(dbus-introspect-get-signature
944 :session "org.freedesktop.xesam.searcher" 954 :session "org.freedesktop.xesam.searcher"
945 "/org/freedesktop/xesam/searcher/main" 955 "/org/freedesktop/xesam/searcher/main"
946 "org.freedesktop.xesam.Search" "HitsAdded") 956 "org.freedesktop.xesam.Search" "HitsAdded")
947 957
948@result{} "su" 958@result{} "su"
949@end lisp 959@end lisp
@@ -998,30 +1008,27 @@ types are represented by the type symbols @code{:byte},
998Example: 1008Example:
999 1009
1000@lisp 1010@lisp
1001(dbus-call-method @dots{} @var{NAT-NUMBER} @var{STRING}) 1011(dbus-call-method @dots{} @var{nat-number} @var{string})
1002@end lisp 1012@end lisp
1003 1013
1004is equivalent to 1014is equivalent to
1005 1015
1006@lisp 1016@lisp
1007(dbus-call-method @dots{} :uint32 @var{NAT-NUMBER} :string @var{STRING}) 1017(dbus-call-method @dots{} :uint32 @var{nat-number} :string @var{string})
1008@end lisp 1018@end lisp
1009 1019
1010but different to 1020but different to
1011 1021
1012@lisp 1022@lisp
1013(dbus-call-method @dots{} :int32 @var{NAT-NUMBER} :signature @var{STRING}) 1023(dbus-call-method @dots{} :int32 @var{nat-number} :signature @var{string})
1014@end lisp 1024@end lisp
1015 1025
1016The value for a byte D-Bus type can be any integer in the range 0 1026The value for a byte D-Bus type can be any integer in the range 0
1017through 255. If a character is used as argument, modifiers 1027through 255. If a character is used as argument, modifiers
1018represented outside this range are stripped off. For example, 1028represented outside this range are stripped off. For example,
1019@code{:byte ?x} is equal to @code{:byte ?\M-x}, but it is not equal to 1029@code{:byte ?x} is equal to @code{:byte ?\M-x}, but it is not equal to
1020@code{:byte ?\C-x} or @code{:byte ?\M-\C-x}. 1030@code{:byte ?\C-x} or @code{:byte ?\M-\C-x}. Signed and unsigned
1021 1031integer D-Bus types expect a corresponding integer value.
1022Signed and unsigned integer D-Bus types expect a corresponding integer
1023value. If the value does not fit Emacs's integer range, it is also
1024possible to use an equivalent floating point number.
1025 1032
1026A D-Bus compound type is always represented as a list. The @sc{car} 1033A D-Bus compound type is always represented as a list. The @sc{car}
1027of this list can be the type symbol @code{:array}, @code{:variant}, 1034of this list can be the type symbol @code{:array}, @code{:variant},
@@ -1036,13 +1043,13 @@ D-Bus compound type rules.
1036@item An array must contain only elements of the same D-Bus type. It 1043@item An array must contain only elements of the same D-Bus type. It
1037can be empty. 1044can be empty.
1038 1045
1039@item A variant must contain only one single element. 1046@item A variant must contain only a single element.
1040 1047
1041@item A dictionary entry must be element of an array, and it must 1048@item A dictionary entry must be an element of an array, and it must
1042contain only a key-value pair of two elements, with a basic D-Bus type 1049contain only a key-value pair of two elements, with a basic D-Bus type
1043key. 1050key.
1044 1051
1045@item There is no restriction for structs. 1052@item There are no restrictions for structs.
1046@end itemize 1053@end itemize
1047 1054
1048If an empty array needs an element D-Bus type other than string, it 1055If an empty array needs an element D-Bus type other than string, it
@@ -1052,27 +1059,27 @@ elements of this array. Example:
1052 1059
1053@lisp 1060@lisp
1054(dbus-call-method 1061(dbus-call-method
1055 :session "org.freedesktop.Notifications" 1062 :session "org.freedesktop.Notifications"
1056 "/org/freedesktop/Notifications" 1063 "/org/freedesktop/Notifications"
1057 "org.freedesktop.Notifications" "Notify" 1064 "org.freedesktop.Notifications" "Notify"
1058 "GNU Emacs" ;; Application name. 1065 "GNU Emacs" ; Application name.
1059 0 ;; No replacement of other notifications. 1066 0 ; No replacement of other notifications.
1060 "" ;; No icon. 1067 "" ; No icon.
1061 "Notification summary" ;; Summary. 1068 "Notification summary" ; Summary.
1062 (format ;; Body. 1069 (format ; Body.
1063 "This is a test notification, raised from\n%S" (emacs-version)) 1070 "This is a test notification, raised from\n%S" (emacs-version))
1064 '(:array) ;; No actions (empty array of strings). 1071 '(:array) ; No actions (empty array of strings).
1065 '(:array :signature "@{sv@}") ;; No hints 1072 '(:array :signature "@{sv@}") ; No hints
1066 ;; (empty array of dictionary entries). 1073 ; (empty array of dictionary entries).
1067 :int32 -1) ;; Default timeout. 1074 :int32 -1) ; Default timeout.
1068 1075
1069@result{} 3 1076@result{} 3
1070@end lisp 1077@end lisp
1071 1078
1072@defun dbus-string-to-byte-array string 1079@defun dbus-string-to-byte-array string
1073Sometimes, D-Bus methods require as input parameter an array of bytes, 1080Sometimes, D-Bus methods require as input parameter an array of bytes,
1074instead of a string. If it is guaranteed, that @var{string} is an 1081instead of a string. If it is guaranteed, that @var{string} is a
1075UTF8 string, this function performs the conversion. Example: 1082UTF-8 string, this function performs the conversion. Example:
1076 1083
1077@lisp 1084@lisp
1078(dbus-string-to-byte-array "/etc/hosts") 1085(dbus-string-to-byte-array "/etc/hosts")
@@ -1083,10 +1090,10 @@ UTF8 string, this function performs the conversion. Example:
1083@end defun 1090@end defun
1084 1091
1085@defun dbus-escape-as-identifier string 1092@defun dbus-escape-as-identifier string
1086Escape an arbitrary @var{string} so it follows the rules for a C 1093This function escapes an arbitrary @var{string} so it follows the
1087identifier. The escaped string can be used as object path component, 1094rules for a C identifier. The escaped string can be used as object
1088interface element component, bus name component or member name in 1095path component, interface element component, bus name component or
1089D-Bus. 1096member name in D-Bus.
1090 1097
1091The escaping consists of replacing all non-alphanumerics, and the 1098The escaping consists of replacing all non-alphanumerics, and the
1092first character if it's a digit, with an underscore and two 1099first character if it's a digit, with an underscore and two
@@ -1107,18 +1114,18 @@ Output parameters of D-Bus methods and signals are mapped to Lisp
1107objects. 1114objects.
1108 1115
1109@example 1116@example
1110@multitable {DBUS_TYPE_OBJECT_PATH} {@expansion{}} {natural number or float} 1117@multitable {DBUS_TYPE_OBJECT_PATH} {@expansion{}} {natural number}
1111@item D-Bus type @tab @tab Lisp type 1118@item D-Bus type @tab @tab Lisp type
1112@item 1119@item
1113@item DBUS_TYPE_BOOLEAN @tab @expansion{} @tab @code{t} or @code{nil} 1120@item DBUS_TYPE_BOOLEAN @tab @expansion{} @tab @code{t} or @code{nil}
1114@item DBUS_TYPE_BYTE @tab @expansion{} @tab natural number 1121@item DBUS_TYPE_BYTE @tab @expansion{} @tab natural number
1115@item DBUS_TYPE_UINT16 @tab @expansion{} @tab natural number 1122@item DBUS_TYPE_UINT16 @tab @expansion{} @tab natural number
1116@item DBUS_TYPE_INT16 @tab @expansion{} @tab integer 1123@item DBUS_TYPE_INT16 @tab @expansion{} @tab integer
1117@item DBUS_TYPE_UINT32 @tab @expansion{} @tab natural number or float 1124@item DBUS_TYPE_UINT32 @tab @expansion{} @tab natural number
1118@item DBUS_TYPE_UNIX_FD @tab @expansion{} @tab natural number or float 1125@item DBUS_TYPE_UNIX_FD @tab @expansion{} @tab natural number
1119@item DBUS_TYPE_INT32 @tab @expansion{} @tab integer or float 1126@item DBUS_TYPE_INT32 @tab @expansion{} @tab integer
1120@item DBUS_TYPE_UINT64 @tab @expansion{} @tab natural number or float 1127@item DBUS_TYPE_UINT64 @tab @expansion{} @tab natural number
1121@item DBUS_TYPE_INT64 @tab @expansion{} @tab integer or float 1128@item DBUS_TYPE_INT64 @tab @expansion{} @tab integer
1122@item DBUS_TYPE_DOUBLE @tab @expansion{} @tab float 1129@item DBUS_TYPE_DOUBLE @tab @expansion{} @tab float
1123@item DBUS_TYPE_STRING @tab @expansion{} @tab string 1130@item DBUS_TYPE_STRING @tab @expansion{} @tab string
1124@item DBUS_TYPE_OBJECT_PATH @tab @expansion{} @tab string 1131@item DBUS_TYPE_OBJECT_PATH @tab @expansion{} @tab string
@@ -1130,26 +1137,21 @@ objects.
1130@end multitable 1137@end multitable
1131@end example 1138@end example
1132 1139
1133A float object in case of @code{DBUS_TYPE_UINT32},
1134@code{DBUS_TYPE_INT32}, @code{DBUS_TYPE_UINT64},
1135@code{DBUS_TYPE_INT64} and @code{DBUS_TYPE_UNIX_FD} is returned, when
1136the C value exceeds the Emacs number size range.
1137
1138The resulting list of the last 4 D-Bus compound types contains as 1140The resulting list of the last 4 D-Bus compound types contains as
1139elements the elements of the D-Bus container, mapped according to the 1141elements the elements of the D-Bus container, mapped according to the
1140same rules. 1142same rules.
1141 1143
1142The signal @code{PropertyModified}, discussed as example in 1144The signal @code{PropertyModified}, discussed as an example in
1143@ref{Inspection}, would offer as Lisp data the following object 1145@ref{Inspection}, would offer as Lisp data the following object
1144(@var{BOOL} stands here for either @code{nil} or @code{t}): 1146(@var{bool} stands here for either @code{nil} or @code{t}):
1145 1147
1146@lisp 1148@lisp
1147(@var{INTEGER} ((@var{STRING} @var{BOOL} @var{BOOL}) (@var{STRING} @var{BOOL} @var{BOOL}) @dots{})) 1149(@var{integer} ((@var{string} @var{bool} @var{bool}) (@var{string} @var{bool} @var{bool}) @dots{}))
1148@end lisp 1150@end lisp
1149 1151
1150@defun dbus-byte-array-to-string byte-array &optional multibyte 1152@defun dbus-byte-array-to-string byte-array &optional multibyte
1151If a D-Bus method or signal returns an array of bytes, which are known 1153If a D-Bus method or signal returns an array of bytes, which are known
1152to represent an UTF8 string, this function converts @var{byte-array} 1154to represent a UTF-8 string, this function converts @var{byte-array}
1153to the corresponding string. The string is unibyte encoded, unless 1155to the corresponding string. The string is unibyte encoded, unless
1154@var{multibyte} is non-@code{nil}. Example: 1156@var{multibyte} is non-@code{nil}. Example:
1155 1157
@@ -1161,9 +1163,9 @@ to the corresponding string. The string is unibyte encoded, unless
1161@end defun 1163@end defun
1162 1164
1163@defun dbus-unescape-from-identifier string 1165@defun dbus-unescape-from-identifier string
1164Retrieve the original string from the encoded @var{string} as unibyte 1166This function retrieves the original string from the encoded
1165string. @var{string} must have been encoded with 1167@var{string} as a unibyte string. The value of @var{string} must have
1166@code{dbus-escape-as-identifier}. Example: 1168been encoded with @code{dbus-escape-as-identifier}. Example:
1167 1169
1168@lisp 1170@lisp
1169(dbus-unescape-from-identifier "_30123abc_5fxyz_01_ff") 1171(dbus-unescape-from-identifier "_30123abc_5fxyz_01_ff")
@@ -1177,9 +1179,9 @@ that string:
1177 1179
1178@lisp 1180@lisp
1179(string-equal 1181(string-equal
1180 (dbus-unescape-from-identifier 1182 (dbus-unescape-from-identifier
1181 (dbus-escape-as-identifier "Grüß Göttin")) 1183 (dbus-escape-as-identifier "Grüß Göttin"))
1182 "Grüß Göttin") 1184 "Grüß Göttin")
1183 1185
1184@result{} nil 1186@result{} nil
1185@end lisp 1187@end lisp
@@ -1196,12 +1198,13 @@ that string:
1196Methods can be called synchronously (@dfn{blocking}) or asynchronously 1198Methods can be called synchronously (@dfn{blocking}) or asynchronously
1197(@dfn{non-blocking}). 1199(@dfn{non-blocking}).
1198 1200
1199At D-Bus level, a method call consist of two messages: one message 1201At the D-Bus level, a method call consist of two messages: one message
1200which carries the input parameters to the object owning the method to 1202which carries the input parameters to the object owning the method to
1201be called, and a reply message returning the resulting output 1203be called, and a reply message returning the resulting output
1202parameters from the object. 1204parameters from the object.
1203 1205
1204@defun dbus-call-method bus service path interface method &optional :timeout timeout &rest args 1206@defun dbus-call-method bus service path interface method &optional :timeout timeout &rest args
1207@anchor{dbus-call-method}
1205This function calls @var{method} on the D-Bus @var{bus}. @var{bus} is 1208This function calls @var{method} on the D-Bus @var{bus}. @var{bus} is
1206either the symbol @code{:system} or the symbol @code{:session}. 1209either the symbol @code{:system} or the symbol @code{:session}.
1207 1210
@@ -1210,14 +1213,14 @@ D-Bus object path, @var{service} is registered at. @var{interface} is
1210an interface offered by @var{service}. It must provide @var{method}. 1213an interface offered by @var{service}. It must provide @var{method}.
1211 1214
1212If the parameter @code{:timeout} is given, the following integer 1215If the parameter @code{:timeout} is given, the following integer
1213@var{timeout} specifies the maximum number of milliseconds the method 1216@var{timeout} specifies the maximum number of milliseconds before the
1214call must return. The default value is 25,000. If the method call 1217method call must return. The default value is 25,000. If the method
1215doesn't return in time, a D-Bus error is raised (@pxref{Errors and 1218call doesn't return in time, a D-Bus error is raised (@pxref{Errors
1216Events}). 1219and Events}).
1217 1220
1218All other arguments args are passed to @var{method} as arguments. 1221The remaining arguments @var{args} are passed to @var{method} as
1219They are converted into D-Bus types as described in @ref{Type 1222arguments. They are converted into D-Bus types as described in
1220Conversion}. 1223@ref{Type Conversion}.
1221 1224
1222The function returns the resulting values of @var{method} as a list of 1225The function returns the resulting values of @var{method} as a list of
1223Lisp objects, according to the type conversion rules described in 1226Lisp objects, according to the type conversion rules described in
@@ -1225,9 +1228,9 @@ Lisp objects, according to the type conversion rules described in
1225 1228
1226@lisp 1229@lisp
1227(dbus-call-method 1230(dbus-call-method
1228 :session "org.gnome.seahorse" "/org/gnome/seahorse/keys/openpgp" 1231 :session "org.gnome.seahorse" "/org/gnome/seahorse/keys/openpgp"
1229 "org.gnome.seahorse.Keys" "GetKeyField" 1232 "org.gnome.seahorse.Keys" "GetKeyField"
1230 "openpgp:657984B8C7A966DD" "simple-name") 1233 "openpgp:657984B8C7A966DD" "simple-name")
1231 1234
1232@result{} (t ("Philip R. Zimmermann")) 1235@result{} (t ("Philip R. Zimmermann"))
1233@end lisp 1236@end lisp
@@ -1238,10 +1241,10 @@ object. Example:
1238 1241
1239@lisp 1242@lisp
1240(dbus-call-method 1243(dbus-call-method
1241 :system "org.freedesktop.Hal" 1244 :system "org.freedesktop.Hal"
1242 "/org/freedesktop/Hal/devices/computer" 1245 "/org/freedesktop/Hal/devices/computer"
1243 "org.freedesktop.Hal.Device" "GetPropertyString" 1246 "org.freedesktop.Hal.Device" "GetPropertyString"
1244 "system.kernel.machine") 1247 "system.kernel.machine")
1245 1248
1246@result{} "i686" 1249@result{} "i686"
1247@end lisp 1250@end lisp
@@ -1257,17 +1260,17 @@ emulate the @code{lshal} command on GNU/Linux systems:
1257 1260
1258@lisp 1261@lisp
1259(dolist (device 1262(dolist (device
1260 (dbus-call-method 1263 (dbus-call-method
1261 :system "org.freedesktop.Hal" 1264 :system "org.freedesktop.Hal"
1262 "/org/freedesktop/Hal/Manager" 1265 "/org/freedesktop/Hal/Manager"
1263 "org.freedesktop.Hal.Manager" "GetAllDevices")) 1266 "org.freedesktop.Hal.Manager" "GetAllDevices"))
1264 (message "\nudi = %s" device) 1267 (message "\nudi = %s" device)
1265 (dolist (properties 1268 (dolist (properties
1266 (dbus-call-method 1269 (dbus-call-method
1267 :system "org.freedesktop.Hal" device 1270 :system "org.freedesktop.Hal" device
1268 "org.freedesktop.Hal.Device" "GetAllProperties")) 1271 "org.freedesktop.Hal.Device" "GetAllProperties"))
1269 (message " %s = %S" 1272 (message " %s = %S"
1270 (car properties) (or (caar (cdr properties)) "")))) 1273 (car properties) (or (caadr properties) ""))))
1271 1274
1272@print{} "udi = /org/freedesktop/Hal/devices/computer 1275@print{} "udi = /org/freedesktop/Hal/devices/computer
1273 info.addons = (\"hald-addon-acpi\") 1276 info.addons = (\"hald-addon-acpi\")
@@ -1304,34 +1307,35 @@ D-Bus object path, @var{service} is registered at. @var{interface} is
1304an interface offered by @var{service}. It must provide @var{method}. 1307an interface offered by @var{service}. It must provide @var{method}.
1305 1308
1306@var{handler} is a Lisp function, which is called when the 1309@var{handler} is a Lisp function, which is called when the
1307corresponding return message has arrived. If @var{handler} is 1310corresponding return message arrives. If @var{handler} is @code{nil},
1308@code{nil}, no return message will be expected. 1311no return message will be expected.
1309 1312
1310If the parameter @code{:timeout} is given, the following integer 1313If the parameter @code{:timeout} is given, the following integer
1311@var{timeout} specifies the maximum number of milliseconds a reply 1314@var{timeout} specifies the maximum number of milliseconds before a
1312message must arrive. The default value is 25,000. If there is no 1315reply message must arrive. The default value is 25,000. If there is
1313reply message in time, a D-Bus error is raised (@pxref{Errors and 1316no reply message in time, a D-Bus error is raised (@pxref{Errors and
1314Events}). 1317Events}).
1315 1318
1316All other arguments args are passed to @var{method} as arguments. 1319The remaining arguments @var{args} are passed to @var{method} as
1317They are converted into D-Bus types as described in @ref{Type 1320arguments. They are converted into D-Bus types as described in
1318Conversion}. 1321@ref{Type Conversion}.
1319 1322
1320If @var{handler} is a Lisp function, the function returns a key into 1323If @var{handler} is a Lisp function, the function returns a key into
1321the hash table @code{dbus-registered-objects-table}. The 1324the hash table @code{dbus-registered-objects-table}. The
1322corresponding entry in the hash table is removed, when the return 1325corresponding entry in the hash table is removed, when the return
1323message has been arrived, and @var{handler} is called. Example: 1326message arrives, and @var{handler} is called. Example:
1324 1327
1325@lisp 1328@lisp
1326(dbus-call-method-asynchronously 1329(dbus-call-method-asynchronously
1327 :system "org.freedesktop.Hal" 1330 :system "org.freedesktop.Hal"
1328 "/org/freedesktop/Hal/devices/computer" 1331 "/org/freedesktop/Hal/devices/computer"
1329 "org.freedesktop.Hal.Device" "GetPropertyString" 'message 1332 "org.freedesktop.Hal.Device" "GetPropertyString"
1330 "system.kernel.machine") 1333 (lambda (msg) (message "%s" msg))
1331 1334 "system.kernel.machine")
1332@result{} (:serial :system 2)
1333 1335
1334@print{} i686 1336@print{} i686
1337
1338@result{} (:serial :system 2)
1335@end lisp 1339@end lisp
1336@end defun 1340@end defun
1337 1341
@@ -1347,7 +1351,8 @@ clients. Names on the D-Bus can be registered and unregistered using
1347the following functions: 1351the following functions:
1348 1352
1349@defun dbus-register-service bus service &rest flags 1353@defun dbus-register-service bus service &rest flags
1350Register the known name @var{service} on D-Bus @var{bus}. 1354This function registers the known name @var{service} on D-Bus
1355@var{bus}.
1351 1356
1352@var{bus} is either the symbol @code{:system} or the symbol 1357@var{bus} is either the symbol @code{:system} or the symbol
1353@code{:session}. 1358@code{:session}.
@@ -1357,36 +1362,33 @@ must be a known name.
1357 1362
1358@var{flags} is a subset of the following keywords: 1363@var{flags} is a subset of the following keywords:
1359 1364
1360@itemize 1365@table @code
1361@item @code{:allow-replacement}: Allow another service to become the primary 1366@item :allow-replacement
1362owner if requested. 1367Allow another service to become the primary owner if requested.
1363 1368@item :replace-existing
1364@item @code{:replace-existing}: Request to replace the current primary owner. 1369Request to replace the current primary owner.
1365 1370@item :do-not-queue
1366@item @code{:do-not-queue}: If we can not become the primary owner do not 1371If we can not become the primary owner do not place us in the queue.
1367place us in the queue. 1372@end table
1368@end itemize
1369 1373
1370One of the following keywords is returned: 1374One of the following keywords is returned:
1371 1375
1372@itemize 1376@table @code
1373 1377@item :primary-owner
1374@item @code{:primary-owner}: We have become the primary owner of the name 1378We have become the primary owner of the name @var{service}.
1375@var{service}. 1379@item :in-queue
1376 1380We could not become the primary owner and have been placed in the
1377@item @code{:in-queue}: We could not become the primary owner and 1381queue.
1378have been placed in the queue. 1382@item :exists
1379 1383We already are in the queue.
1380@item @code{:exists}: We already are in the queue. 1384@item :already-owner
1381 1385We already are the primary owner.
1382@item @code{:already-owner}: We already are the primary 1386@end table
1383owner.
1384@end itemize
1385@end defun 1387@end defun
1386 1388
1387@defun dbus-unregister-service bus service 1389@defun dbus-unregister-service bus service
1388Unregister all objects from D-Bus @var{bus}, registered by Emacs for 1390This function unregisters all objects from D-Bus @var{bus}, that were
1389@var{service}. 1391registered by Emacs for @var{service}.
1390 1392
1391@var{bus} is either the symbol @code{:system} or the symbol 1393@var{bus} is either the symbol @code{:system} or the symbol
1392@code{:session}. 1394@code{:session}.
@@ -1397,24 +1399,27 @@ D-Bus.
1397 1399
1398One of the following keywords is returned: 1400One of the following keywords is returned:
1399 1401
1400@itemize 1402@table @code
1401@item @code{:released}: We successfully released the name @var{service}. 1403@item :released
1402@item @code{:non-existent}: The name @var{service} does not exist on the bus. 1404We successfully released the name @var{service}.
1403@item @code{:not-owner}: We are not an owner of the name @var{service}. 1405@item :non-existent
1404@end itemize 1406The name @var{service} does not exist on the bus.
1407@item :not-owner
1408We are not an owner of the name @var{service}.
1409@end table
1405@end defun 1410@end defun
1406 1411
1407When a name has been chosen, Emacs can offer own methods, which can be 1412When a name has been chosen, Emacs can offer its own methods, which
1408called by other applications. These methods could be an 1413can be called by other applications. These methods could be an
1409implementation of an interface of a well known service, like 1414implementation of an interface of a well known service, like
1410@samp{org.freedesktop.TextEditor}. 1415@samp{org.freedesktop.TextEditor}.
1411 1416
1412It could be also an implementation of an own interface. In this case, 1417They could also be an implementation of its own interface. In this
1413the service name must be @samp{org.gnu.Emacs}. The object path shall 1418case, the service name must be @samp{org.gnu.Emacs}. The object path
1414begin with @samp{/org/gnu/Emacs/@strong{Application}}, and the 1419shall begin with @samp{/org/gnu/Emacs/@var{application}}, and the
1415interface name shall be @code{org.gnu.Emacs.@strong{Application}}. 1420interface name shall be @code{org.gnu.Emacs.@var{application}}, where
1416@samp{@strong{Application}} is the name of the application which 1421@var{application} is the name of the application which provides the
1417provides the interface. 1422interface.
1418 1423
1419@deffn Constant dbus-service-emacs 1424@deffn Constant dbus-service-emacs
1420The well known service name @samp{org.gnu.Emacs} of Emacs. 1425The well known service name @samp{org.gnu.Emacs} of Emacs.
@@ -1436,10 +1441,10 @@ With this function, an application registers @var{method} on the D-Bus
1436@code{:session}. 1441@code{:session}.
1437 1442
1438@var{service} is the D-Bus service name of the D-Bus object 1443@var{service} is the D-Bus service name of the D-Bus object
1439@var{method} is registered for. It must be a known name (See 1444@var{method} is registered for. It must be a known name (see
1440discussion of @var{dont-register-service} below). 1445discussion of @var{dont-register-service} below).
1441 1446
1442@var{path} is the D-Bus object path @var{service} is registered (See 1447@var{path} is the D-Bus object path @var{service} is registered (see
1443discussion of @var{dont-register-service} below). 1448discussion of @var{dont-register-service} below).
1444 1449
1445@var{interface} is the interface offered by @var{service}. It must 1450@var{interface} is the interface offered by @var{service}. It must
@@ -1456,8 +1461,8 @@ If @var{handler} wants to return just one Lisp object and it is not a
1456cons cell, @var{handler} can return this object directly, instead of 1461cons cell, @var{handler} can return this object directly, instead of
1457returning a list containing the object. 1462returning a list containing the object.
1458 1463
1459In case @var{handler} shall return a reply message with an empty 1464If @var{handler} returns a reply message with an empty argument list,
1460argument list, @var{handler} must return the symbol @code{:ignore}. 1465@var{handler} must return the symbol @code{:ignore}.
1461 1466
1462When @var{dont-register-service} is non-@code{nil}, the known name 1467When @var{dont-register-service} is non-@code{nil}, the known name
1463@var{service} is not registered. This means that other D-Bus clients 1468@var{service} is not registered. This means that other D-Bus clients
@@ -1468,7 +1473,7 @@ clients from discovering the still incomplete interface.
1468 1473
1469The default D-Bus timeout when waiting for a message reply is 25 1474The default D-Bus timeout when waiting for a message reply is 25
1470seconds. This value could be even smaller, depending on the calling 1475seconds. This value could be even smaller, depending on the calling
1471client. Therefore, @var{handler} shall not last longer than 1476client. Therefore, @var{handler} should not last longer than
1472absolutely necessary. 1477absolutely necessary.
1473 1478
1474@code{dbus-register-method} returns a Lisp object, which can be used 1479@code{dbus-register-method} returns a Lisp object, which can be used
@@ -1477,18 +1482,14 @@ registration for @var{method}. Example:
1477 1482
1478@lisp 1483@lisp
1479(defun my-dbus-method-handler (filename) 1484(defun my-dbus-method-handler (filename)
1480 (let (result) 1485 (if (find-file filename)
1481 (if (find-file filename) 1486 '(:boolean t)
1482 (setq result '(:boolean t)) 1487 '(:boolean nil)))
1483 (setq result '(:boolean nil)))
1484 result))
1485
1486@result{} my-dbus-method-handler
1487 1488
1488(dbus-register-method 1489(dbus-register-method
1489 :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" 1490 :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
1490 "org.freedesktop.TextEditor" "OpenFile" 1491 "org.freedesktop.TextEditor" "OpenFile"
1491 'my-dbus-method-handler) 1492 #'my-dbus-method-handler)
1492 1493
1493@result{} ((:method :session "org.freedesktop.TextEditor" "OpenFile") 1494@result{} ((:method :session "org.freedesktop.TextEditor" "OpenFile")
1494 ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" 1495 ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
@@ -1496,9 +1497,9 @@ registration for @var{method}. Example:
1496@end lisp 1497@end lisp
1497 1498
1498If you invoke the method @samp{org.freedesktop.TextEditor.OpenFile} 1499If you invoke the method @samp{org.freedesktop.TextEditor.OpenFile}
1499from another D-Bus application with a filename as parameter, the file 1500from another D-Bus application with a file name as parameter, the file
1500is opened in Emacs, and the method returns either @var{true} or 1501is opened in Emacs, and the method returns either @var{true} or
1501@var{false}, indicating the success of the method. As test tool one 1502@var{false}, indicating the success of the method. As a test tool one
1502could use the command line tool @code{dbus-send} in a shell: 1503could use the command line tool @code{dbus-send} in a shell:
1503 1504
1504@example 1505@example
@@ -1522,11 +1523,9 @@ You can indicate an error by raising the Emacs signal
1522 (find-file (car args)) 1523 (find-file (car args))
1523 (error (signal 'dbus-error (cdr err)))) 1524 (error (signal 'dbus-error (cdr err))))
1524 t) 1525 t)
1525
1526@result{} my-dbus-method-handler
1527@end lisp 1526@end lisp
1528 1527
1529The test runs then 1528The test then runs
1530 1529
1531@example 1530@example
1532# dbus-send --session --print-reply \ 1531# dbus-send --session --print-reply \
@@ -1550,7 +1549,7 @@ With this function, an application declares a @var{property} on the D-Bus
1550@var{service} is the D-Bus service name of the D-Bus. It must be a 1549@var{service} is the D-Bus service name of the D-Bus. It must be a
1551known name. 1550known name.
1552 1551
1553@var{path} is the D-Bus object path @var{service} is registered (See 1552@var{path} is the D-Bus object path @var{service} is registered (see
1554discussion of @var{dont-register-service} below). 1553discussion of @var{dont-register-service} below).
1555 1554
1556@var{interface} is the name of the interface used at @var{path}, 1555@var{interface} is the name of the interface used at @var{path},
@@ -1559,7 +1558,7 @@ discussion of @var{dont-register-service} below).
1559@var{access} indicates, whether the property can be changed by other 1558@var{access} indicates, whether the property can be changed by other
1560services via D-Bus. It must be either the symbol @code{:read} or 1559services via D-Bus. It must be either the symbol @code{:read} or
1561@code{:readwrite}. @var{value} is the initial value of the property, 1560@code{:readwrite}. @var{value} is the initial value of the property,
1562it can be of any valid type (see @code{dbus-call-method} for details). 1561it can be of any valid type (@xref{dbus-call-method}, for details).
1563 1562
1564If @var{property} already exists on @var{path}, it will be 1563If @var{property} already exists on @var{path}, it will be
1565overwritten. For properties with access type @code{:read} this is the 1564overwritten. For properties with access type @code{:read} this is the
@@ -1584,15 +1583,15 @@ clients from discovering the still incomplete interface.
1584 1583
1585@lisp 1584@lisp
1586(dbus-register-property 1585(dbus-register-property
1587 :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" 1586 :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
1588 "org.freedesktop.TextEditor" "name" :read "GNU Emacs") 1587 "org.freedesktop.TextEditor" "name" :read "GNU Emacs")
1589 1588
1590@result{} ((:property :session "org.freedesktop.TextEditor" "name") 1589@result{} ((:property :session "org.freedesktop.TextEditor" "name")
1591 ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor")) 1590 ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"))
1592 1591
1593(dbus-register-property 1592(dbus-register-property
1594 :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" 1593 :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
1595 "org.freedesktop.TextEditor" "version" :readwrite emacs-version t) 1594 "org.freedesktop.TextEditor" "version" :readwrite emacs-version t)
1596 1595
1597@result{} ((:property :session "org.freedesktop.TextEditor" "version") 1596@result{} ((:property :session "org.freedesktop.TextEditor" "version")
1598 ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor")) 1597 ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"))
@@ -1623,28 +1622,28 @@ possible via the command line tool @code{dbus-send} in a shell:
1623 ] 1622 ]
1624@end example 1623@end example
1625 1624
1626It is also possible, to apply the @code{dbus-get-property}, 1625It is also possible to apply the @code{dbus-get-property},
1627@code{dbus-get-all-properties} and @code{dbus-set-property} functions 1626@code{dbus-get-all-properties} and @code{dbus-set-property} functions
1628(@pxref{Properties and Annotations}). 1627(@pxref{Properties and Annotations}).
1629 1628
1630@lisp 1629@lisp
1631(dbus-set-property 1630(dbus-set-property
1632 :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" 1631 :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
1633 "org.freedesktop.TextEditor" "version" "23.1.50") 1632 "org.freedesktop.TextEditor" "version" "23.1.50")
1634 1633
1635@result{} "23.1.50" 1634@result{} "23.1.50"
1636 1635
1637(dbus-get-property 1636(dbus-get-property
1638 :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" 1637 :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
1639 "org.freedesktop.TextEditor" "version") 1638 "org.freedesktop.TextEditor" "version")
1640 1639
1641@result{} "23.1.50" 1640@result{} "23.1.50"
1642@end lisp 1641@end lisp
1643@end defun 1642@end defun
1644 1643
1645@defun dbus-unregister-object object 1644@defun dbus-unregister-object object
1646Unregister @var{object} from the D-Bus. @var{object} must be the 1645This function unregisters @var{object} from the D-Bus. @var{object}
1647result of a preceding @code{dbus-register-method}, 1646must be the result of a preceding @code{dbus-register-method},
1648@code{dbus-register-property} or @code{dbus-register-signal} call 1647@code{dbus-register-property} or @code{dbus-register-signal} call
1649(@pxref{Signals}). It returns @code{t} if @var{object} has been 1648(@pxref{Signals}). It returns @code{t} if @var{object} has been
1650unregistered, @code{nil} otherwise. 1649unregistered, @code{nil} otherwise.
@@ -1672,22 +1671,22 @@ doesn't matter whether another object has registered for @var{signal}.
1672 1671
1673Signals can be unicast or broadcast messages. For broadcast messages, 1672Signals can be unicast or broadcast messages. For broadcast messages,
1674@var{service} must be @code{nil}. Otherwise, @var{service} is the 1673@var{service} must be @code{nil}. Otherwise, @var{service} is the
1675D-Bus service name the signal is sent to as unicast 1674D-Bus service name the signal is sent to as a unicast
1676message.@footnote{For backward compatibility, a broadcast message is 1675message.@footnote{For backward compatibility, a broadcast message is
1677also emitted if @var{service} is the known or unique name Emacs is 1676also emitted if @var{service} is the known or unique name Emacs is
1678registered at D-Bus @var{bus}.} @var{path} is the D-Bus object path 1677registered at D-Bus @var{bus}.} @var{path} is the D-Bus object path
1679@var{signal} is sent from. @var{interface} is an interface available 1678@var{signal} is sent from. @var{interface} is an interface available
1680at @var{path}. It must provide @var{signal}. 1679at @var{path}. It must provide @var{signal}.
1681 1680
1682All other arguments args are passed to @var{signal} as arguments. 1681The remaining arguments @var{args} are passed to @var{signal} as
1683They are converted into D-Bus types as described in @ref{Type 1682arguments. They are converted into D-Bus types as described in
1684Conversion}. Example: 1683@ref{Type Conversion}. Example:
1685 1684
1686@lisp 1685@lisp
1687(dbus-send-signal 1686(dbus-send-signal
1688 :session nil dbus-path-emacs 1687 :session nil dbus-path-emacs
1689 (concat dbus-interface-emacs ".FileManager") "FileModified" 1688 (concat dbus-interface-emacs ".FileManager") "FileModified"
1690 "/home/albinus/.emacs") 1689 "/home/albinus/.emacs")
1691@end lisp 1690@end lisp
1692@end defun 1691@end defun
1693 1692
@@ -1702,11 +1701,11 @@ With this function, an application registers for a signal on the D-Bus
1702object. It can be either a known name or the unique name of the D-Bus 1701object. It can be either a known name or the unique name of the D-Bus
1703object sending the signal. A known name will be mapped onto the 1702object sending the signal. A known name will be mapped onto the
1704unique name of the object, owning @var{service} at registration time. 1703unique name of the object, owning @var{service} at registration time.
1705When the corresponding D-Bus object disappears, signals won't be 1704When the corresponding D-Bus object disappears, signals will no longer
1706received any longer. 1705be received.
1707 1706
1708@var{path} is the corresponding D-Bus object path, @var{service} is 1707@var{path} is the corresponding D-Bus object path that @var{service}
1709registered at. @var{interface} is an interface offered by 1708is registered at. @var{interface} is an interface offered by
1710@var{service}. It must provide @var{signal}. 1709@var{service}. It must provide @var{signal}.
1711 1710
1712@var{service}, @var{path}, @var{interface} and @var{signal} can be 1711@var{service}, @var{path}, @var{interface} and @var{signal} can be
@@ -1721,30 +1720,31 @@ The remaining arguments @var{args} can be keywords or keyword string
1721pairs.@footnote{For backward compatibility, the arguments @var{args} 1720pairs.@footnote{For backward compatibility, the arguments @var{args}
1722can also be just strings. They stand for the respective arguments of 1721can also be just strings. They stand for the respective arguments of
1723@var{signal} in their order, and are used for filtering as well. A 1722@var{signal} in their order, and are used for filtering as well. A
1724@code{nil} argument might be used to preserve the order.} The meaning 1723@code{nil} argument might be used to preserve the order.} Their
1725is as follows: 1724meaning is as follows:
1726 1725
1727@itemize 1726@table @code
1728@item @code{:argN} @var{string}:@* 1727@item :arg@var{n} @var{string}
1729@code{:pathN} @var{string}:@* 1728@item :path@var{n} @var{string}
1730This stands for the Nth argument of the signal. @code{:pathN} 1729This stands for the @var{n}th argument of the signal.
1731arguments can be used for object path wildcard matches as specified by 1730@code{:path@var{n}} arguments can be used for object path wildcard
1732D-Bus, while an @code{:argN} argument requires an exact match. 1731matches as specified by D-Bus, while an @code{:argN} argument requires
1733 1732an exact match.
1734@item @code{:arg-namespace} @var{string}:@* 1733
1735Register for the signals, which first argument defines the service or 1734@item :arg-namespace @var{string}
1736interface namespace @var{string}. 1735Register for those signals, whose first argument names a service or
1737 1736interface within the namespace @var{string}.
1738@item @code{:path-namespace} @var{string}:@* 1737
1738@item :path-namespace @var{string}
1739Register for the object path namespace @var{string}. All signals sent 1739Register for the object path namespace @var{string}. All signals sent
1740from an object path, which has @var{string} as the preceding string, 1740from an object path, which has @var{string} as the preceding string,
1741are matched. This requires @var{path} to be @code{nil}. 1741are matched. This requires @var{path} to be @code{nil}.
1742 1742
1743@item @code{:eavesdrop}:@* 1743@item :eavesdrop
1744Register for unicast signals which are not directed to the D-Bus 1744Register for unicast signals which are not directed to the D-Bus
1745object Emacs is registered at D-Bus BUS, if the security policy of BUS 1745object Emacs is registered at D-Bus BUS, if the security policy of BUS
1746allows this. Otherwise, this argument is ignored. 1746allows this. Otherwise, this argument is ignored.
1747@end itemize 1747@end table
1748 1748
1749@code{dbus-register-signal} returns a Lisp object, which can be used 1749@code{dbus-register-signal} returns a Lisp object, which can be used
1750as argument in @code{dbus-unregister-object} for removing the 1750as argument in @code{dbus-unregister-object} for removing the
@@ -1754,12 +1754,10 @@ registration for @var{signal}. Example:
1754(defun my-dbus-signal-handler (device) 1754(defun my-dbus-signal-handler (device)
1755 (message "Device %s added" device)) 1755 (message "Device %s added" device))
1756 1756
1757@result{} my-dbus-signal-handler
1758
1759(dbus-register-signal 1757(dbus-register-signal
1760 :system "org.freedesktop.Hal" "/org/freedesktop/Hal/Manager" 1758 :system "org.freedesktop.Hal" "/org/freedesktop/Hal/Manager"
1761 "org.freedesktop.Hal.Manager" "DeviceAdded" 1759 "org.freedesktop.Hal.Manager" "DeviceAdded"
1762 'my-dbus-signal-handler) 1760 #'my-dbus-signal-handler)
1763 1761
1764@result{} ((:signal :system "org.freedesktop.Hal.Manager" "DeviceAdded") 1762@result{} ((:signal :system "org.freedesktop.Hal.Manager" "DeviceAdded")
1765 ("org.freedesktop.Hal" "/org/freedesktop/Hal/Manager" 1763 ("org.freedesktop.Hal" "/org/freedesktop/Hal/Manager"
@@ -1769,8 +1767,8 @@ registration for @var{signal}. Example:
1769As we know from the introspection data of interface 1767As we know from the introspection data of interface
1770@samp{org.freedesktop.Hal.Manager}, the signal @samp{DeviceAdded} 1768@samp{org.freedesktop.Hal.Manager}, the signal @samp{DeviceAdded}
1771provides one single parameter, which is mapped into a Lisp string. 1769provides one single parameter, which is mapped into a Lisp string.
1772The callback function @code{my-dbus-signal-handler} must define one 1770The callback function @code{my-dbus-signal-handler} must therefore
1773single string argument therefore. Plugging an USB device to your 1771define a single string argument. Plugging a USB device into your
1774machine, when registered for signal @samp{DeviceAdded}, will show you 1772machine, when registered for signal @samp{DeviceAdded}, will show you
1775which objects the GNU/Linux @code{hal} daemon adds. 1773which objects the GNU/Linux @code{hal} daemon adds.
1776 1774
@@ -1781,7 +1779,7 @@ for a dummy signal, and check the result:
1781@lisp 1779@lisp
1782(dbus-ignore-errors 1780(dbus-ignore-errors
1783 (dbus-register-signal 1781 (dbus-register-signal
1784 :system nil nil nil nil 'ignore :path-namespace "/invalid/path")) 1782 :system nil nil nil nil #'ignore :path-namespace "/invalid/path"))
1785 1783
1786@result{} nil 1784@result{} nil
1787@end lisp 1785@end lisp
@@ -1796,14 +1794,14 @@ for a dummy signal, and check the result:
1796 1794
1797Until now, we have spoken about the system and the session buses, 1795Until now, we have spoken about the system and the session buses,
1798which are the default buses to be connected to. However, it is 1796which are the default buses to be connected to. However, it is
1799possible to connect to any bus, from which the address is known. This 1797possible to connect to any bus with a known address. This is a UNIX
1800is a UNIX domain or TCP/IP socket. Everywhere, where a @var{bus} is 1798domain or TCP/IP socket. Everywhere, where a @var{bus} is mentioned
1801mentioned as argument of a function (the symbol @code{:system} or the 1799as argument of a function (the symbol @code{:system} or the symbol
1802symbol @code{:session}), this address can be used instead. The 1800@code{:session}), this address can be used instead. The connection to
1803connection to this bus must be initialized first. 1801this bus must be initialized first.
1804 1802
1805@defun dbus-init-bus bus &optional private 1803@defun dbus-init-bus bus &optional private
1806Establish the connection to D-Bus @var{bus}. 1804This function establishes the connection to D-Bus @var{bus}.
1807 1805
1808@var{bus} can be either the symbol @code{:system} or the symbol 1806@var{bus} can be either the symbol @code{:system} or the symbol
1809@code{:session}, or it can be a string denoting the address of the 1807@code{:session}, or it can be a string denoting the address of the
@@ -1811,12 +1809,12 @@ corresponding bus. For the system and session buses, this function
1811is called when loading @file{dbus.el}, there is no need to call it 1809is called when loading @file{dbus.el}, there is no need to call it
1812again. 1810again.
1813 1811
1814The function returns a number, which counts the connections this Emacs 1812The function returns the number of connections this Emacs session has
1815session has established to the @var{bus} under the same unique name 1813established to the @var{bus} under the same unique name
1816(see @code{dbus-get-unique-name}). It depends on the libraries Emacs 1814(@pxref{dbus-get-unique-name}). It depends on the libraries Emacs is
1817is linked with, and on the environment Emacs is running. For example, 1815linked with, and on the environment Emacs is running. For example, if
1818if Emacs is linked with the GTK+ toolkit, and it runs in a GTK+-aware 1816Emacs is linked with the GTK+ toolkit, and it runs in a GTK+-aware
1819environment like Gnome, another connection might already be 1817environment like GNOME, another connection might already be
1820established. 1818established.
1821 1819
1822When @var{private} is non-@code{nil}, a new connection is established 1820When @var{private} is non-@code{nil}, a new connection is established
@@ -1831,9 +1829,9 @@ Example: You initialize a connection to the AT-SPI bus on your host:
1831 1829
1832@lisp 1830@lisp
1833(setq my-bus 1831(setq my-bus
1834 (dbus-call-method 1832 (dbus-call-method
1835 :session "org.a11y.Bus" "/org/a11y/bus" 1833 :session "org.a11y.Bus" "/org/a11y/bus"
1836 "org.a11y.Bus" "GetAddress")) 1834 "org.a11y.Bus" "GetAddress"))
1837 1835
1838@result{} "unix:abstract=/tmp/dbus-2yzWHOCdSD,guid=a490dd26625870ca1298b6e10000fd7f" 1836@result{} "unix:abstract=/tmp/dbus-2yzWHOCdSD,guid=a490dd26625870ca1298b6e10000fd7f"
1839 1837
@@ -1848,7 +1846,7 @@ Example: You initialize a connection to the AT-SPI bus on your host:
1848 1846
1849@result{} ":1.19" 1847@result{} ":1.19"
1850 1848
1851;; Open a new connection to the same bus. This obsoletes the 1849;; Open a new connection to the same bus. This supersedes the
1852;; previous one. 1850;; previous one.
1853(dbus-init-bus my-bus 'private) 1851(dbus-init-bus my-bus 'private)
1854 1852
@@ -1859,14 +1857,14 @@ Example: You initialize a connection to the AT-SPI bus on your host:
1859@result{} ":1.20" 1857@result{} ":1.20"
1860@end lisp 1858@end lisp
1861 1859
1862D-Bus addresses can specify different transport. A possible address 1860D-Bus addresses can specify a different transport. A possible address
1863could be based on TCP/IP sockets, see next example. However, it 1861could be based on TCP/IP sockets, see next example. Which transport
1864depends on the bus daemon configuration, which transport is supported. 1862is supported depends on the bus daemon configuration, however.
1865@end defun 1863@end defun
1866 1864
1867@defun dbus-setenv bus variable value 1865@defun dbus-setenv bus variable value
1868Set the value of the @var{bus} environment variable @var{variable} to 1866This function sets the value of the @var{bus} environment
1869@var{value}. 1867@var{variable} to @var{value}.
1870 1868
1871@var{bus} is either a Lisp symbol, @code{:system} or @code{:session}, 1869@var{bus} is either a Lisp symbol, @code{:system} or @code{:session},
1872or a string denoting the bus address. Both @var{variable} and 1870or a string denoting the bus address. Both @var{variable} and
@@ -1877,7 +1875,7 @@ function adds to or modifies that environment when activating services.
1877 1875
1878Some bus instances, such as @code{:system}, may disable setting the 1876Some bus instances, such as @code{:system}, may disable setting the
1879environment. In such cases, or if this feature is not available in 1877environment. In such cases, or if this feature is not available in
1880older D-Bus versions, a @code{dbus-error} error is raised. 1878older D-Bus versions, this function signals a @code{dbus-error}.
1881 1879
1882As an example, it might be desirable to start X11 enabled services on 1880As an example, it might be desirable to start X11 enabled services on
1883a remote host's bus on the same X11 server the local Emacs is 1881a remote host's bus on the same X11 server the local Emacs is
@@ -1916,7 +1914,7 @@ Input parameters of @code{dbus-call-method},
1916@code{dbus-register-method}, @code{dbus-register-property} and 1914@code{dbus-register-method}, @code{dbus-register-property} and
1917@code{dbus-register-signal} are checked for correct D-Bus types. If 1915@code{dbus-register-signal} are checked for correct D-Bus types. If
1918there is a type mismatch, the Lisp error @code{wrong-type-argument} 1916there is a type mismatch, the Lisp error @code{wrong-type-argument}
1919@code{D-Bus ARG} is raised. 1917@code{D-Bus @var{arg}} is raised.
1920 1918
1921All errors raised by D-Bus are signaled with the error symbol 1919All errors raised by D-Bus are signaled with the error symbol
1922@code{dbus-error}. If possible, error messages from D-Bus are 1920@code{dbus-error}. If possible, error messages from D-Bus are
@@ -1967,35 +1965,39 @@ There exist convenience functions which could be called inside a
1967callback function in order to retrieve the information from the event. 1965callback function in order to retrieve the information from the event.
1968 1966
1969@defun dbus-event-bus-name event 1967@defun dbus-event-bus-name event
1970Returns the bus name @var{event} is coming from. 1968This function returns the bus name @var{event} is coming from. The
1971The result is either the symbol @code{:system} or the symbol @code{:session}. 1969result is either the symbol @code{:system} or the symbol
1970@code{:session}.
1972@end defun 1971@end defun
1973 1972
1974@defun dbus-event-message-type event 1973@defun dbus-event-message-type event
1975Returns the message type of the corresponding D-Bus message. The 1974This function returns the message type of the corresponding D-Bus
1976result is a natural number. 1975message. The result is a natural number.
1977@end defun 1976@end defun
1978 1977
1979@defun dbus-event-serial-number event 1978@defun dbus-event-serial-number event
1980Returns the serial number of the corresponding D-Bus message. 1979This function returns the serial number of the corresponding D-Bus
1981The result is a natural number. 1980message. The result is a natural number.
1982@end defun 1981@end defun
1983 1982
1984@defun dbus-event-service-name event 1983@defun dbus-event-service-name event
1985Returns the unique name of the D-Bus object @var{event} is coming from. 1984This function returns the unique name of the D-Bus object @var{event}
1985is coming from.
1986@end defun 1986@end defun
1987 1987
1988@defun dbus-event-path-name event 1988@defun dbus-event-path-name event
1989Returns the object path of the D-Bus object @var{event} is coming from. 1989This function returns the object path of the D-Bus object @var{event}
1990is coming from.
1990@end defun 1991@end defun
1991 1992
1992@defun dbus-event-interface-name event 1993@defun dbus-event-interface-name event
1993Returns the interface name of the D-Bus object @var{event} is coming from. 1994This function returns the interface name of the D-Bus object
1995@var{event} is coming from.
1994@end defun 1996@end defun
1995 1997
1996@defun dbus-event-member-name event 1998@defun dbus-event-member-name event
1997Returns the member name of the D-Bus object @var{event} is coming 1999This function returns the member name of the D-Bus object @var{event}
1998from. It is either a signal name or a method name. 2000is coming from. It is either a signal name or a method name.
1999@end defun 2001@end defun
2000 2002
2001D-Bus errors are not propagated during event handling, because it is 2003D-Bus errors are not propagated during event handling, because it is
@@ -2009,7 +2011,7 @@ D-Bus error happens in the event handler. Every function must accept
2009two arguments, the event and the error variable caught in 2011two arguments, the event and the error variable caught in
2010@code{condition-case} by @code{dbus-error}. 2012@code{condition-case} by @code{dbus-error}.
2011 2013
2012Such functions can be used the adapt the error signal to be raised. 2014Such functions can be used to adapt the error signal to be raised.
2013Example: 2015Example:
2014 2016
2015@lisp 2017@lisp
@@ -2019,12 +2021,12 @@ Example:
2019 (message "my-dbus-event-error-handler: %S %S" event error) 2021 (message "my-dbus-event-error-handler: %S %S" event error)
2020 (signal 'file-error (cdr error)))) 2022 (signal 'file-error (cdr error))))
2021 2023
2022(add-hook 'dbus-event-error-functions 'my-dbus-event-error-handler) 2024(add-hook 'dbus-event-error-functions #'my-dbus-event-error-handler)
2023@end lisp 2025@end lisp
2024@end defvar 2026@end defvar
2025 2027
2026Hook functions shall take into account, that there might be other 2028Hook functions should take into account that there might be other
2027D-Bus applications running. Therefore, they shall check carefully, 2029D-Bus applications running. They should therefore check carefully,
2028whether a given D-Bus error is related to them. 2030whether a given D-Bus error is related to them.
2029 2031
2030 2032
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index 4538399c751..06bd9e567fe 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -182,7 +182,7 @@ caught in `condition-case' by `dbus-error'.")
182;;; Basic D-Bus message functions. 182;;; Basic D-Bus message functions.
183 183
184(defvar dbus-return-values-table (make-hash-table :test 'equal) 184(defvar dbus-return-values-table (make-hash-table :test 'equal)
185 "Hash table for temporary storing arguments of reply messages. 185 "Hash table for temporarily storing arguments of reply messages.
186A key in this hash table is a list (:serial BUS SERIAL), like in 186A key in this hash table is a list (:serial BUS SERIAL), like in
187`dbus-registered-objects-table'. BUS is either a Lisp symbol, 187`dbus-registered-objects-table'. BUS is either a Lisp symbol,
188`:system' or `:session', or a string denoting the bus address. 188`:system' or `:session', or a string denoting the bus address.
@@ -225,10 +225,10 @@ SERVICE is the D-Bus service name to be used. PATH is the D-Bus
225object path SERVICE is registered at. INTERFACE is an interface 225object path SERVICE is registered at. INTERFACE is an interface
226offered by SERVICE. It must provide METHOD. 226offered by SERVICE. It must provide METHOD.
227 227
228If the parameter `:timeout' is given, the following integer TIMEOUT 228If the parameter `:timeout' is given, the following integer
229specifies the maximum number of milliseconds the method call must 229TIMEOUT specifies the maximum number of milliseconds before the
230return. The default value is 25,000. If the method call doesn't 230method call must return. The default value is 25,000. If the
231return in time, a D-Bus error is raised. 231method call doesn't return in time, a D-Bus error is raised.
232 232
233All other arguments ARGS are passed to METHOD as arguments. They are 233All other arguments ARGS are passed to METHOD as arguments. They are
234converted into D-Bus types via the following rules: 234converted into D-Bus types via the following rules:
@@ -248,14 +248,14 @@ Lisp objects. The type conversion happens the other direction as for
248input arguments. It follows the mapping rules: 248input arguments. It follows the mapping rules:
249 249
250 DBUS_TYPE_BOOLEAN => t or nil 250 DBUS_TYPE_BOOLEAN => t or nil
251 DBUS_TYPE_BYTE => number 251 DBUS_TYPE_BYTE => natural number
252 DBUS_TYPE_UINT16 => number 252 DBUS_TYPE_UINT16 => natural number
253 DBUS_TYPE_INT16 => integer 253 DBUS_TYPE_INT16 => integer
254 DBUS_TYPE_UINT32 => number or float 254 DBUS_TYPE_UINT32 => natural number
255 DBUS_TYPE_UNIX_FD => number or float 255 DBUS_TYPE_UNIX_FD => natural number
256 DBUS_TYPE_INT32 => integer or float 256 DBUS_TYPE_INT32 => integer
257 DBUS_TYPE_UINT64 => number or float 257 DBUS_TYPE_UINT64 => natural number
258 DBUS_TYPE_INT64 => integer or float 258 DBUS_TYPE_INT64 => integer
259 DBUS_TYPE_DOUBLE => float 259 DBUS_TYPE_DOUBLE => float
260 DBUS_TYPE_STRING => string 260 DBUS_TYPE_STRING => string
261 DBUS_TYPE_OBJECT_PATH => string 261 DBUS_TYPE_OBJECT_PATH => string
@@ -268,9 +268,9 @@ input arguments. It follows the mapping rules:
268Example: 268Example:
269 269
270\(dbus-call-method 270\(dbus-call-method
271 :session \"org.gnome.seahorse\" \"/org/gnome/seahorse/keys/openpgp\" 271 :session \"org.gnome.seahorse\" \"/org/gnome/seahorse/keys/openpgp\"
272 \"org.gnome.seahorse.Keys\" \"GetKeyField\" 272 \"org.gnome.seahorse.Keys\" \"GetKeyField\"
273 \"openpgp:657984B8C7A966DD\" \"simple-name\") 273 \"openpgp:657984B8C7A966DD\" \"simple-name\")
274 274
275 => (t (\"Philip R. Zimmermann\")) 275 => (t (\"Philip R. Zimmermann\"))
276 276
@@ -278,9 +278,9 @@ If the result of the METHOD call is just one value, the converted Lisp
278object is returned instead of a list containing this single Lisp object. 278object is returned instead of a list containing this single Lisp object.
279 279
280\(dbus-call-method 280\(dbus-call-method
281 :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/devices/computer\" 281 :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/devices/computer\"
282 \"org.freedesktop.Hal.Device\" \"GetPropertyString\" 282 \"org.freedesktop.Hal.Device\" \"GetPropertyString\"
283 \"system.kernel.machine\") 283 \"system.kernel.machine\")
284 284
285 => \"i686\"" 285 => \"i686\""
286 286
@@ -357,10 +357,10 @@ HANDLER is a Lisp function, which is called when the corresponding
357return message has arrived. If HANDLER is nil, no return message 357return message has arrived. If HANDLER is nil, no return message
358will be expected. 358will be expected.
359 359
360If the parameter `:timeout' is given, the following integer TIMEOUT 360If the parameter `:timeout' is given, the following integer
361specifies the maximum number of milliseconds the method call must 361TIMEOUT specifies the maximum number of milliseconds before the
362return. The default value is 25,000. If the method call doesn't 362method call must return. The default value is 25,000. If the
363return in time, a D-Bus error is raised. 363method call doesn't return in time, a D-Bus error is raised.
364 364
365All other arguments ARGS are passed to METHOD as arguments. They are 365All other arguments ARGS are passed to METHOD as arguments. They are
366converted into D-Bus types via the following rules: 366converted into D-Bus types via the following rules:
@@ -377,19 +377,19 @@ type symbols, see Info node `(dbus)Type Conversion'.
377 377
378If HANDLER is a Lisp function, the function returns a key into the 378If HANDLER is a Lisp function, the function returns a key into the
379hash table `dbus-registered-objects-table'. The corresponding entry 379hash table `dbus-registered-objects-table'. The corresponding entry
380in the hash table is removed, when the return message has been arrived, 380in the hash table is removed, when the return message arrives,
381and HANDLER is called. 381and HANDLER is called.
382 382
383Example: 383Example:
384 384
385\(dbus-call-method-asynchronously 385\(dbus-call-method-asynchronously
386 :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/devices/computer\" 386 :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/devices/computer\"
387 \"org.freedesktop.Hal.Device\" \"GetPropertyString\" \\='message 387 \"org.freedesktop.Hal.Device\" \"GetPropertyString\" \\='message
388 \"system.kernel.machine\") 388 \"system.kernel.machine\")
389 389
390 => (:serial :system 2) 390 -| i686
391 391
392 -| i686" 392 => (:serial :system 2)"
393 393
394 (or (featurep 'dbusbind) 394 (or (featurep 'dbusbind)
395 (signal 'dbus-error (list "Emacs not compiled with dbus support"))) 395 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
@@ -438,8 +438,8 @@ type symbols, see Info node `(dbus)Type Conversion'.
438Example: 438Example:
439 439
440\(dbus-send-signal 440\(dbus-send-signal
441 :session nil \"/org/gnu/Emacs\" \"org.gnu.Emacs.FileManager\" 441 :session nil \"/org/gnu/Emacs\" \"org.gnu.Emacs.FileManager\"
442 \"FileModified\" \"/home/albinus/.emacs\")" 442 \"FileModified\" \"/home/albinus/.emacs\")"
443 443
444 (or (featurep 'dbusbind) 444 (or (featurep 'dbusbind)
445 (signal 'dbus-error (list "Emacs not compiled with dbus support"))) 445 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
@@ -625,17 +625,17 @@ SERVICE is the D-Bus service name used by the sending D-Bus object.
625It can be either a known name or the unique name of the D-Bus object 625It can be either a known name or the unique name of the D-Bus object
626sending the signal. 626sending the signal.
627 627
628PATH is the D-Bus object path SERVICE is registered. INTERFACE 628PATH is the D-Bus object path SERVICE is registered at.
629is an interface offered by SERVICE. It must provide SIGNAL. 629INTERFACE is an interface offered by SERVICE. It must provide
630HANDLER is a Lisp function to be called when the signal is 630SIGNAL. HANDLER is a Lisp function to be called when the signal
631received. It must accept as arguments the values SIGNAL is 631is received. It must accept as arguments the values SIGNAL is
632sending. 632sending.
633 633
634SERVICE, PATH, INTERFACE and SIGNAL can be nil. This is 634SERVICE, PATH, INTERFACE and SIGNAL can be nil. This is
635interpreted as a wildcard for the respective argument. 635interpreted as a wildcard for the respective argument.
636 636
637The remaining arguments ARGS can be keywords or keyword string pairs. 637The remaining arguments ARGS can be keywords or keyword string pairs.
638The meaning is as follows: 638Their meaning is as follows:
639 639
640`:argN' STRING: 640`:argN' STRING:
641`:pathN' STRING: This stands for the Nth argument of the 641`:pathN' STRING: This stands for the Nth argument of the
@@ -643,8 +643,9 @@ signal. `:pathN' arguments can be used for object path wildcard
643matches as specified by D-Bus, while an `:argN' argument 643matches as specified by D-Bus, while an `:argN' argument
644requires an exact match. 644requires an exact match.
645 645
646`:arg-namespace' STRING: Register for the signals, which first 646`:arg-namespace' STRING: Register for those signals, whose first
647argument defines the service or interface namespace STRING. 647argument names a service or interface within the namespace
648STRING.
648 649
649`:path-namespace' STRING: Register for the object path namespace 650`:path-namespace' STRING: Register for the object path namespace
650STRING. All signals sent from an object path, which has STRING as 651STRING. All signals sent from an object path, which has STRING as
@@ -660,8 +661,8 @@ Example:
660 (message \"Device %s added\" device)) 661 (message \"Device %s added\" device))
661 662
662\(dbus-register-signal 663\(dbus-register-signal
663 :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/Manager\" 664 :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/Manager\"
664 \"org.freedesktop.Hal.Manager\" \"DeviceAdded\" \\='my-signal-handler) 665 \"org.freedesktop.Hal.Manager\" \"DeviceAdded\" \\='my-signal-handler)
665 666
666 => ((:signal :system \"org.freedesktop.Hal.Manager\" \"DeviceAdded\") 667 => ((:signal :system \"org.freedesktop.Hal.Manager\" \"DeviceAdded\")
667 (\"org.freedesktop.Hal\" \"/org/freedesktop/Hal/Manager\" my-signal-handler)) 668 (\"org.freedesktop.Hal\" \"/org/freedesktop/Hal/Manager\" my-signal-handler))
@@ -773,24 +774,24 @@ Example:
773 774
774(defun dbus-register-method 775(defun dbus-register-method
775 (bus service path interface method handler &optional dont-register-service) 776 (bus service path interface method handler &optional dont-register-service)
776 "Register for method METHOD on the D-Bus BUS. 777 "Register METHOD on the D-Bus BUS.
777 778
778BUS is either a Lisp symbol, `:system' or `:session', or a string 779BUS is either a Lisp symbol, `:system' or `:session', or a string
779denoting the bus address. 780denoting the bus address.
780 781
781SERVICE is the D-Bus service name of the D-Bus object METHOD is 782SERVICE is the D-Bus service name of the D-Bus object METHOD is
782registered for. It must be a known name (See discussion of 783registered for. It must be a known name (see discussion of
783DONT-REGISTER-SERVICE below). 784DONT-REGISTER-SERVICE below).
784 785
785PATH is the D-Bus object path SERVICE is registered (See discussion of 786PATH is the D-Bus object path SERVICE is registered at (see
786DONT-REGISTER-SERVICE below). INTERFACE is the interface offered by 787discussion of DONT-REGISTER-SERVICE below). INTERFACE is the
787SERVICE. It must provide METHOD. 788interface offered by SERVICE. It must provide METHOD.
788 789
789HANDLER is a Lisp function to be called when a method call is 790HANDLER is a Lisp function to be called when a method call is
790received. It must accept the input arguments of METHOD. The return 791received. It must accept the input arguments of METHOD. The return
791value of HANDLER is used for composing the returning D-Bus message. 792value of HANDLER is used for composing the returning D-Bus message.
792In case HANDLER shall return a reply message with an empty argument 793If HANDLER returns a reply message with an empty argument list,
793list, HANDLER must return the symbol `:ignore'. 794HANDLER must return the symbol `:ignore'.
794 795
795When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is not 796When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is not
796registered. This means that other D-Bus clients have no way of 797registered. This means that other D-Bus clients have no way of
@@ -888,8 +889,8 @@ association to the service from D-Bus."
888;;; D-Bus type conversion. 889;;; D-Bus type conversion.
889 890
890(defun dbus-string-to-byte-array (string) 891(defun dbus-string-to-byte-array (string)
891 "Transform STRING to list (:array :byte c1 :byte c2 ...). 892 "Transform STRING to list (:array :byte C1 :byte C2 ...).
892STRING shall be UTF8 coded." 893STRING shall be UTF-8 coded."
893 (if (zerop (length string)) 894 (if (zerop (length string))
894 '(:array :signature "y") 895 '(:array :signature "y")
895 (let (result) 896 (let (result)
@@ -897,7 +898,7 @@ STRING shall be UTF8 coded."
897 (setq result (append result (list :byte elt))))))) 898 (setq result (append result (list :byte elt)))))))
898 899
899(defun dbus-byte-array-to-string (byte-array &optional multibyte) 900(defun dbus-byte-array-to-string (byte-array &optional multibyte)
900 "Transform BYTE-ARRAY into UTF8 coded string. 901 "Transform BYTE-ARRAY into UTF-8 coded string.
901BYTE-ARRAY must be a list of structure (c1 c2 ...), or a byte 902BYTE-ARRAY must be a list of structure (c1 c2 ...), or a byte
902array as produced by `dbus-string-to-byte-array'. The resulting 903array as produced by `dbus-string-to-byte-array'. The resulting
903string is unibyte encoded, unless MULTIBYTE is non-nil." 904string is unibyte encoded, unless MULTIBYTE is non-nil."
@@ -920,9 +921,9 @@ lower-case hex digits:
920 921
921 \"0123abc_xyz\\x01\\xff\" -> \"_30123abc_5fxyz_01_ff\" 922 \"0123abc_xyz\\x01\\xff\" -> \"_30123abc_5fxyz_01_ff\"
922 923
923i.e. similar to URI encoding, but with \"_\" taking the role of \"%\", 924i.e. similar to URI encoding, but with \"_\" taking the role of
924and a smaller allowed set. As a special case, \"\" is escaped to 925\"%\", and a smaller allowed set. As a special case, \"\" is
925\"_\". 926escaped to \"_\".
926 927
927Returns the escaped string. Algorithm taken from 928Returns the escaped string. Algorithm taken from
928telepathy-glib's `tp_escape_as_identifier'." 929telepathy-glib's `tp_escape_as_identifier'."
@@ -963,8 +964,8 @@ the function which has been registered for this message. ARGS
963are the arguments passed to HANDLER, when it is called during 964are the arguments passed to HANDLER, when it is called during
964event handling in `dbus-handle-event'. 965event handling in `dbus-handle-event'.
965 966
966This function raises a `dbus-error' signal in case the event is 967This function signals a `dbus-error' if the event is not well
967not well formed." 968formed."
968 (when dbus-debug (message "DBus-Event %s" event)) 969 (when dbus-debug (message "DBus-Event %s" event))
969 (unless (and (listp event) 970 (unless (and (listp event)
970 (eq (car event) 'dbus-event) 971 (eq (car event) 'dbus-event)
@@ -1038,16 +1039,16 @@ If the HANDLER returns a `dbus-error', it is propagated as return message."
1038 "Return the bus name the event is coming from. 1039 "Return the bus name the event is coming from.
1039The result is either a Lisp symbol, `:system' or `:session', or a 1040The result is either a Lisp symbol, `:system' or `:session', or a
1040string denoting the bus address. EVENT is a D-Bus event, see 1041string denoting the bus address. EVENT is a D-Bus event, see
1041`dbus-check-event'. This function raises a `dbus-error' signal 1042`dbus-check-event'. This function signals a `dbus-error' if the
1042in case the event is not well formed." 1043event is not well formed."
1043 (dbus-check-event event) 1044 (dbus-check-event event)
1044 (nth 1 event)) 1045 (nth 1 event))
1045 1046
1046(defun dbus-event-message-type (event) 1047(defun dbus-event-message-type (event)
1047 "Return the message type of the corresponding D-Bus message. 1048 "Return the message type of the corresponding D-Bus message.
1048The result is a number. EVENT is a D-Bus event, see 1049The result is a number. EVENT is a D-Bus event, see
1049`dbus-check-event'. This function raises a `dbus-error' signal 1050`dbus-check-event'. This function signals a `dbus-error' if the
1050in case the event is not well formed." 1051event is not well formed."
1051 (dbus-check-event event) 1052 (dbus-check-event event)
1052 (nth 2 event)) 1053 (nth 2 event))
1053 1054
@@ -1055,41 +1056,40 @@ in case the event is not well formed."
1055 "Return the serial number of the corresponding D-Bus message. 1056 "Return the serial number of the corresponding D-Bus message.
1056The result is a number. The serial number is needed for 1057The result is a number. The serial number is needed for
1057generating a reply message. EVENT is a D-Bus event, see 1058generating a reply message. EVENT is a D-Bus event, see
1058`dbus-check-event'. This function raises a `dbus-error' signal 1059`dbus-check-event'. This function signals a `dbus-error' if the
1059in case the event is not well formed." 1060event is not well formed."
1060 (dbus-check-event event) 1061 (dbus-check-event event)
1061 (nth 3 event)) 1062 (nth 3 event))
1062 1063
1063(defun dbus-event-service-name (event) 1064(defun dbus-event-service-name (event)
1064 "Return the name of the D-Bus object the event is coming from. 1065 "Return the name of the D-Bus object the event is coming from.
1065The result is a string. EVENT is a D-Bus event, see `dbus-check-event'. 1066The result is a string. EVENT is a D-Bus event, see `dbus-check-event'.
1066This function raises a `dbus-error' signal in case the event is 1067This function signals a `dbus-error' if the event is not well
1067not well formed." 1068formed."
1068 (dbus-check-event event) 1069 (dbus-check-event event)
1069 (nth 4 event)) 1070 (nth 4 event))
1070 1071
1071(defun dbus-event-path-name (event) 1072(defun dbus-event-path-name (event)
1072 "Return the object path of the D-Bus object the event is coming from. 1073 "Return the object path of the D-Bus object the event is coming from.
1073The result is a string. EVENT is a D-Bus event, see `dbus-check-event'. 1074The result is a string. EVENT is a D-Bus event, see `dbus-check-event'.
1074This function raises a `dbus-error' signal in case the event is 1075This function signals a `dbus-error' if the event is not well
1075not well formed." 1076formed."
1076 (dbus-check-event event) 1077 (dbus-check-event event)
1077 (nth 5 event)) 1078 (nth 5 event))
1078 1079
1079(defun dbus-event-interface-name (event) 1080(defun dbus-event-interface-name (event)
1080 "Return the interface name of the D-Bus object the event is coming from. 1081 "Return the interface name of the D-Bus object the event is coming from.
1081The result is a string. EVENT is a D-Bus event, see `dbus-check-event'. 1082The result is a string. EVENT is a D-Bus event, see `dbus-check-event'.
1082This function raises a `dbus-error' signal in case the event is 1083This function signals a `dbus-error' if the event is not well
1083not well formed." 1084formed."
1084 (dbus-check-event event) 1085 (dbus-check-event event)
1085 (nth 6 event)) 1086 (nth 6 event))
1086 1087
1087(defun dbus-event-member-name (event) 1088(defun dbus-event-member-name (event)
1088 "Return the member name the event is coming from. 1089 "Return the member name the event is coming from.
1089It is either a signal name or a method name. The result is a 1090It is either a signal name or a method name. The result is a
1090string. EVENT is a D-Bus event, see `dbus-check-event'. This 1091string. EVENT is a D-Bus event, see `dbus-check-event'. This
1091function raises a `dbus-error' signal in case the event is not 1092function signals a `dbus-error' if the event is not well formed."
1092well formed."
1093 (dbus-check-event event) 1093 (dbus-check-event event)
1094 (nth 7 event)) 1094 (nth 7 event))
1095 1095
@@ -1097,10 +1097,10 @@ well formed."
1097;;; D-Bus registered names. 1097;;; D-Bus registered names.
1098 1098
1099(defun dbus-list-activatable-names (&optional bus) 1099(defun dbus-list-activatable-names (&optional bus)
1100 "Return the D-Bus service names which can be activated as list. 1100 "Return a list of the D-Bus service names which can be activated.
1101If BUS is left nil, `:system' is assumed. The result is a list 1101BUS defaults to `:system' when nil or omitted. The result is a
1102of strings, which is nil when there are no activatable service 1102list of strings, which is nil when there are no activatable
1103names at all." 1103service names at all."
1104 (dbus-ignore-errors 1104 (dbus-ignore-errors
1105 (dbus-call-method 1105 (dbus-call-method
1106 (or bus :system) dbus-service-dbus 1106 (or bus :system) dbus-service-dbus
@@ -1126,8 +1126,8 @@ A service has a known name if it doesn't start with \":\"."
1126 1126
1127(defun dbus-list-queued-owners (bus service) 1127(defun dbus-list-queued-owners (bus service)
1128 "Return the unique names registered at D-Bus BUS and queued for SERVICE. 1128 "Return the unique names registered at D-Bus BUS and queued for SERVICE.
1129The result is a list of strings, or nil when there are no 1129The result is a list of strings, or nil when there are no queued
1130queued name owners service names at all." 1130name owner service names at all."
1131 (dbus-ignore-errors 1131 (dbus-ignore-errors
1132 (dbus-call-method 1132 (dbus-call-method
1133 bus dbus-service-dbus dbus-path-dbus 1133 bus dbus-service-dbus dbus-path-dbus
@@ -1144,13 +1144,13 @@ The result is either a string, or nil if there is no name owner."
1144(defun dbus-ping (bus service &optional timeout) 1144(defun dbus-ping (bus service &optional timeout)
1145 "Check whether SERVICE is registered for D-Bus BUS. 1145 "Check whether SERVICE is registered for D-Bus BUS.
1146TIMEOUT, a nonnegative integer, specifies the maximum number of 1146TIMEOUT, a nonnegative integer, specifies the maximum number of
1147milliseconds `dbus-ping' must return. The default value is 25,000. 1147milliseconds before `dbus-ping' must return. The default value
1148is 25,000.
1148 1149
1149Note, that this autoloads SERVICE if it is not running yet. If 1150Note, that this autoloads SERVICE if it is not running yet. To
1150it shall be checked whether SERVICE is already running, one shall 1151check whether SERVICE is already running, you can instead write
1151apply
1152 1152
1153 (member service \(dbus-list-known-names bus))" 1153 (member service (dbus-list-known-names bus))"
1154 ;; "Ping" raises a D-Bus error if SERVICE does not exist. 1154 ;; "Ping" raises a D-Bus error if SERVICE does not exist.
1155 ;; Otherwise, it returns silently with nil. 1155 ;; Otherwise, it returns silently with nil.
1156 (condition-case nil 1156 (condition-case nil
@@ -1239,11 +1239,11 @@ It returns a list of strings, which are further object paths of SERVICE."
1239 "Return all interface names of SERVICE in D-Bus BUS at object path PATH. 1239 "Return all interface names of SERVICE in D-Bus BUS at object path PATH.
1240It returns a list of strings. 1240It returns a list of strings.
1241 1241
1242There will be always the default interface 1242The default interface \"org.freedesktop.DBus.Introspectable\" is
1243\"org.freedesktop.DBus.Introspectable\". Another default 1243always present. Another default interface is
1244interface is \"org.freedesktop.DBus.Properties\". If present, 1244\"org.freedesktop.DBus.Properties\". If present, \"interface\"
1245\"interface\" objects can also have \"property\" objects as 1245objects can also have \"property\" objects as children, beside
1246children, beside \"method\" and \"signal\" objects." 1246\"method\" and \"signal\" objects."
1247 (let ((object (dbus-introspect-xml bus service path)) 1247 (let ((object (dbus-introspect-xml bus service path))
1248 result) 1248 result)
1249 (dolist (elt (xml-get-children object 'interface) (nreverse result)) 1249 (dolist (elt (xml-get-children object 'interface) (nreverse result))
@@ -1251,9 +1251,10 @@ children, beside \"method\" and \"signal\" objects."
1251 1251
1252(defun dbus-introspect-get-interface (bus service path interface) 1252(defun dbus-introspect-get-interface (bus service path interface)
1253 "Return the INTERFACE of SERVICE in D-Bus BUS at object path PATH. 1253 "Return the INTERFACE of SERVICE in D-Bus BUS at object path PATH.
1254The return value is an XML object. INTERFACE must be a string, 1254The return value is an XML object. INTERFACE must be a string
1255element of the list returned by `dbus-introspect-get-interface-names'. 1255and a member of the list returned by
1256The resulting \"interface\" object can contain \"method\", \"signal\", 1256`dbus-introspect-get-interface-names'. The resulting
1257\"interface\" object can contain \"method\", \"signal\",
1257\"property\" and \"annotation\" children." 1258\"property\" and \"annotation\" children."
1258 (let ((elt (xml-get-children 1259 (let ((elt (xml-get-children
1259 (dbus-introspect-xml bus service path) 'interface))) 1260 (dbus-introspect-xml bus service path) 'interface)))
@@ -1273,9 +1274,9 @@ SERVICE is a service of D-Bus BUS at object path PATH."
1273 (push (dbus-introspect-get-attribute elt "name") result)))) 1274 (push (dbus-introspect-get-attribute elt "name") result))))
1274 1275
1275(defun dbus-introspect-get-method (bus service path interface method) 1276(defun dbus-introspect-get-method (bus service path interface method)
1276 "Return method METHOD of interface INTERFACE as XML object. 1277 "Return method METHOD of interface INTERFACE as an XML object.
1277It must be located at SERVICE in D-Bus BUS at object path PATH. 1278It must be located at SERVICE in D-Bus BUS at object path PATH.
1278METHOD must be a string, element of the list returned by 1279METHOD must be a string and a member of the list returned by
1279`dbus-introspect-get-method-names'. The resulting \"method\" 1280`dbus-introspect-get-method-names'. The resulting \"method\"
1280object can contain \"arg\" and \"annotation\" children." 1281object can contain \"arg\" and \"annotation\" children."
1281 (let ((elt (xml-get-children 1282 (let ((elt (xml-get-children
@@ -1296,7 +1297,7 @@ SERVICE is a service of D-Bus BUS at object path PATH."
1296 (push (dbus-introspect-get-attribute elt "name") result)))) 1297 (push (dbus-introspect-get-attribute elt "name") result))))
1297 1298
1298(defun dbus-introspect-get-signal (bus service path interface signal) 1299(defun dbus-introspect-get-signal (bus service path interface signal)
1299 "Return signal SIGNAL of interface INTERFACE as XML object. 1300 "Return signal SIGNAL of interface INTERFACE as an XML object.
1300It must be located at SERVICE in D-Bus BUS at object path PATH. 1301It must be located at SERVICE in D-Bus BUS at object path PATH.
1301SIGNAL must be a string, element of the list returned by 1302SIGNAL must be a string, element of the list returned by
1302`dbus-introspect-get-signal-names'. The resulting \"signal\" 1303`dbus-introspect-get-signal-names'. The resulting \"signal\"
@@ -1319,9 +1320,9 @@ SERVICE is a service of D-Bus BUS at object path PATH."
1319 (push (dbus-introspect-get-attribute elt "name") result)))) 1320 (push (dbus-introspect-get-attribute elt "name") result))))
1320 1321
1321(defun dbus-introspect-get-property (bus service path interface property) 1322(defun dbus-introspect-get-property (bus service path interface property)
1322 "Return PROPERTY of INTERFACE as XML object. 1323 "Return PROPERTY of INTERFACE as an XML object.
1323It must be located at SERVICE in D-Bus BUS at object path PATH. 1324It must be located at SERVICE in D-Bus BUS at object path PATH.
1324PROPERTY must be a string, element of the list returned by 1325PROPERTY must be a string and a member of the list returned by
1325`dbus-introspect-get-property-names'. The resulting PROPERTY 1326`dbus-introspect-get-property-names'. The resulting PROPERTY
1326object can contain \"annotation\" children." 1327object can contain \"annotation\" children."
1327 (let ((elt (xml-get-children 1328 (let ((elt (xml-get-children
@@ -1336,7 +1337,7 @@ object can contain \"annotation\" children."
1336 1337
1337(defun dbus-introspect-get-annotation-names 1338(defun dbus-introspect-get-annotation-names
1338 (bus service path interface &optional name) 1339 (bus service path interface &optional name)
1339 "Return all annotation names as list of strings. 1340 "Return all annotation names as a list of strings.
1340If NAME is nil, the annotations are children of INTERFACE, 1341If NAME is nil, the annotations are children of INTERFACE,
1341otherwise NAME must be a \"method\", \"signal\", or \"property\" 1342otherwise NAME must be a \"method\", \"signal\", or \"property\"
1342object, where the annotations belong to." 1343object, where the annotations belong to."
@@ -1352,7 +1353,7 @@ object, where the annotations belong to."
1352 1353
1353(defun dbus-introspect-get-annotation 1354(defun dbus-introspect-get-annotation
1354 (bus service path interface name annotation) 1355 (bus service path interface name annotation)
1355 "Return ANNOTATION as XML object. 1356 "Return ANNOTATION as an XML object.
1356If NAME is nil, ANNOTATION is a child of INTERFACE, otherwise 1357If NAME is nil, ANNOTATION is a child of INTERFACE, otherwise
1357NAME must be the name of a \"method\", \"signal\", or 1358NAME must be the name of a \"method\", \"signal\", or
1358\"property\" object, where the ANNOTATION belongs to." 1359\"property\" object, where the ANNOTATION belongs to."
@@ -1374,7 +1375,7 @@ NAME must be the name of a \"method\", \"signal\", or
1374 (car elt))) 1375 (car elt)))
1375 1376
1376(defun dbus-introspect-get-argument-names (bus service path interface name) 1377(defun dbus-introspect-get-argument-names (bus service path interface name)
1377 "Return a list of all argument names as list of strings. 1378 "Return a list of all argument names as a list of strings.
1378NAME must be a \"method\" or \"signal\" object. 1379NAME must be a \"method\" or \"signal\" object.
1379 1380
1380Argument names are optional, the function can return nil 1381Argument names are optional, the function can return nil
@@ -1388,8 +1389,9 @@ therefore, even if the method or signal has arguments."
1388 1389
1389(defun dbus-introspect-get-argument (bus service path interface name arg) 1390(defun dbus-introspect-get-argument (bus service path interface name arg)
1390 "Return argument ARG as XML object. 1391 "Return argument ARG as XML object.
1391NAME must be a \"method\" or \"signal\" object. ARG must be a string, 1392NAME must be a \"method\" or \"signal\" object. ARG must be a
1392element of the list returned by `dbus-introspect-get-argument-names'." 1393string and a member of the list returned by
1394`dbus-introspect-get-argument-names'."
1393 (let ((elt (xml-get-children 1395 (let ((elt (xml-get-children
1394 (or (dbus-introspect-get-method bus service path interface name) 1396 (or (dbus-introspect-get-method bus service path interface name)
1395 (dbus-introspect-get-signal bus service path interface name)) 1397 (dbus-introspect-get-signal bus service path interface name))
@@ -1402,7 +1404,7 @@ element of the list returned by `dbus-introspect-get-argument-names'."
1402 1404
1403(defun dbus-introspect-get-signature 1405(defun dbus-introspect-get-signature
1404 (bus service path interface name &optional direction) 1406 (bus service path interface name &optional direction)
1405 "Return signature of a `method' or `signal', represented by NAME, as string. 1407 "Return signature of a `method' or `signal' represented by NAME as a string.
1406If NAME is a `method', DIRECTION can be either \"in\" or \"out\". 1408If NAME is a `method', DIRECTION can be either \"in\" or \"out\".
1407If DIRECTION is nil, \"in\" is assumed. 1409If DIRECTION is nil, \"in\" is assumed.
1408 1410
@@ -1450,9 +1452,8 @@ valid D-Bus value, or nil if there is no PROPERTY."
1450 1452
1451(defun dbus-set-property (bus service path interface property value) 1453(defun dbus-set-property (bus service path interface property value)
1452 "Set value of PROPERTY of INTERFACE to VALUE. 1454 "Set value of PROPERTY of INTERFACE to VALUE.
1453It will be checked at BUS, SERVICE, PATH. When the value has 1455It will be checked at BUS, SERVICE, PATH. When the value is
1454been set successful, the result is VALUE. Otherwise, nil is 1456successfully set return VALUE. Otherwise, return nil."
1455returned."
1456 (dbus-ignore-errors 1457 (dbus-ignore-errors
1457 ;; "Set" requires a variant. 1458 ;; "Set" requires a variant.
1458 (dbus-call-method 1459 (dbus-call-method
@@ -1479,15 +1480,15 @@ nil is returned."
1479(defun dbus-register-property 1480(defun dbus-register-property
1480 (bus service path interface property access value 1481 (bus service path interface property access value
1481 &optional emits-signal dont-register-service) 1482 &optional emits-signal dont-register-service)
1482 "Register property PROPERTY on the D-Bus BUS. 1483 "Register PROPERTY on the D-Bus BUS.
1483 1484
1484BUS is either a Lisp symbol, `:system' or `:session', or a string 1485BUS is either a Lisp symbol, `:system' or `:session', or a string
1485denoting the bus address. 1486denoting the bus address.
1486 1487
1487SERVICE is the D-Bus service name of the D-Bus. It must be a 1488SERVICE is the D-Bus service name of the D-Bus. It must be a
1488known name (See discussion of DONT-REGISTER-SERVICE below). 1489known name (see discussion of DONT-REGISTER-SERVICE below).
1489 1490
1490PATH is the D-Bus object path SERVICE is registered (See 1491PATH is the D-Bus object path SERVICE is registered at (see
1491discussion of DONT-REGISTER-SERVICE below). INTERFACE is the 1492discussion of DONT-REGISTER-SERVICE below). INTERFACE is the
1492name of the interface used at PATH, PROPERTY is the name of the 1493name of the interface used at PATH, PROPERTY is the name of the
1493property of INTERFACE. ACCESS indicates, whether the property 1494property of INTERFACE. ACCESS indicates, whether the property
@@ -1625,8 +1626,8 @@ It will be registered for all objects created by `dbus-register-property'."
1625 "Return all objects at BUS, SERVICE, PATH, and the children of PATH. 1626 "Return all objects at BUS, SERVICE, PATH, and the children of PATH.
1626The result is a list of objects. Every object is a cons of an 1627The result is a list of objects. Every object is a cons of an
1627existing path name, and the list of available interface objects. 1628existing path name, and the list of available interface objects.
1628An interface object is another cons, which car is the interface 1629An interface object is another cons, whose car is the interface
1629name, and the cdr is the list of properties as returned by 1630name and cdr is the list of properties as returned by
1630`dbus-get-all-properties' for that path and interface. Example: 1631`dbus-get-all-properties' for that path and interface. Example:
1631 1632
1632\(dbus-get-all-managed-objects :session \"org.gnome.SettingsDaemon\" \"/\") 1633\(dbus-get-all-managed-objects :session \"org.gnome.SettingsDaemon\" \"/\")
@@ -1782,12 +1783,13 @@ can be a string denoting the address of the corresponding bus. For
1782the system and session buses, this function is called when loading 1783the system and session buses, this function is called when loading
1783`dbus.el', there is no need to call it again. 1784`dbus.el', there is no need to call it again.
1784 1785
1785The function returns a number, which counts the connections this Emacs 1786The function returns the number of connections this Emacs session
1786session has established to the BUS under the same unique name (see 1787has established to the BUS under the same unique name (see
1787`dbus-get-unique-name'). It depends on the libraries Emacs is linked 1788`dbus-get-unique-name'). It depends on the libraries Emacs is
1788with, and on the environment Emacs is running. For example, if Emacs 1789linked with, and on the environment Emacs is running. For
1789is linked with the gtk toolkit, and it runs in a GTK-aware environment 1790example, if Emacs is linked with the GTK+ toolkit, and it runs in
1790like Gnome, another connection might already be established. 1791a GTK+-aware environment like GNOME, another connection might
1792already be established.
1791 1793
1792When PRIVATE is non-nil, a new connection is established instead of 1794When PRIVATE is non-nil, a new connection is established instead of
1793reusing an existing one. It results in a new unique name at the bus. 1795reusing an existing one. It results in a new unique name at the bus.