changeset 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 46cbed0b179b
children 12b2f1526656
files lisp/net/dbus.el
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/dbus.el	Wed Feb 06 20:34:23 2008 +0000
+++ b/lisp/net/dbus.el	Wed Feb 06 20:49:35 2008 +0000
@@ -47,7 +47,11 @@
 (defconst dbus-interface-dbus "org.freedesktop.DBus"
   "The interface exported by the object with `dbus-service-dbus' and `dbus-path-dbus'.")
 
-(defconst dbus-interface-introspectable "org.freedesktop.DBus.Introspectable"
+(defconst dbus-interface-peer (concat dbus-interface-dbus ".Peer")
+  "The interface for peer objects.")
+
+(defconst dbus-interface-introspectable
+  (concat dbus-interface-dbus ".Introspectable")
   "The interface supported by introspectable objects.")
 
 (defmacro dbus-ignore-errors (&rest body)
@@ -319,6 +323,16 @@
      bus dbus-service-dbus dbus-path-dbus
      dbus-interface-dbus "GetNameOwner" service)))
 
+(defun dbus-ping (bus service)
+  "Check whether SERVICE is registered for D-Bus BUS."
+  ;; "Ping" raises a D-Bus error if SERVICE does not exist.
+  ;; Otherwise, it returns silently.
+  (condition-case nil
+      (progn
+	(dbus-call-method bus service dbus-path-dbus dbus-interface-peer "Ping")
+	t)
+    (dbus-error nil)))
+
 (defun dbus-introspect (bus service path)
   "Return the introspection data of SERVICE in D-Bus BUS at object path PATH.
 The data are in XML format.