Function: dbus-check-event
dbus-check-event is a byte-compiled function defined in dbus.el.gz.
Signature
(dbus-check-event EVENT)
Documentation
Check whether EVENT is a well formed D-Bus event.
EVENT is a list which starts with symbol dbus-event:
(dbus-event BUS TYPE SERIAL SERVICE DESTINATION PATH
INTERFACE MEMBER HANDLER &rest ARGS)
BUS identifies the D-Bus the message is coming from. It is either a Lisp keyword, :system, :session, :systemp-private or :session-private, or a string denoting the bus address.
TYPE is the D-Bus message type which has caused the event, SERIAL
is the serial number of the received D-Bus message when TYPE is
equal dbus-message-type-method-return or dbus-message-type-error.
SERVICE and PATH are the unique name and the object path of the D-Bus object emitting the message. DESTINATION is the D-Bus name the message is dedicated to, or nil in case the message is a broadcast signal.
INTERFACE and MEMBER denote the message which has been sent.
When TYPE is dbus-message-type-error, MEMBER is the error name.
HANDLER is the function which has been registered for this message. It can also be a cons cell (HANDLER . ERROR-HANDLER).
ARGS are the typed arguments as returned from the message. They are
passed to HANDLER without type information, when it is called during
event handling in dbus-handle-event.
This function signals a dbus-error if the event is not well
formed.
Source Code
;; Defined in /usr/src/emacs/lisp/net/dbus.el.gz
;;; D-Bus events.
(defun dbus-check-event (event)
"Check whether EVENT is a well formed D-Bus event.
EVENT is a list which starts with symbol `dbus-event':
(dbus-event BUS TYPE SERIAL SERVICE DESTINATION PATH
INTERFACE MEMBER HANDLER &rest ARGS)
BUS identifies the D-Bus the message is coming from. It is
either a Lisp keyword, `:system', `:session', `:systemp-private'
or `:session-private', or a string denoting the bus address.
TYPE is the D-Bus message type which has caused the event, SERIAL
is the serial number of the received D-Bus message when TYPE is
equal `dbus-message-type-method-return' or `dbus-message-type-error'.
SERVICE and PATH are the unique name and the object path of the
D-Bus object emitting the message. DESTINATION is the D-Bus name
the message is dedicated to, or nil in case the message is a
broadcast signal.
INTERFACE and MEMBER denote the message which has been sent.
When TYPE is `dbus-message-type-error', MEMBER is the error name.
HANDLER is the function which has been registered for this
message. It can also be a cons cell (HANDLER . ERROR-HANDLER).
ARGS are the typed arguments as returned from the message. They are
passed to HANDLER without type information, when it is called during
event handling in `dbus-handle-event'.
This function signals a `dbus-error' if the event is not well
formed."
(when dbus-debug (message "DBus-Event %s" event))
(unless (and (listp event)
(eq (car event) 'dbus-event)
;; Bus keyword.
(or (keywordp (nth 1 event))
(stringp (nth 1 event)))
;; Type.
(and (natnump (nth 2 event))
(< dbus-message-type-invalid (nth 2 event)))
;; Serial.
(natnump (nth 3 event))
;; Service.
(or (= dbus-message-type-method-return (nth 2 event))
(= dbus-message-type-error (nth 2 event))
(or (stringp (nth 4 event))
(null (nth 4 event))))
;; Destination.
(or (= dbus-message-type-method-return (nth 2 event))
(= dbus-message-type-error (nth 2 event))
(or (stringp (nth 5 event))
(null (nth 5 event))))
;; Object path.
(or (= dbus-message-type-method-return (nth 2 event))
(= dbus-message-type-error (nth 2 event))
(stringp (nth 6 event)))
;; Interface.
(or (= dbus-message-type-method-return (nth 2 event))
(= dbus-message-type-error (nth 2 event))
(stringp (nth 7 event)))
;; Member.
(or (= dbus-message-type-method-return (nth 2 event))
(stringp (nth 8 event)))
;; Handler.
(or (functionp (nth 9 event))
(and (consp (nth 9 event))
(functionp (car (nth 9 event)))
(functionp (cdr (nth 9 event)))))
;; Arguments.
(listp (nthcdr 10 event)))
(signal 'dbus-error (list "Not a valid D-Bus event" event))))