]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/dbus.el (dbus-interface-peer): New defconst.
authorMichael Albinus <michael.albinus@gmx.de>
Wed, 6 Feb 2008 20:54:19 +0000 (20:54 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Wed, 6 Feb 2008 20:54:19 +0000 (20:54 +0000)
(dbus-ping): New defun.

lisp/net/dbus.el

index 6ecd0065606748262698f0a6d8907872599501be..4390f305b663884e1c6a2b30603e6254864947f2 100644 (file)
 (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,15 @@ The result is either a string, or nil if there is no name owner."
      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 with `nil'.
+  (condition-case nil
+      (not
+       (dbus-call-method bus service dbus-path-dbus dbus-interface-peer "Ping"))
+    (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.