aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2008-11-26 07:08:36 +0000
committerMichael Albinus2008-11-26 07:08:36 +0000
commitace706d14bbae135bbc625a8e1140313631837b1 (patch)
tree357c84b786b31cf7ffff9236cdb613ceee19d253
parent82697a456dec3ec1d625edb622d65494d5a8f8f2 (diff)
downloademacs-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/ChangeLog9
-rw-r--r--doc/misc/dbus.texi70
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 @@
12008-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
12008-11-24 Carsten Dominik <dominik@science.uva.nl> 102008-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
949Sometimes, D-Bus methods require as input parameter an array of bytes,
950instead of a string. If it is guaranteed, that @var{string} is an
951UTF8 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
962Escape an arbitrary @var{string} so it follows the rules for a C
963identifier. The escaped string can be used as object path component,
964interface element component, bus name component or member name in
965D-Bus.
966
967The escaping consists of replacing all non-alphanumerics, and the
968first character if it's a digit, with an underscore and two
969lower-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
1026If a D-Bus method or signal returns an array of bytes, which are known
1027to represent an UTF8 string, this function converts @var{byte-array}
1028to 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
1038Retrieve 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
1174provides the interface. 1229provides the interface.
1175 1230
1231@deffn Constant dbus-service-emacs
1232The well known service name of Emacs.
1233@end deffn
1234
1235@deffn Constant dbus-path-emacs
1236The object path head "/org/gnu/Emacs" used by Emacs. All object
1237paths, used by offered methods or signals, shall start with this
1238string.
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
1177With this function, an application registers @var{method} on the D-Bus 1242With 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