diff options
| author | Michael Albinus | 2008-11-26 07:08:36 +0000 |
|---|---|---|
| committer | Michael Albinus | 2008-11-26 07:08:36 +0000 |
| commit | ace706d14bbae135bbc625a8e1140313631837b1 (patch) | |
| tree | 357c84b786b31cf7ffff9236cdb613ceee19d253 | |
| parent | 82697a456dec3ec1d625edb622d65494d5a8f8f2 (diff) | |
| download | emacs-ace706d14bbae135bbc625a8e1140313631837b1.tar.gz emacs-ace706d14bbae135bbc625a8e1140313631837b1.zip | |
* dbus.texi (Type Conversion): New defuns `dbus-string-to-byte-array',
`dbus-escape-as-identifier', `dbus-byte-array-to-string' and
`dbus-unescape-from-identifier'.
(Receiving Method Calls): New constants `dbus-service-emacs' and
`dbus-path-emacs'.
(Signals): Use the constants in the example.
| -rw-r--r-- | doc/misc/ChangeLog | 9 | ||||
| -rw-r--r-- | doc/misc/dbus.texi | 70 |
2 files changed, 77 insertions, 2 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 1b635720f0a..693998e0917 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2008-11-26 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * dbus.texi (Type Conversion): New defuns `dbus-string-to-byte-array', | ||
| 4 | `dbus-escape-as-identifier', `dbus-byte-array-to-string' and | ||
| 5 | `dbus-unescape-from-identifier'. | ||
| 6 | (Receiving Method Calls): New constants `dbus-service-emacs' and | ||
| 7 | `dbus-path-emacs'. | ||
| 8 | (Signals): Use the constants in the example. | ||
| 9 | |||
| 1 | 2008-11-24 Carsten Dominik <dominik@science.uva.nl> | 10 | 2008-11-24 Carsten Dominik <dominik@science.uva.nl> |
| 2 | 11 | ||
| 3 | * org.texi: re-apply change to FDL 1.3. | 12 | * org.texi: re-apply change to FDL 1.3. |
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index 80ec22b166f..672ac86f8dd 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi | |||
| @@ -945,6 +945,37 @@ elements of this array. Example: | |||
| 945 | @result{} 3 | 945 | @result{} 3 |
| 946 | @end lisp | 946 | @end lisp |
| 947 | 947 | ||
| 948 | @defun dbus-string-to-byte-array string | ||
| 949 | Sometimes, D-Bus methods require as input parameter an array of bytes, | ||
| 950 | instead of a string. If it is guaranteed, that @var{string} is an | ||
| 951 | UTF8 string, this function performs the conversion. Example: | ||
| 952 | |||
| 953 | @lisp | ||
| 954 | (dbus-string-to-byte-array "/etc/hosts") | ||
| 955 | |||
| 956 | @result{} (:array :byte 47 :byte 101 :byte 116 :byte 99 :byte 47 | ||
| 957 | :byte 104 :byte 111 :byte 115 :byte 116 :byte 115) | ||
| 958 | @end lisp | ||
| 959 | @end defun | ||
| 960 | |||
| 961 | @defun dbus-escape-as-identifier string | ||
| 962 | Escape an arbitrary @var{string} so it follows the rules for a C | ||
| 963 | identifier. The escaped string can be used as object path component, | ||
| 964 | interface element component, bus name component or member name in | ||
| 965 | D-Bus. | ||
| 966 | |||
| 967 | The escaping consists of replacing all non-alphanumerics, and the | ||
| 968 | first character if it's a digit, with an underscore and two | ||
| 969 | lower-case hex digits. As a special case, "" is escaped to | ||
| 970 | "_". Example: | ||
| 971 | |||
| 972 | @lisp | ||
| 973 | (dbus-escape-as-identifier "0123abc_xyz\x01\xff") | ||
| 974 | |||
| 975 | @result{} "_30123abc_5fxyz_01_ff" | ||
| 976 | @end lisp | ||
| 977 | @end defun | ||
| 978 | |||
| 948 | 979 | ||
| 949 | @section Output parameters. | 980 | @section Output parameters. |
| 950 | 981 | ||
| @@ -991,6 +1022,30 @@ The signal @code{PropertyModified}, discussed as example in | |||
| 991 | (@var{NUMBER} ((@var{STRING} @var{BOOL} @var{BOOL}) (@var{STRING} @var{BOOL} @var{BOOL}) @dots{})) | 1022 | (@var{NUMBER} ((@var{STRING} @var{BOOL} @var{BOOL}) (@var{STRING} @var{BOOL} @var{BOOL}) @dots{})) |
| 992 | @end lisp | 1023 | @end lisp |
| 993 | 1024 | ||
| 1025 | @defun dbus-byte-array-to-string byte-array | ||
| 1026 | If a D-Bus method or signal returns an array of bytes, which are known | ||
| 1027 | to represent an UTF8 string, this function converts @var{byte-array} | ||
| 1028 | to the corresponding string. Example: | ||
| 1029 | |||
| 1030 | @lisp | ||
| 1031 | (dbus-byte-array-to-string '(47 101 116 99 47 104 111 115 116 115)) | ||
| 1032 | |||
| 1033 | @result{} "/etc/hosts" | ||
| 1034 | @end lisp | ||
| 1035 | @end defun | ||
| 1036 | |||
| 1037 | @defun dbus-unescape-from-identifier string | ||
| 1038 | Retrieve the original string from the encoded @var{string}. | ||
| 1039 | @var{string} must have been coded with | ||
| 1040 | @code{dbus-escape-as-identifier}. Example: | ||
| 1041 | |||
| 1042 | @lisp | ||
| 1043 | (dbus-unescape-from-identifier "_30123abc_5fxyz_01_ff") | ||
| 1044 | |||
| 1045 | @result{} "0123abc_xyzΓΏ" | ||
| 1046 | @end lisp | ||
| 1047 | @end defun | ||
| 1048 | |||
| 994 | 1049 | ||
| 995 | @node Synchronous Methods | 1050 | @node Synchronous Methods |
| 996 | @chapter Calling methods in a blocking way. | 1051 | @chapter Calling methods in a blocking way. |
| @@ -1173,6 +1228,16 @@ interface name shall be @code{org.gnu.Emacs.@strong{Application}}. | |||
| 1173 | @samp{@strong{Application}} is the name of the application which | 1228 | @samp{@strong{Application}} is the name of the application which |
| 1174 | provides the interface. | 1229 | provides the interface. |
| 1175 | 1230 | ||
| 1231 | @deffn Constant dbus-service-emacs | ||
| 1232 | The well known service name of Emacs. | ||
| 1233 | @end deffn | ||
| 1234 | |||
| 1235 | @deffn Constant dbus-path-emacs | ||
| 1236 | The object path head "/org/gnu/Emacs" used by Emacs. All object | ||
| 1237 | paths, used by offered methods or signals, shall start with this | ||
| 1238 | string. | ||
| 1239 | @end deffn | ||
| 1240 | |||
| 1176 | @defun dbus-register-method bus service path interface method handler | 1241 | @defun dbus-register-method bus service path interface method handler |
| 1177 | With this function, an application registers @var{method} on the D-Bus | 1242 | With this function, an application registers @var{method} on the D-Bus |
| 1178 | @var{bus}. | 1243 | @var{bus}. |
| @@ -1296,8 +1361,9 @@ Conversion}. Example: | |||
| 1296 | 1361 | ||
| 1297 | @lisp | 1362 | @lisp |
| 1298 | (dbus-send-signal | 1363 | (dbus-send-signal |
| 1299 | :session "org.gnu.Emacs" "/org/gnu/Emacs" | 1364 | :session dbus-service-emacs dbus-path-emacs |
| 1300 | "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") | 1365 | (concat dbus-service-emacs ".FileManager") "FileModified" |
| 1366 | "/home/albinus/.emacs") | ||
| 1301 | @end lisp | 1367 | @end lisp |
| 1302 | @end defun | 1368 | @end defun |
| 1303 | 1369 | ||