Mercurial > emacs
comparison lisp/net/dbus.el @ 91588:83afe69ce25e
* net/dbus.el (dbus-interface-peer): New defconst.
(dbus-ping): New defun.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Wed, 06 Feb 2008 20:49:35 +0000 |
parents | 7ddf7059d131 |
children | 12b2f1526656 |
comparison
equal
deleted
inserted
replaced
91587:46cbed0b179b | 91588:83afe69ce25e |
---|---|
45 "The object path used to talk to the bus itself.") | 45 "The object path used to talk to the bus itself.") |
46 | 46 |
47 (defconst dbus-interface-dbus "org.freedesktop.DBus" | 47 (defconst dbus-interface-dbus "org.freedesktop.DBus" |
48 "The interface exported by the object with `dbus-service-dbus' and `dbus-path-dbus'.") | 48 "The interface exported by the object with `dbus-service-dbus' and `dbus-path-dbus'.") |
49 | 49 |
50 (defconst dbus-interface-introspectable "org.freedesktop.DBus.Introspectable" | 50 (defconst dbus-interface-peer (concat dbus-interface-dbus ".Peer") |
51 "The interface for peer objects.") | |
52 | |
53 (defconst dbus-interface-introspectable | |
54 (concat dbus-interface-dbus ".Introspectable") | |
51 "The interface supported by introspectable objects.") | 55 "The interface supported by introspectable objects.") |
52 | 56 |
53 (defmacro dbus-ignore-errors (&rest body) | 57 (defmacro dbus-ignore-errors (&rest body) |
54 "Execute BODY; signal D-Bus error when `dbus-debug' is non-nil. | 58 "Execute BODY; signal D-Bus error when `dbus-debug' is non-nil. |
55 Otherwise, return result of last form in BODY, or all other errors." | 59 Otherwise, return result of last form in BODY, or all other errors." |
317 (dbus-ignore-errors | 321 (dbus-ignore-errors |
318 (dbus-call-method | 322 (dbus-call-method |
319 bus dbus-service-dbus dbus-path-dbus | 323 bus dbus-service-dbus dbus-path-dbus |
320 dbus-interface-dbus "GetNameOwner" service))) | 324 dbus-interface-dbus "GetNameOwner" service))) |
321 | 325 |
326 (defun dbus-ping (bus service) | |
327 "Check whether SERVICE is registered for D-Bus BUS." | |
328 ;; "Ping" raises a D-Bus error if SERVICE does not exist. | |
329 ;; Otherwise, it returns silently. | |
330 (condition-case nil | |
331 (progn | |
332 (dbus-call-method bus service dbus-path-dbus dbus-interface-peer "Ping") | |
333 t) | |
334 (dbus-error nil))) | |
335 | |
322 (defun dbus-introspect (bus service path) | 336 (defun dbus-introspect (bus service path) |
323 "Return the introspection data of SERVICE in D-Bus BUS at object path PATH. | 337 "Return the introspection data of SERVICE in D-Bus BUS at object path PATH. |
324 The data are in XML format. | 338 The data are in XML format. |
325 | 339 |
326 Example: | 340 Example: |