diff options
| -rw-r--r-- | doc/misc/ChangeLog | 8 | ||||
| -rw-r--r-- | doc/misc/dbus.texi | 97 |
2 files changed, 94 insertions, 11 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 1865af25760..913aee36493 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2008-07-31 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * dbus.texi (Arguments and Signatures): Fix example. | ||
| 4 | (Synchronous Methods): New defun `dbus-call-method-non-blocking'. | ||
| 5 | (Asynchronous Methods): New node. | ||
| 6 | (Errors and Events): Describe extended layout of `dbus-event'. New | ||
| 7 | defun `dbus-event-message-type'. | ||
| 8 | |||
| 1 | 2008-07-31 Dan Nicolaescu <dann@ics.uci.edu> | 9 | 2008-07-31 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 10 | ||
| 3 | * ediff.texi: Remove VMS support. | 11 | * ediff.texi: Remove VMS support. |
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index 32eb32da719..0b761cef6da 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi | |||
| @@ -45,6 +45,7 @@ be found at @uref{http://dbus.freedesktop.org/}. | |||
| 45 | * Inspection:: Inspection of D-Bus services. | 45 | * Inspection:: Inspection of D-Bus services. |
| 46 | * Type Conversion:: Mapping Lisp types and D-Bus types. | 46 | * Type Conversion:: Mapping Lisp types and D-Bus types. |
| 47 | * Synchronous Methods:: Calling methods in a blocking way. | 47 | * Synchronous Methods:: Calling methods in a blocking way. |
| 48 | * Asynchronous Methods:: Calling methods non-blocking. | ||
| 48 | * Receiving Method Calls:: Offering own methods. | 49 | * Receiving Method Calls:: Offering own methods. |
| 49 | * Signals:: Sending and receiving signals. | 50 | * Signals:: Sending and receiving signals. |
| 50 | * Errors and Events:: Errors and events. | 51 | * Errors and Events:: Errors and events. |
| @@ -825,7 +826,7 @@ non-@code{nil}, @var{direction} must be @samp{out}. Example: | |||
| 825 | "/org/freedesktop/xesam/searcher/main" | 826 | "/org/freedesktop/xesam/searcher/main" |
| 826 | "org.freedesktop.xesam.Search" "HitsAdded") | 827 | "org.freedesktop.xesam.Search" "HitsAdded") |
| 827 | 828 | ||
| 828 | @result{} \"su\"" | 829 | @result{} "su" |
| 829 | @end lisp | 830 | @end lisp |
| 830 | @end defun | 831 | @end defun |
| 831 | 832 | ||
| @@ -997,8 +998,7 @@ The signal @code{PropertyModified}, discussed as example in | |||
| 997 | @cindex synchronous method calls | 998 | @cindex synchronous method calls |
| 998 | 999 | ||
| 999 | Methods can be called synchronously (@dfn{blocking}) or asynchronously | 1000 | Methods can be called synchronously (@dfn{blocking}) or asynchronously |
| 1000 | (@dfn{non-blocking}). Currently, just synchronous methods are | 1001 | (@dfn{non-blocking}). |
| 1001 | implemented. | ||
| 1002 | 1002 | ||
| 1003 | At D-Bus level, a method call consist of two messages: one message | 1003 | At D-Bus level, a method call consist of two messages: one message |
| 1004 | which carries the input parameters to the object owning the method to | 1004 | which carries the input parameters to the object owning the method to |
| @@ -1014,7 +1014,7 @@ D-Bus object path, @var{service} is registered at. @var{interface} is | |||
| 1014 | an interface offered by @var{service}. It must provide @var{method}. | 1014 | an interface offered by @var{service}. It must provide @var{method}. |
| 1015 | 1015 | ||
| 1016 | If the parameter @code{:timeout} is given, the following integer | 1016 | If the parameter @code{:timeout} is given, the following integer |
| 1017 | @var{timeout} specifies the maximun number of milliseconds the method | 1017 | @var{timeout} specifies the maximum number of milliseconds the method |
| 1018 | call must return. The default value is 25.000. If the method call | 1018 | call must return. The default value is 25.000. If the method call |
| 1019 | doesn't return in time, a D-Bus error is raised (@pxref{Errors and | 1019 | doesn't return in time, a D-Bus error is raised (@pxref{Errors and |
| 1020 | Events}). | 1020 | Events}). |
| @@ -1092,6 +1092,70 @@ emulate the @code{lshal} command on GNU/Linux systems: | |||
| 1092 | @end lisp | 1092 | @end lisp |
| 1093 | @end defun | 1093 | @end defun |
| 1094 | 1094 | ||
| 1095 | @defun dbus-call-method-non-blocking bus service path interface method &optional :timeout timeout &rest args | ||
| 1096 | Call @var{method} on the D-Bus @var{bus}, but don't block the event queue. | ||
| 1097 | This is necessary for communicating to registered D-Bus methods, | ||
| 1098 | which are running in the same Emacs process. | ||
| 1099 | |||
| 1100 | The arguments are the same as in @code{dbus-call-method}. Example: | ||
| 1101 | |||
| 1102 | @lisp | ||
| 1103 | (dbus-call-method-non-blocking | ||
| 1104 | :system "org.freedesktop.Hal" | ||
| 1105 | "/org/freedesktop/Hal/devices/computer" | ||
| 1106 | "org.freedesktop.Hal.Device" "GetPropertyString" | ||
| 1107 | "system.kernel.machine") | ||
| 1108 | |||
| 1109 | @result{} "i686" | ||
| 1110 | @end lisp | ||
| 1111 | @end defun | ||
| 1112 | |||
| 1113 | |||
| 1114 | @node Asynchronous Methods | ||
| 1115 | @chapter Calling methods non-blocking. | ||
| 1116 | @cindex method calls, asynchronous | ||
| 1117 | @cindex asynchronous method calls | ||
| 1118 | |||
| 1119 | @defun dbus-call-method-asynchronously bus service path interface method handler &optional :timeout timeout &rest args | ||
| 1120 | This function calls @var{method} on the D-Bus @var{bus} | ||
| 1121 | asynchronously. @var{bus} is either the symbol @code{:system} or the | ||
| 1122 | symbol @code{:session}. | ||
| 1123 | |||
| 1124 | @var{service} is the D-Bus service name to be used. @var{path} is the | ||
| 1125 | D-Bus object path, @var{service} is registered at. @var{interface} is | ||
| 1126 | an interface offered by @var{service}. It must provide @var{method}. | ||
| 1127 | |||
| 1128 | @var{handler} is a Lisp function, which is called when the | ||
| 1129 | corresponding return message has arrived. | ||
| 1130 | |||
| 1131 | If the parameter @code{:timeout} is given, the following integer | ||
| 1132 | @var{timeout} specifies the maximum number of milliseconds a reply | ||
| 1133 | message must arrive. The default value is 25.000. If there is no | ||
| 1134 | reply message in time, a D-Bus error is raised (@pxref{Errors and | ||
| 1135 | Events}). | ||
| 1136 | |||
| 1137 | All other arguments args are passed to @var{method} as arguments. | ||
| 1138 | They are converted into D-Bus types as described in @ref{Type | ||
| 1139 | Conversion}. | ||
| 1140 | |||
| 1141 | The function returns a key into the hash table | ||
| 1142 | @code{dbus-registered-functions-table}. The corresponding entry in | ||
| 1143 | the hash table is removed, when the return message has been arrived, | ||
| 1144 | and @var{handler} is called. Example: | ||
| 1145 | |||
| 1146 | @lisp | ||
| 1147 | (dbus-call-method-asynchronously | ||
| 1148 | :system "org.freedesktop.Hal" | ||
| 1149 | "/org/freedesktop/Hal/devices/computer" | ||
| 1150 | "org.freedesktop.Hal.Device" "GetPropertyString" 'message | ||
| 1151 | "system.kernel.machine") | ||
| 1152 | |||
| 1153 | @result{} (:system 2) | ||
| 1154 | |||
| 1155 | @print{} i686 | ||
| 1156 | @end lisp | ||
| 1157 | @end defun | ||
| 1158 | |||
| 1095 | 1159 | ||
| 1096 | @node Receiving Method Calls | 1160 | @node Receiving Method Calls |
| 1097 | @chapter Offering own methods. | 1161 | @chapter Offering own methods. |
| @@ -1283,7 +1347,9 @@ has been unregistered, @code{nil} otherwise. | |||
| 1283 | @cindex errors | 1347 | @cindex errors |
| 1284 | @cindex events | 1348 | @cindex events |
| 1285 | 1349 | ||
| 1286 | Input parameters of @code{dbus-call-method} and | 1350 | Input parameters of @code{dbus-call-method}, |
| 1351 | @code{dbus-call-method-non-blocking}, | ||
| 1352 | @code{dbus-call-method-asynchronously}, and | ||
| 1287 | @code{dbus-register-signal} are checked for correct D-Bus types. If | 1353 | @code{dbus-register-signal} are checked for correct D-Bus types. If |
| 1288 | there is a type mismatch, the Lisp error @code{wrong-type-argument} | 1354 | there is a type mismatch, the Lisp error @code{wrong-type-argument} |
| 1289 | @code{D-Bus ARG} is raised. | 1355 | @code{D-Bus ARG} is raised. |
| @@ -1303,14 +1369,19 @@ Incoming D-Bus messages are handled as Emacs events (see @pxref{Misc | |||
| 1303 | Events, , , elisp}). The generated event has this form: | 1369 | Events, , , elisp}). The generated event has this form: |
| 1304 | 1370 | ||
| 1305 | @lisp | 1371 | @lisp |
| 1306 | (dbus-event @var{bus} @var{serial} @var{service} @var{path} @var{interface} @var{member} @var{handler} &rest @var{args}) | 1372 | (dbus-event @var{bus} @var{type} @var{serial} @var{service} @var{path} @var{interface} @var{member} @var{handler} |
| 1373 | &rest @var{args}) | ||
| 1307 | @end lisp | 1374 | @end lisp |
| 1308 | 1375 | ||
| 1309 | @var{bus} identifies the D-Bus the signal is coming from. It is | 1376 | @var{bus} identifies the D-Bus the message is coming from. It is |
| 1310 | either the symbol @code{:system} or the symbol @code{:session}. | 1377 | either the symbol @code{:system} or the symbol @code{:session}. |
| 1311 | 1378 | ||
| 1312 | @var{serial} is the serial number of the received D-Bus message if it | 1379 | @var{type} is the D-Bus message type which has caused the event. It |
| 1313 | is a method call, or @code{nil}. | 1380 | can be @code{dbus-message-type-invalid}, |
| 1381 | @code{dbus-message-type-method-call}, | ||
| 1382 | @code{dbus-message-type-method-return}, | ||
| 1383 | @code{dbus-message-type-error}, or @code{dbus-message-type-signal}. | ||
| 1384 | @var{serial} is the serial number of the received D-Bus message. | ||
| 1314 | 1385 | ||
| 1315 | @var{service} and @var{path} are the unique name and the object path | 1386 | @var{service} and @var{path} are the unique name and the object path |
| 1316 | of the D-Bus object emitting the message. @var{interface} and | 1387 | of the D-Bus object emitting the message. @var{interface} and |
| @@ -1336,10 +1407,14 @@ Returns the bus name @var{event} is coming from. | |||
| 1336 | The result is either the symbol @code{:system} or the symbol @code{:session}. | 1407 | The result is either the symbol @code{:system} or the symbol @code{:session}. |
| 1337 | @end defun | 1408 | @end defun |
| 1338 | 1409 | ||
| 1410 | @defun dbus-event-message-type event | ||
| 1411 | Returns the message type of the corresponding D-Bus message. The | ||
| 1412 | result is a number. | ||
| 1413 | @end defun | ||
| 1414 | |||
| 1339 | @defun dbus-event-serial-number event | 1415 | @defun dbus-event-serial-number event |
| 1340 | Returns the serial number of the corresponding D-Bus message. | 1416 | Returns the serial number of the corresponding D-Bus message. |
| 1341 | The result is a number in case the D-Bus message is a method | 1417 | The result is a number. |
| 1342 | call, or @code{nil} for all other mesage types. | ||
| 1343 | @end defun | 1418 | @end defun |
| 1344 | 1419 | ||
| 1345 | @defun dbus-event-service-name event | 1420 | @defun dbus-event-service-name event |