diff options
| author | Michael Albinus | 2009-11-13 16:19:19 +0000 |
|---|---|---|
| committer | Michael Albinus | 2009-11-13 16:19:19 +0000 |
| commit | 0ecd3c90f7cca12152c02e09d836507ee648cfbd (patch) | |
| tree | 98b0f9517b0b6651ac7b2db4837179d7701c74d9 | |
| parent | f04bb9b2d81242760c3faf2db2f9351ce0707d92 (diff) | |
| download | emacs-0ecd3c90f7cca12152c02e09d836507ee648cfbd.tar.gz emacs-0ecd3c90f7cca12152c02e09d836507ee648cfbd.zip | |
* dbus.texi (Type Conversion): Fix typo.
(Asynchronous Methods): Rename `dbus-registered-functions-table' to
`dbus-registered-objects-table'.
(Receiving Method Calls): New defun `dbus-register-property'. Move
`dbus-unregister-object' here.
| -rw-r--r-- | doc/misc/ChangeLog | 8 | ||||
| -rw-r--r-- | doc/misc/dbus.texi | 115 |
2 files changed, 113 insertions, 10 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index a50cd36d4c0..87cf5739f25 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2009-11-13 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * dbus.texi (Type Conversion): Fix typo. | ||
| 4 | (Asynchronous Methods): Rename `dbus-registered-functions-table' to | ||
| 5 | `dbus-registered-objects-table'. | ||
| 6 | (Receiving Method Calls): New defun `dbus-register-property'. Move | ||
| 7 | `dbus-unregister-object' here. | ||
| 8 | |||
| 1 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> | 9 | 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com> |
| 2 | 10 | ||
| 3 | * org.texi: Removed @Ie, @ie, @Eg, @eg macros. | 11 | * org.texi: Removed @Ie, @ie, @Eg, @eg macros. |
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index 3e9d368a752..b4dc42ec3ef 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi | |||
| @@ -950,7 +950,7 @@ elements of this array. Example: | |||
| 950 | '(:array) ;; No actions (empty array of strings). | 950 | '(:array) ;; No actions (empty array of strings). |
| 951 | '(:array :signature "@{sv@}") ;; No hints | 951 | '(:array :signature "@{sv@}") ;; No hints |
| 952 | ;; (empty array of dictionary entries). | 952 | ;; (empty array of dictionary entries). |
| 953 | ':int32 -1) ;; Default timeout. | 953 | :int32 -1) ;; Default timeout. |
| 954 | 954 | ||
| 955 | @result{} 3 | 955 | @result{} 3 |
| 956 | @end lisp | 956 | @end lisp |
| @@ -1210,7 +1210,7 @@ They are converted into D-Bus types as described in @ref{Type | |||
| 1210 | Conversion}. | 1210 | Conversion}. |
| 1211 | 1211 | ||
| 1212 | Unless @var{handler} is @code{nil}, the function returns a key into | 1212 | Unless @var{handler} is @code{nil}, the function returns a key into |
| 1213 | the hash table @code{dbus-registered-functions-table}. The | 1213 | the hash table @code{dbus-registered-objects-table}. The |
| 1214 | corresponding entry in the hash table is removed, when the return | 1214 | corresponding entry in the hash table is removed, when the return |
| 1215 | message has been arrived, and @var{handler} is called. Example: | 1215 | message has been arrived, and @var{handler} is called. Example: |
| 1216 | 1216 | ||
| @@ -1316,7 +1316,7 @@ registration for @var{method}. Example: | |||
| 1316 | If you invoke the method @samp{org.freedesktop.TextEditor.OpenFile} | 1316 | If you invoke the method @samp{org.freedesktop.TextEditor.OpenFile} |
| 1317 | from another D-Bus application with a filename as parameter, the file | 1317 | from another D-Bus application with a filename as parameter, the file |
| 1318 | is opened in Emacs, and the method returns either @var{true} or | 1318 | is opened in Emacs, and the method returns either @var{true} or |
| 1319 | @var{false}, indicating the success if the method. As test tool one | 1319 | @var{false}, indicating the success of the method. As test tool one |
| 1320 | could use the command line tool @code{dbus-send} in a shell: | 1320 | could use the command line tool @code{dbus-send} in a shell: |
| 1321 | 1321 | ||
| 1322 | @example | 1322 | @example |
| @@ -1358,6 +1358,108 @@ The test runs then | |||
| 1358 | @end example | 1358 | @end example |
| 1359 | @end defun | 1359 | @end defun |
| 1360 | 1360 | ||
| 1361 | @defun dbus-register-property bus service path interface property access value | ||
| 1362 | With this function, an application declares a @var{property} on the D-Bus | ||
| 1363 | @var{bus}. | ||
| 1364 | |||
| 1365 | @var{bus} is either the symbol @code{:system} or the symbol | ||
| 1366 | @code{:session}. | ||
| 1367 | |||
| 1368 | @var{service} is the D-Bus service name of the D-Bus. It must be a | ||
| 1369 | known name. | ||
| 1370 | |||
| 1371 | @var{path} is the D-Bus object path @var{service} is | ||
| 1372 | registered. | ||
| 1373 | |||
| 1374 | @var{interface} is the name of the interface used at @var{path}, | ||
| 1375 | @var{property} is the name of the property of @var{interface}. | ||
| 1376 | |||
| 1377 | @var{access} indicates, whether the property can be changed by other | ||
| 1378 | services via D-Bus. It must be either the symbol @code{:read} or | ||
| 1379 | @code{:readwrite}. @var{value} is the initial value of the property, | ||
| 1380 | it can be of any valid type (see @code{dbus-call-method} for details). | ||
| 1381 | |||
| 1382 | If @var{property} already exists on @var{path}, it will be | ||
| 1383 | overwritten. For properties with access type @code{:read} this is the | ||
| 1384 | only way to change their values. Properties with access type | ||
| 1385 | @code{:readwrite} can be changed by @code{dbus-set-property}. | ||
| 1386 | |||
| 1387 | The interface @samp{org.freedesktop.DBus.Properties} is added to | ||
| 1388 | @var{path}, including a default handler for the @samp{Get}, | ||
| 1389 | @samp{GetAll} and @samp{Set} methods of this interface. Example: | ||
| 1390 | |||
| 1391 | @lisp | ||
| 1392 | (dbus-register-property | ||
| 1393 | :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" | ||
| 1394 | "org.freedesktop.TextEditor" "name" :read "GNU Emacs") | ||
| 1395 | |||
| 1396 | @result{} ((:session "org.freedesktop.TextEditor" "name") | ||
| 1397 | ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor")) | ||
| 1398 | |||
| 1399 | (dbus-register-property | ||
| 1400 | :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" | ||
| 1401 | "org.freedesktop.TextEditor" "version" :readwrite emacs-version) | ||
| 1402 | |||
| 1403 | @result{} ((:session "org.freedesktop.TextEditor" "version") | ||
| 1404 | ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor")) | ||
| 1405 | @end lisp | ||
| 1406 | |||
| 1407 | Other D-Bus applications can read the property via the default methods | ||
| 1408 | @samp{org.freedesktop.DBus.Properties.Get} and | ||
| 1409 | @samp{org.freedesktop.DBus.Properties.GetAll}. Testing is also | ||
| 1410 | possible via the command line tool @code{dbus-send} in a shell: | ||
| 1411 | |||
| 1412 | @example | ||
| 1413 | # dbus-send --session --print-reply \ | ||
| 1414 | --dest="org.freedesktop.TextEditor" \ | ||
| 1415 | "/org/freedesktop/TextEditor" \ | ||
| 1416 | "org.freedesktop.DBus.Properties.GetAll" \ | ||
| 1417 | string:"org.freedesktop.TextEditor" | ||
| 1418 | |||
| 1419 | @print{} method return sender=:1.22 -> dest=:1.23 reply_serial=3 | ||
| 1420 | array [ | ||
| 1421 | dict entry( | ||
| 1422 | string "name" | ||
| 1423 | variant string "GNU Emacs" | ||
| 1424 | ) | ||
| 1425 | dict entry( | ||
| 1426 | string "version" | ||
| 1427 | variant string "23.1.50.5" | ||
| 1428 | ) | ||
| 1429 | ] | ||
| 1430 | @end example | ||
| 1431 | |||
| 1432 | It is also possible, to apply the @code{dbus-get-property}, | ||
| 1433 | @code{dbus-get-all-properties} and @code{dbus-set-property} functions | ||
| 1434 | (@pxref{Properties and Annotations}). | ||
| 1435 | |||
| 1436 | @lisp | ||
| 1437 | (dbus-set-property | ||
| 1438 | :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" | ||
| 1439 | "org.freedesktop.TextEditor" "version" "23.1.50") | ||
| 1440 | |||
| 1441 | @result{} "23.1.50" | ||
| 1442 | |||
| 1443 | (dbus-get-property | ||
| 1444 | :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" | ||
| 1445 | "org.freedesktop.TextEditor" "version") | ||
| 1446 | |||
| 1447 | @result{} "23.1.50" | ||
| 1448 | @end lisp | ||
| 1449 | @end defun | ||
| 1450 | |||
| 1451 | @defun dbus-unregister-object object | ||
| 1452 | Unregister @var{object} from the D-Bus. @var{object} must be the | ||
| 1453 | result of a preceding @code{dbus-register-method}, | ||
| 1454 | @code{dbus-register-property} or @code{dbus-register-signal} call | ||
| 1455 | (@pxref{Signals}). It returns @code{t} if @var{object} has been | ||
| 1456 | unregistered, @code{nil} otherwise. | ||
| 1457 | |||
| 1458 | When @var{object} identifies the last method or property, which is | ||
| 1459 | registered for the respective service, Emacs releases its association | ||
| 1460 | to the service from D-Bus. | ||
| 1461 | @end defun | ||
| 1462 | |||
| 1361 | 1463 | ||
| 1362 | @node Signals | 1464 | @node Signals |
| 1363 | @chapter Sending and receiving signals. | 1465 | @chapter Sending and receiving signals. |
| @@ -1452,13 +1554,6 @@ machine, when registered for signal @samp{DeviceAdded}, will show you | |||
| 1452 | which objects the GNU/Linux @code{hal} daemon adds. | 1554 | which objects the GNU/Linux @code{hal} daemon adds. |
| 1453 | @end defun | 1555 | @end defun |
| 1454 | 1556 | ||
| 1455 | @defun dbus-unregister-object object | ||
| 1456 | Unregister @var{object} from the D-Bus. @var{object} must be the | ||
| 1457 | result of a preceding @code{dbus-register-signal} or | ||
| 1458 | @code{dbus-register-method} call. It returns @code{t} if @var{object} | ||
| 1459 | has been unregistered, @code{nil} otherwise. | ||
| 1460 | @end defun | ||
| 1461 | |||
| 1462 | 1557 | ||
| 1463 | @node Errors and Events | 1558 | @node Errors and Events |
| 1464 | @chapter Errors and events. | 1559 | @chapter Errors and events. |