Mercurial > emacs
annotate src/dbusbind.c @ 92677:3f32c597cb6b
(diary-islamic-date): Move to end.
(date, number): Declare where needed.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sun, 09 Mar 2008 03:42:58 +0000 |
parents | f42bf2712087 |
children | 3ef12fa772f2 |
rev | line source |
---|---|
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1 /* Elisp bindings for D-Bus. |
87533
d24ee3180427
* dbusbind.c (xd_append_arg): Use unsigned char instead of
Magnus Henoch <mange@freemail.hu>
parents:
87501
diff
changeset
|
2 Copyright (C) 2007, 2008 Free Software Foundation, Inc. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4 This file is part of GNU Emacs. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
6 GNU Emacs is free software; you can redistribute it and/or modify |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
7 it under the terms of the GNU General Public License as published by |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
8 the Free Software Foundation; either version 3, or (at your option) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
9 any later version. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
10 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
11 GNU Emacs is distributed in the hope that it will be useful, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
14 GNU General Public License for more details. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
15 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
17 along with GNU Emacs; see the file COPYING. If not, write to |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
19 Boston, MA 02110-1301, USA. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
20 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
21 #include "config.h" |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
22 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
23 #ifdef HAVE_DBUS |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
24 #include <stdlib.h> |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
25 #include <stdio.h> |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
26 #include <dbus/dbus.h> |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
27 #include "lisp.h" |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
28 #include "frame.h" |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
29 #include "termhooks.h" |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
30 #include "keyboard.h" |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
31 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
32 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
33 /* Subroutines. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
34 Lisp_Object Qdbus_get_unique_name; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
35 Lisp_Object Qdbus_call_method; |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
36 Lisp_Object Qdbus_method_return_internal; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
37 Lisp_Object Qdbus_send_signal; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
38 Lisp_Object Qdbus_register_signal; |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
39 Lisp_Object Qdbus_register_method; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
40 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
41 /* D-Bus error symbol. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
42 Lisp_Object Qdbus_error; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
43 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
44 /* Lisp symbols of the system and session buses. */ |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
45 Lisp_Object QCdbus_system_bus, QCdbus_session_bus; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
46 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
47 /* Lisp symbols of D-Bus types. */ |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
48 Lisp_Object QCdbus_type_byte, QCdbus_type_boolean; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
49 Lisp_Object QCdbus_type_int16, QCdbus_type_uint16; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
50 Lisp_Object QCdbus_type_int32, QCdbus_type_uint32; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
51 Lisp_Object QCdbus_type_int64, QCdbus_type_uint64; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
52 Lisp_Object QCdbus_type_double, QCdbus_type_string; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
53 Lisp_Object QCdbus_type_object_path, QCdbus_type_signature; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
54 Lisp_Object QCdbus_type_array, QCdbus_type_variant; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
55 Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry; |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
56 |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
57 /* Hash table which keeps function definitions. */ |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
58 Lisp_Object Vdbus_registered_functions_table; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
59 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
60 /* Whether to debug D-Bus. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
61 Lisp_Object Vdbus_debug; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
62 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
63 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
64 /* We use "xd_" and "XD_" as prefix for all internal symbols, because |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
65 we don't want to poison other namespaces with "dbus_". */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
66 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
67 /* Raise a Lisp error from a D-Bus ERROR. */ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
68 #define XD_ERROR(error) \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
69 do { \ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
70 char s[1024]; \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
71 strcpy (s, error.message); \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
72 dbus_error_free (&error); \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
73 /* Remove the trailing newline. */ \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
74 if (strchr (s, '\n') != NULL) \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
75 s[strlen (s) - 1] = '\0'; \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
76 xsignal1 (Qdbus_error, build_string (s)); \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
77 } while (0) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
78 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
79 /* Macros for debugging. In order to enable them, build with |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
80 "make MYCPPFLAGS='-DDBUS_DEBUG -Wall'". */ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
81 #ifdef DBUS_DEBUG |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
82 #define XD_DEBUG_MESSAGE(...) \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
83 do { \ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
84 char s[1024]; \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
85 sprintf (s, __VA_ARGS__); \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
86 printf ("%s: %s\n", __func__, s); \ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
87 message ("%s: %s", __func__, s); \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
88 } while (0) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
89 #define XD_DEBUG_VALID_LISP_OBJECT_P(object) \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
90 do { \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
91 if (!valid_lisp_object_p (object)) \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
92 { \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
93 XD_DEBUG_MESSAGE ("%d Assertion failure", __LINE__); \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
94 xsignal1 (Qdbus_error, build_string ("Assertion failure")); \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
95 } \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
96 } while (0) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
97 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
98 #else /* !DBUS_DEBUG */ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
99 #define XD_DEBUG_MESSAGE(...) \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
100 do { \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
101 if (!NILP (Vdbus_debug)) \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
102 { \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
103 char s[1024]; \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
104 sprintf (s, __VA_ARGS__); \ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
105 message ("%s: %s", __func__, s); \ |
87493
42bd83957313
*** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents:
87490
diff
changeset
|
106 } \ |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
107 } while (0) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
108 #define XD_DEBUG_VALID_LISP_OBJECT_P(object) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
109 #endif |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
110 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
111 /* Check whether TYPE is a basic DBusType. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
112 #define XD_BASIC_DBUS_TYPE(type) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
113 ((type == DBUS_TYPE_BYTE) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
114 || (type == DBUS_TYPE_BOOLEAN) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
115 || (type == DBUS_TYPE_INT16) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
116 || (type == DBUS_TYPE_UINT16) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
117 || (type == DBUS_TYPE_INT32) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
118 || (type == DBUS_TYPE_UINT32) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
119 || (type == DBUS_TYPE_INT64) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
120 || (type == DBUS_TYPE_UINT64) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
121 || (type == DBUS_TYPE_DOUBLE) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
122 || (type == DBUS_TYPE_STRING) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
123 || (type == DBUS_TYPE_OBJECT_PATH) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
124 || (type == DBUS_TYPE_SIGNATURE)) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
125 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
126 /* Determine the DBusType of a given Lisp symbol. OBJECT must be one |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
127 of the predefined D-Bus type symbols. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
128 #define XD_SYMBOL_TO_DBUS_TYPE(object) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
129 ((EQ (object, QCdbus_type_byte)) ? DBUS_TYPE_BYTE \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
130 : (EQ (object, QCdbus_type_boolean)) ? DBUS_TYPE_BOOLEAN \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
131 : (EQ (object, QCdbus_type_int16)) ? DBUS_TYPE_INT16 \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
132 : (EQ (object, QCdbus_type_uint16)) ? DBUS_TYPE_UINT16 \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
133 : (EQ (object, QCdbus_type_int32)) ? DBUS_TYPE_INT32 \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
134 : (EQ (object, QCdbus_type_uint32)) ? DBUS_TYPE_UINT32 \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
135 : (EQ (object, QCdbus_type_int64)) ? DBUS_TYPE_INT64 \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
136 : (EQ (object, QCdbus_type_uint64)) ? DBUS_TYPE_UINT64 \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
137 : (EQ (object, QCdbus_type_double)) ? DBUS_TYPE_DOUBLE \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
138 : (EQ (object, QCdbus_type_string)) ? DBUS_TYPE_STRING \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
139 : (EQ (object, QCdbus_type_object_path)) ? DBUS_TYPE_OBJECT_PATH \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
140 : (EQ (object, QCdbus_type_signature)) ? DBUS_TYPE_SIGNATURE \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
141 : (EQ (object, QCdbus_type_array)) ? DBUS_TYPE_ARRAY \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
142 : (EQ (object, QCdbus_type_variant)) ? DBUS_TYPE_VARIANT \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
143 : (EQ (object, QCdbus_type_struct)) ? DBUS_TYPE_STRUCT \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
144 : (EQ (object, QCdbus_type_dict_entry)) ? DBUS_TYPE_DICT_ENTRY \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
145 : DBUS_TYPE_INVALID) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
146 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
147 /* Check whether a Lisp symbol is a predefined D-Bus type symbol. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
148 #define XD_DBUS_TYPE_P(object) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
149 (SYMBOLP (object) && ((XD_SYMBOL_TO_DBUS_TYPE (object) != DBUS_TYPE_INVALID))) |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
150 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
151 /* Determine the DBusType of a given Lisp OBJECT. It is used to |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
152 convert Lisp objects, being arguments of `dbus-call-method' or |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
153 `dbus-send-signal', into corresponding C values appended as |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
154 arguments to a D-Bus message. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
155 #define XD_OBJECT_TO_DBUS_TYPE(object) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
156 ((EQ (object, Qt) || EQ (object, Qnil)) ? DBUS_TYPE_BOOLEAN \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
157 : (NATNUMP (object)) ? DBUS_TYPE_UINT32 \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
158 : (INTEGERP (object)) ? DBUS_TYPE_INT32 \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
159 : (FLOATP (object)) ? DBUS_TYPE_DOUBLE \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
160 : (STRINGP (object)) ? DBUS_TYPE_STRING \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
161 : (XD_DBUS_TYPE_P (object)) ? XD_SYMBOL_TO_DBUS_TYPE (object) \ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
162 : (CONSP (object)) ? ((XD_DBUS_TYPE_P (CAR_SAFE (object))) \ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
163 ? XD_SYMBOL_TO_DBUS_TYPE (CAR_SAFE (object)) \ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
164 : DBUS_TYPE_ARRAY) \ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
165 : DBUS_TYPE_INVALID) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
166 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
167 /* Return a list pointer which does not have a Lisp symbol as car. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
168 #define XD_NEXT_VALUE(object) \ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
169 ((XD_DBUS_TYPE_P (CAR_SAFE (object))) ? CDR_SAFE (object) : object) |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
170 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
171 /* Compute SIGNATURE of OBJECT. It must have a form that it can be |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
172 used in dbus_message_iter_open_container. DTYPE is the DBusType |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
173 the object is related to. It is passed as argument, because it |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
174 cannot be detected in basic type objects, when they are preceded by |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
175 a type symbol. PARENT_TYPE is the DBusType of a container this |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
176 signature is embedded, or DBUS_TYPE_INVALID. It is needed for the |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
177 check that DBUS_TYPE_DICT_ENTRY occurs only as array element. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
178 void |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
179 xd_signature(signature, dtype, parent_type, object) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
180 char *signature; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
181 unsigned int dtype, parent_type; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
182 Lisp_Object object; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
183 { |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
184 unsigned int subtype; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
185 Lisp_Object elt; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
186 char x[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
187 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
188 elt = object; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
189 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
190 switch (dtype) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
191 { |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
192 case DBUS_TYPE_BYTE: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
193 case DBUS_TYPE_UINT16: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
194 case DBUS_TYPE_UINT32: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
195 case DBUS_TYPE_UINT64: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
196 CHECK_NATNUM (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
197 sprintf (signature, "%c", dtype); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
198 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
199 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
200 case DBUS_TYPE_BOOLEAN: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
201 if (!EQ (object, Qt) && !EQ (object, Qnil)) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
202 wrong_type_argument (intern ("booleanp"), object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
203 sprintf (signature, "%c", dtype); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
204 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
205 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
206 case DBUS_TYPE_INT16: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
207 case DBUS_TYPE_INT32: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
208 case DBUS_TYPE_INT64: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
209 CHECK_NUMBER (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
210 sprintf (signature, "%c", dtype); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
211 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
212 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
213 case DBUS_TYPE_DOUBLE: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
214 CHECK_FLOAT (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
215 sprintf (signature, "%c", dtype); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
216 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
217 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
218 case DBUS_TYPE_STRING: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
219 case DBUS_TYPE_OBJECT_PATH: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
220 case DBUS_TYPE_SIGNATURE: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
221 CHECK_STRING (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
222 sprintf (signature, "%c", dtype); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
223 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
224 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
225 case DBUS_TYPE_ARRAY: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
226 /* Check that all list elements have the same D-Bus type. For |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
227 complex element types, we just check the container type, not |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
228 the whole element's signature. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
229 CHECK_CONS (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
230 |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
231 /* Type symbol is optional. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
232 if (EQ (QCdbus_type_array, CAR_SAFE (elt))) |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
233 elt = XD_NEXT_VALUE (elt); |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
234 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
235 /* If the array is empty, DBUS_TYPE_STRING is the default |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
236 element type. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
237 if (NILP (elt)) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
238 { |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
239 subtype = DBUS_TYPE_STRING; |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
240 strcpy (x, DBUS_TYPE_STRING_AS_STRING); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
241 } |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
242 else |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
243 { |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
244 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
245 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
246 } |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
247 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
248 /* If the element type is DBUS_TYPE_SIGNATURE, and this is the |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
249 only element, the value of this element is used as he array's |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
250 element signature. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
251 if ((subtype == DBUS_TYPE_SIGNATURE) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
252 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (elt))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
253 && NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
254 strcpy (x, SDATA (CAR_SAFE (XD_NEXT_VALUE (elt)))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
255 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
256 while (!NILP (elt)) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
257 { |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
258 if (subtype != XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
259 wrong_type_argument (intern ("D-Bus"), CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
260 elt = CDR_SAFE (XD_NEXT_VALUE (elt)); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
261 } |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
262 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
263 sprintf (signature, "%c%s", dtype, x); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
264 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
265 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
266 case DBUS_TYPE_VARIANT: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
267 /* Check that there is exactly one list element. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
268 CHECK_CONS (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
269 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
270 elt = XD_NEXT_VALUE (elt); |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
271 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
272 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
273 |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
274 if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
275 wrong_type_argument (intern ("D-Bus"), |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
276 CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
277 |
87497
1d88fa50b198
* dbusbind.c (xd_signature): Signature of variant is just "v".
Magnus Henoch <mange@freemail.hu>
parents:
87493
diff
changeset
|
278 sprintf (signature, "%c", dtype); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
279 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
280 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
281 case DBUS_TYPE_STRUCT: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
282 /* A struct list might contain any number of elements with |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
283 different types. No further check needed. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
284 CHECK_CONS (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
285 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
286 elt = XD_NEXT_VALUE (elt); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
287 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
288 /* Compose the signature from the elements. It is enclosed by |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
289 parentheses. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
290 sprintf (signature, "%c", DBUS_STRUCT_BEGIN_CHAR ); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
291 while (!NILP (elt)) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
292 { |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
293 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
294 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
295 strcat (signature, x); |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
296 elt = CDR_SAFE (XD_NEXT_VALUE (elt)); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
297 } |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
298 sprintf (signature, "%s%c", signature, DBUS_STRUCT_END_CHAR); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
299 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
300 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
301 case DBUS_TYPE_DICT_ENTRY: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
302 /* Check that there are exactly two list elements, and the first |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
303 one is of basic type. The dictionary entry itself must be an |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
304 element of an array. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
305 CHECK_CONS (object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
306 |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
307 /* Check the parent object type. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
308 if (parent_type != DBUS_TYPE_ARRAY) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
309 wrong_type_argument (intern ("D-Bus"), object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
310 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
311 /* Compose the signature from the elements. It is enclosed by |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
312 curly braces. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
313 sprintf (signature, "%c", DBUS_DICT_ENTRY_BEGIN_CHAR); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
314 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
315 /* First element. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
316 elt = XD_NEXT_VALUE (elt); |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
317 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
318 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
319 strcat (signature, x); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
320 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
321 if (!XD_BASIC_DBUS_TYPE (subtype)) |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
322 wrong_type_argument (intern ("D-Bus"), CAR_SAFE (XD_NEXT_VALUE (elt))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
323 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
324 /* Second element. */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
325 elt = CDR_SAFE (XD_NEXT_VALUE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
326 subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
327 xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
328 strcat (signature, x); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
329 |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
330 if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
331 wrong_type_argument (intern ("D-Bus"), |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
332 CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
333 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
334 /* Closing signature. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
335 sprintf (signature, "%s%c", signature, DBUS_DICT_ENTRY_END_CHAR); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
336 break; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
337 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
338 default: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
339 wrong_type_argument (intern ("D-Bus"), object); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
340 } |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
341 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
342 XD_DEBUG_MESSAGE ("%s", signature); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
343 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
344 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
345 /* Append C value, extracted from Lisp OBJECT, to iteration ITER. |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
346 DTYPE must be a valid DBusType. It is used to convert Lisp |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
347 objects, being arguments of `dbus-call-method' or |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
348 `dbus-send-signal', into corresponding C values appended as |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
349 arguments to a D-Bus message. */ |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
350 void |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
351 xd_append_arg (dtype, object, iter) |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
352 unsigned int dtype; |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
353 Lisp_Object object; |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
354 DBusMessageIter *iter; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
355 { |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
356 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
357 DBusMessageIter subiter; |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
358 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
359 if (XD_BASIC_DBUS_TYPE (dtype)) |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
360 switch (dtype) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
361 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
362 case DBUS_TYPE_BYTE: |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
363 { |
87533
d24ee3180427
* dbusbind.c (xd_append_arg): Use unsigned char instead of
Magnus Henoch <mange@freemail.hu>
parents:
87501
diff
changeset
|
364 unsigned char val = XUINT (object) & 0xFF; |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
365 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
366 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
367 xsignal2 (Qdbus_error, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
368 build_string ("Unable to append argument"), object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
369 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
370 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
371 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
372 case DBUS_TYPE_BOOLEAN: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
373 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
374 dbus_bool_t val = (NILP (object)) ? FALSE : TRUE; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
375 XD_DEBUG_MESSAGE ("%c %s", dtype, (val == FALSE) ? "false" : "true"); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
376 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
377 xsignal2 (Qdbus_error, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
378 build_string ("Unable to append argument"), object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
379 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
380 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
381 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
382 case DBUS_TYPE_INT16: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
383 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
384 dbus_int16_t val = XINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
385 XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
386 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
387 xsignal2 (Qdbus_error, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
388 build_string ("Unable to append argument"), object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
389 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
390 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
391 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
392 case DBUS_TYPE_UINT16: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
393 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
394 dbus_uint16_t val = XUINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
395 XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
396 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
397 xsignal2 (Qdbus_error, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
398 build_string ("Unable to append argument"), object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
399 return; |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
400 } |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
401 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
402 case DBUS_TYPE_INT32: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
403 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
404 dbus_int32_t val = XINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
405 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
406 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
407 xsignal2 (Qdbus_error, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
408 build_string ("Unable to append argument"), object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
409 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
410 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
411 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
412 case DBUS_TYPE_UINT32: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
413 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
414 dbus_uint32_t val = XUINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
415 XD_DEBUG_MESSAGE ("%c %u", dtype, val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
416 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
417 xsignal2 (Qdbus_error, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
418 build_string ("Unable to append argument"), object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
419 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
420 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
421 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
422 case DBUS_TYPE_INT64: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
423 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
424 dbus_int64_t val = XINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
425 XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
426 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
427 xsignal2 (Qdbus_error, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
428 build_string ("Unable to append argument"), object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
429 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
430 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
431 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
432 case DBUS_TYPE_UINT64: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
433 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
434 dbus_uint64_t val = XUINT (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
435 XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
436 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
437 xsignal2 (Qdbus_error, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
438 build_string ("Unable to append argument"), object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
439 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
440 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
441 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
442 case DBUS_TYPE_DOUBLE: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
443 XD_DEBUG_MESSAGE ("%c %f", dtype, XFLOAT_DATA (object)); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
444 if (!dbus_message_iter_append_basic (iter, dtype, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
445 &XFLOAT_DATA (object))) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
446 xsignal2 (Qdbus_error, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
447 build_string ("Unable to append argument"), object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
448 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
449 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
450 case DBUS_TYPE_STRING: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
451 case DBUS_TYPE_OBJECT_PATH: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
452 case DBUS_TYPE_SIGNATURE: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
453 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
454 char *val = SDATA (object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
455 XD_DEBUG_MESSAGE ("%c %s", dtype, val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
456 if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
457 xsignal2 (Qdbus_error, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
458 build_string ("Unable to append argument"), object); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
459 return; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
460 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
461 } |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
462 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
463 else /* Compound types. */ |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
464 { |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
465 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
466 /* All compound types except array have a type symbol. For |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
467 array, it is optional. Skip it. */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
468 if (!XD_BASIC_DBUS_TYPE (XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (object)))) |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
469 object = XD_NEXT_VALUE (object); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
470 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
471 /* Open new subiteration. */ |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
472 switch (dtype) |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
473 { |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
474 case DBUS_TYPE_ARRAY: |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
475 /* An array has only elements of the same type. So it is |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
476 sufficient to check the first element's signature |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
477 only. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
478 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
479 if (NILP (object)) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
480 /* If the array is empty, DBUS_TYPE_STRING is the default |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
481 element type. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
482 strcpy (signature, DBUS_TYPE_STRING_AS_STRING); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
483 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
484 else |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
485 /* If the element type is DBUS_TYPE_SIGNATURE, and this is |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
486 the only element, the value of this element is used as |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
487 the array's element signature. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
488 if ((XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (object)) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
489 == DBUS_TYPE_SIGNATURE) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
490 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (object))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
491 && NILP (CDR_SAFE (XD_NEXT_VALUE (object)))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
492 { |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
493 strcpy (signature, SDATA (CAR_SAFE (XD_NEXT_VALUE (object)))); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
494 object = CDR_SAFE (XD_NEXT_VALUE (object)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
495 } |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
496 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
497 else |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
498 xd_signature (signature, |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
499 XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (object)), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
500 dtype, CAR_SAFE (XD_NEXT_VALUE (object))); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
501 |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
502 XD_DEBUG_MESSAGE ("%c %s %s", dtype, signature, |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
503 SDATA (format2 ("%s", object, Qnil))); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
504 if (!dbus_message_iter_open_container (iter, dtype, |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
505 signature, &subiter)) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
506 xsignal3 (Qdbus_error, |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
507 build_string ("Cannot open container"), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
508 make_number (dtype), build_string (signature)); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
509 break; |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
510 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
511 case DBUS_TYPE_VARIANT: |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
512 /* A variant has just one element. */ |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
513 xd_signature (signature, XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (object)), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
514 dtype, CAR_SAFE (XD_NEXT_VALUE (object))); |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
515 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
516 XD_DEBUG_MESSAGE ("%c %s %s", dtype, signature, |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
517 SDATA (format2 ("%s", object, Qnil))); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
518 if (!dbus_message_iter_open_container (iter, dtype, |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
519 signature, &subiter)) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
520 xsignal3 (Qdbus_error, |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
521 build_string ("Cannot open container"), |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
522 make_number (dtype), build_string (signature)); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
523 break; |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
524 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
525 case DBUS_TYPE_STRUCT: |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
526 case DBUS_TYPE_DICT_ENTRY: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
527 /* These containers do not require a signature. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
528 XD_DEBUG_MESSAGE ("%c %s", dtype, |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
529 SDATA (format2 ("%s", object, Qnil))); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
530 if (!dbus_message_iter_open_container (iter, dtype, NULL, &subiter)) |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
531 xsignal2 (Qdbus_error, |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
532 build_string ("Cannot open container"), |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
533 make_number (dtype)); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
534 break; |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
535 } |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
536 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
537 /* Loop over list elements. */ |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
538 while (!NILP (object)) |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
539 { |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
540 dtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (object)); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
541 object = XD_NEXT_VALUE (object); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
542 |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
543 xd_append_arg (dtype, CAR_SAFE (object), &subiter); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
544 |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
545 object = CDR_SAFE (object); |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
546 } |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
547 |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
548 /* Close the subiteration. */ |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
549 if (!dbus_message_iter_close_container (iter, &subiter)) |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
550 xsignal2 (Qdbus_error, |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
551 build_string ("Cannot close container"), |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
552 make_number (dtype)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
553 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
554 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
555 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
556 /* Retrieve C value from a DBusMessageIter structure ITER, and return |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
557 a converted Lisp object. The type DTYPE of the argument of the |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
558 D-Bus message must be a valid DBusType. Compound D-Bus types |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
559 result always in a Lisp list. */ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
560 Lisp_Object |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
561 xd_retrieve_arg (dtype, iter) |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
562 unsigned int dtype; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
563 DBusMessageIter *iter; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
564 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
565 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
566 switch (dtype) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
567 { |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
568 case DBUS_TYPE_BYTE: |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
569 { |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
570 unsigned int val; |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
571 dbus_message_iter_get_basic (iter, &val); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
572 val = val & 0xFF; |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
573 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
574 return make_number (val); |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
575 } |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
576 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
577 case DBUS_TYPE_BOOLEAN: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
578 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
579 dbus_bool_t val; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
580 dbus_message_iter_get_basic (iter, &val); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
581 XD_DEBUG_MESSAGE ("%c %s", dtype, (val == FALSE) ? "false" : "true"); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
582 return (val == FALSE) ? Qnil : Qt; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
583 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
584 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
585 case DBUS_TYPE_INT16: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
586 case DBUS_TYPE_UINT16: |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
587 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
588 dbus_uint16_t val; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
589 dbus_message_iter_get_basic (iter, &val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
590 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
591 return make_number (val); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
592 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
593 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
594 case DBUS_TYPE_INT32: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
595 case DBUS_TYPE_UINT32: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
596 { |
87972
f42bf2712087
* dbusbind.c (xd_retrieve_arg): Pacify GCC on x86_64 GNU/Linux.
Michael Albinus <michael.albinus@gmx.de>
parents:
87887
diff
changeset
|
597 /* Assignment to EMACS_INT stops GCC whining about limited |
f42bf2712087
* dbusbind.c (xd_retrieve_arg): Pacify GCC on x86_64 GNU/Linux.
Michael Albinus <michael.albinus@gmx.de>
parents:
87887
diff
changeset
|
598 range of data type. */ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
599 dbus_uint32_t val; |
87972
f42bf2712087
* dbusbind.c (xd_retrieve_arg): Pacify GCC on x86_64 GNU/Linux.
Michael Albinus <michael.albinus@gmx.de>
parents:
87887
diff
changeset
|
600 EMACS_INT val1; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
601 dbus_message_iter_get_basic (iter, &val); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
602 XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
87972
f42bf2712087
* dbusbind.c (xd_retrieve_arg): Pacify GCC on x86_64 GNU/Linux.
Michael Albinus <michael.albinus@gmx.de>
parents:
87887
diff
changeset
|
603 val1 = val; |
f42bf2712087
* dbusbind.c (xd_retrieve_arg): Pacify GCC on x86_64 GNU/Linux.
Michael Albinus <michael.albinus@gmx.de>
parents:
87887
diff
changeset
|
604 return make_fixnum_or_float (val1); |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
605 } |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
606 |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
607 case DBUS_TYPE_INT64: |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
608 case DBUS_TYPE_UINT64: |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
609 { |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
610 dbus_uint64_t val; |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
611 dbus_message_iter_get_basic (iter, &val); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
612 XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
613 return make_fixnum_or_float (val); |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
614 } |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
615 |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
616 case DBUS_TYPE_DOUBLE: |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
617 { |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
618 double val; |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
619 dbus_message_iter_get_basic (iter, &val); |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
620 XD_DEBUG_MESSAGE ("%c %f", dtype, val); |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
621 return make_float (val); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
622 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
623 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
624 case DBUS_TYPE_STRING: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
625 case DBUS_TYPE_OBJECT_PATH: |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
626 case DBUS_TYPE_SIGNATURE: |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
627 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
628 char *val; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
629 dbus_message_iter_get_basic (iter, &val); |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
630 XD_DEBUG_MESSAGE ("%c %s", dtype, val); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
631 return build_string (val); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
632 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
633 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
634 case DBUS_TYPE_ARRAY: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
635 case DBUS_TYPE_VARIANT: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
636 case DBUS_TYPE_STRUCT: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
637 case DBUS_TYPE_DICT_ENTRY: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
638 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
639 Lisp_Object result; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
640 struct gcpro gcpro1; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
641 result = Qnil; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
642 GCPRO1 (result); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
643 DBusMessageIter subiter; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
644 int subtype; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
645 dbus_message_iter_recurse (iter, &subiter); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
646 while ((subtype = dbus_message_iter_get_arg_type (&subiter)) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
647 != DBUS_TYPE_INVALID) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
648 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
649 result = Fcons (xd_retrieve_arg (subtype, &subiter), result); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
650 dbus_message_iter_next (&subiter); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
651 } |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
652 XD_DEBUG_MESSAGE ("%c %s", dtype, SDATA (format2 ("%s", result, Qnil))); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
653 RETURN_UNGCPRO (Fnreverse (result)); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
654 } |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
655 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
656 default: |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
657 XD_DEBUG_MESSAGE ("DBusType '%c' not supported", dtype); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
658 return Qnil; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
659 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
660 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
661 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
662 /* Initialize D-Bus connection. BUS is a Lisp symbol, either :system |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
663 or :session. It tells which D-Bus to be initialized. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
664 DBusConnection * |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
665 xd_initialize (bus) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
666 Lisp_Object bus; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
667 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
668 DBusConnection *connection; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
669 DBusError derror; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
670 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
671 /* Parameter check. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
672 CHECK_SYMBOL (bus); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
673 if (!((EQ (bus, QCdbus_system_bus)) || (EQ (bus, QCdbus_session_bus)))) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
674 xsignal2 (Qdbus_error, build_string ("Wrong bus name"), bus); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
675 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
676 /* Open a connection to the bus. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
677 dbus_error_init (&derror); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
678 |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
679 if (EQ (bus, QCdbus_system_bus)) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
680 connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
681 else |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
682 connection = dbus_bus_get (DBUS_BUS_SESSION, &derror); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
683 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
684 if (dbus_error_is_set (&derror)) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
685 XD_ERROR (derror); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
686 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
687 if (connection == NULL) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
688 xsignal2 (Qdbus_error, build_string ("No connection"), bus); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
689 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
690 /* Return the result. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
691 return connection; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
692 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
693 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
694 DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
695 1, 1, 0, |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
696 doc: /* Return the unique name of Emacs registered at D-Bus BUS. */) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
697 (bus) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
698 Lisp_Object bus; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
699 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
700 DBusConnection *connection; |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
701 char name[DBUS_MAXIMUM_NAME_LENGTH]; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
702 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
703 /* Check parameters. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
704 CHECK_SYMBOL (bus); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
705 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
706 /* Open a connection to the bus. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
707 connection = xd_initialize (bus); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
708 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
709 /* Request the name. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
710 strcpy (name, dbus_bus_get_unique_name (connection)); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
711 if (name == NULL) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
712 xsignal1 (Qdbus_error, build_string ("No unique name available")); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
713 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
714 /* Return. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
715 return build_string (name); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
716 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
717 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
718 DEFUN ("dbus-call-method", Fdbus_call_method, Sdbus_call_method, 5, MANY, 0, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
719 doc: /* Call METHOD on the D-Bus BUS. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
720 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
721 BUS is either the symbol `:system' or the symbol `:session'. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
722 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
723 SERVICE is the D-Bus service name to be used. PATH is the D-Bus |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
724 object path SERVICE is registered at. INTERFACE is an interface |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
725 offered by SERVICE. It must provide METHOD. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
726 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
727 All other arguments ARGS are passed to METHOD as arguments. They are |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
728 converted into D-Bus types via the following rules: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
729 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
730 t and nil => DBUS_TYPE_BOOLEAN |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
731 number => DBUS_TYPE_UINT32 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
732 integer => DBUS_TYPE_INT32 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
733 float => DBUS_TYPE_DOUBLE |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
734 string => DBUS_TYPE_STRING |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
735 list => DBUS_TYPE_ARRAY |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
736 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
737 All arguments can be preceded by a type symbol. For details about |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
738 type symbols, see Info node `(dbus)Type Conversion'. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
739 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
740 `dbus-call-method' returns the resulting values of METHOD as a list of |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
741 Lisp objects. The type conversion happens the other direction as for |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
742 input arguments. It follows the mapping rules: |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
743 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
744 DBUS_TYPE_BOOLEAN => t or nil |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
745 DBUS_TYPE_BYTE => number |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
746 DBUS_TYPE_UINT16 => number |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
747 DBUS_TYPE_INT16 => integer |
87363
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
748 DBUS_TYPE_UINT32 => number or float |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
749 DBUS_TYPE_INT32 => integer or float |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
750 DBUS_TYPE_UINT64 => number or float |
28bc3dd3635f
* dbusbind.c (xd_retrieve_arg): Handle DBUS_TYPE_BYTE,
Michael Albinus <michael.albinus@gmx.de>
parents:
87361
diff
changeset
|
751 DBUS_TYPE_INT64 => integer or float |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
752 DBUS_TYPE_DOUBLE => float |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
753 DBUS_TYPE_STRING => string |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
754 DBUS_TYPE_OBJECT_PATH => string |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
755 DBUS_TYPE_SIGNATURE => string |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
756 DBUS_TYPE_ARRAY => list |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
757 DBUS_TYPE_VARIANT => list |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
758 DBUS_TYPE_STRUCT => list |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
759 DBUS_TYPE_DICT_ENTRY => list |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
760 |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
761 Example: |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
762 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
763 \(dbus-call-method |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
764 :session "org.gnome.seahorse" "/org/gnome/seahorse/keys/openpgp" |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
765 "org.gnome.seahorse.Keys" "GetKeyField" |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
766 "openpgp:657984B8C7A966DD" "simple-name") |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
767 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
768 => (t ("Philip R. Zimmermann")) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
769 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
770 If the result of the METHOD call is just one value, the converted Lisp |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
771 object is returned instead of a list containing this single Lisp object. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
772 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
773 \(dbus-call-method |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
774 :system "org.freedesktop.Hal" "/org/freedesktop/Hal/devices/computer" |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
775 "org.freedesktop.Hal.Device" "GetPropertyString" |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
776 "system.kernel.machine") |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
777 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
778 => "i686" |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
779 |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
780 usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &rest ARGS) */) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
781 (nargs, args) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
782 int nargs; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
783 register Lisp_Object *args; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
784 { |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
785 Lisp_Object bus, service, path, interface, method; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
786 Lisp_Object result; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
787 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
788 DBusConnection *connection; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
789 DBusMessage *dmessage; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
790 DBusMessage *reply; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
791 DBusMessageIter iter; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
792 DBusError derror; |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
793 unsigned int dtype; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
794 int i; |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
795 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
796 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
797 /* Check parameters. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
798 bus = args[0]; |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
799 service = args[1]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
800 path = args[2]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
801 interface = args[3]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
802 method = args[4]; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
803 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
804 CHECK_SYMBOL (bus); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
805 CHECK_STRING (service); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
806 CHECK_STRING (path); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
807 CHECK_STRING (interface); |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
808 CHECK_STRING (method); |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
809 GCPRO5 (bus, service, path, interface, method); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
810 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
811 XD_DEBUG_MESSAGE ("%s %s %s %s", |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
812 SDATA (service), |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
813 SDATA (path), |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
814 SDATA (interface), |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
815 SDATA (method)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
816 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
817 /* Open a connection to the bus. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
818 connection = xd_initialize (bus); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
819 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
820 /* Create the message. */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
821 dmessage = dbus_message_new_method_call (SDATA (service), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
822 SDATA (path), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
823 SDATA (interface), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
824 SDATA (method)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
825 if (dmessage == NULL) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
826 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
827 UNGCPRO; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
828 xsignal1 (Qdbus_error, build_string ("Unable to create a new message")); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
829 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
830 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
831 UNGCPRO; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
832 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
833 /* Initialize parameter list of message. */ |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
834 dbus_message_iter_init_append (dmessage, &iter); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
835 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
836 /* Append parameters to the message. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
837 for (i = 5; i < nargs; ++i) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
838 { |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
839 dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
840 if (XD_DBUS_TYPE_P (args[i])) |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
841 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
842 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
843 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
844 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-4, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
845 SDATA (format2 ("%s", args[i], Qnil)), |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
846 SDATA (format2 ("%s", args[i+1], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
847 ++i; |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
848 } |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
849 else |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
850 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
851 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
852 XD_DEBUG_MESSAGE ("Parameter%d %s", i-4, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
853 SDATA (format2 ("%s", args[i], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
854 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
855 |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
856 /* Check for valid signature. We use DBUS_TYPE_INVALID as |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
857 indication that there is no parent type. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
858 xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
859 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
860 xd_append_arg (dtype, args[i], &iter); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
861 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
862 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
863 /* Send the message. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
864 dbus_error_init (&derror); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
865 reply = dbus_connection_send_with_reply_and_block (connection, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
866 dmessage, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
867 -1, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
868 &derror); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
869 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
870 if (dbus_error_is_set (&derror)) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
871 XD_ERROR (derror); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
872 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
873 if (reply == NULL) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
874 xsignal1 (Qdbus_error, build_string ("No reply")); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
875 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
876 XD_DEBUG_MESSAGE ("Message sent"); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
877 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
878 /* Collect the results. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
879 result = Qnil; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
880 GCPRO1 (result); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
881 |
87535
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
882 if (dbus_message_iter_init (reply, &iter)) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
883 { |
87535
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
884 /* Loop over the parameters of the D-Bus reply message. Construct a |
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
885 Lisp list, which is returned by `dbus-call-method'. */ |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
886 while ((dtype = dbus_message_iter_get_arg_type (&iter)) |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
887 != DBUS_TYPE_INVALID) |
87535
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
888 { |
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
889 result = Fcons (xd_retrieve_arg (dtype, &iter), result); |
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
890 dbus_message_iter_next (&iter); |
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
891 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
892 } |
87535
6dcf49457032
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
Magnus Henoch <mange@freemail.hu>
parents:
87533
diff
changeset
|
893 else |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
894 { |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
895 /* No arguments: just return nil. */ |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
896 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
897 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
898 /* Cleanup. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
899 dbus_message_unref (dmessage); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
900 dbus_message_unref (reply); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
901 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
902 /* Return the result. If there is only one single Lisp object, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
903 return it as-it-is, otherwise return the reversed list. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
904 if (XUINT (Flength (result)) == 1) |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
905 RETURN_UNGCPRO (CAR_SAFE (result)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
906 else |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
907 RETURN_UNGCPRO (Fnreverse (result)); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
908 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
909 |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
910 DEFUN ("dbus-method-return-internal", Fdbus_method_return_internal, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
911 Sdbus_method_return_internal, |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
912 3, MANY, 0, |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
913 doc: /* Return for message SERIAL on the D-Bus BUS. |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
914 This is an internal function, it shall not be used outside dbus.el. |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
915 |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
916 usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
917 (nargs, args) |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
918 int nargs; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
919 register Lisp_Object *args; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
920 { |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
921 Lisp_Object bus, serial, service; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
922 struct gcpro gcpro1, gcpro2, gcpro3; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
923 DBusConnection *connection; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
924 DBusMessage *dmessage; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
925 DBusMessageIter iter; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
926 unsigned int dtype; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
927 int i; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
928 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
929 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
930 /* Check parameters. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
931 bus = args[0]; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
932 serial = args[1]; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
933 service = args[2]; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
934 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
935 CHECK_SYMBOL (bus); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
936 CHECK_NUMBER (serial); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
937 CHECK_STRING (service); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
938 GCPRO3 (bus, serial, service); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
939 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
940 XD_DEBUG_MESSAGE ("%d %s ", XUINT (serial), SDATA (service)); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
941 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
942 /* Open a connection to the bus. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
943 connection = xd_initialize (bus); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
944 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
945 /* Create the message. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
946 dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
947 if ((dmessage == NULL) |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
948 || (!dbus_message_set_reply_serial (dmessage, XUINT (serial))) |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
949 || (!dbus_message_set_destination (dmessage, SDATA (service)))) |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
950 { |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
951 UNGCPRO; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
952 xsignal1 (Qdbus_error, |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
953 build_string ("Unable to create a return message")); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
954 } |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
955 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
956 UNGCPRO; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
957 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
958 /* Initialize parameter list of message. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
959 dbus_message_iter_init_append (dmessage, &iter); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
960 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
961 /* Append parameters to the message. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
962 for (i = 3; i < nargs; ++i) |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
963 { |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
964 dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
965 if (XD_DBUS_TYPE_P (args[i])) |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
966 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
967 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
968 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
969 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-2, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
970 SDATA (format2 ("%s", args[i], Qnil)), |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
971 SDATA (format2 ("%s", args[i+1], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
972 ++i; |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
973 } |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
974 else |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
975 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
976 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
977 XD_DEBUG_MESSAGE ("Parameter%d %s", i-2, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
978 SDATA (format2 ("%s", args[i], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
979 } |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
980 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
981 /* Check for valid signature. We use DBUS_TYPE_INVALID as |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
982 indication that there is no parent type. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
983 xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
984 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
985 xd_append_arg (dtype, args[i], &iter); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
986 } |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
987 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
988 /* Send the message. The message is just added to the outgoing |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
989 message queue. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
990 if (!dbus_connection_send (connection, dmessage, NULL)) |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
991 xsignal1 (Qdbus_error, build_string ("Cannot send message")); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
992 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
993 /* Flush connection to ensure the message is handled. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
994 dbus_connection_flush (connection); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
995 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
996 XD_DEBUG_MESSAGE ("Message sent"); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
997 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
998 /* Cleanup. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
999 dbus_message_unref (dmessage); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1000 |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1001 /* Return. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1002 return Qt; |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1003 } |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1004 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1005 DEFUN ("dbus-send-signal", Fdbus_send_signal, Sdbus_send_signal, 5, MANY, 0, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1006 doc: /* Send signal SIGNAL on the D-Bus BUS. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1007 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1008 BUS is either the symbol `:system' or the symbol `:session'. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1009 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1010 SERVICE is the D-Bus service name SIGNAL is sent from. PATH is the |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1011 D-Bus object path SERVICE is registered at. INTERFACE is an interface |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1012 offered by SERVICE. It must provide signal SIGNAL. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1013 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1014 All other arguments ARGS are passed to SIGNAL as arguments. They are |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1015 converted into D-Bus types via the following rules: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1016 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1017 t and nil => DBUS_TYPE_BOOLEAN |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1018 number => DBUS_TYPE_UINT32 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1019 integer => DBUS_TYPE_INT32 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1020 float => DBUS_TYPE_DOUBLE |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1021 string => DBUS_TYPE_STRING |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1022 list => DBUS_TYPE_ARRAY |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1023 |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1024 All arguments can be preceded by a type symbol. For details about |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1025 type symbols, see Info node `(dbus)Type Conversion'. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1026 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1027 Example: |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1028 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1029 \(dbus-send-signal |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1030 :session "org.gnu.Emacs" "/org/gnu/Emacs" |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1031 "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1032 |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1033 usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1034 (nargs, args) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1035 int nargs; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1036 register Lisp_Object *args; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1037 { |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1038 Lisp_Object bus, service, path, interface, signal; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1039 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1040 DBusConnection *connection; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1041 DBusMessage *dmessage; |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1042 DBusMessageIter iter; |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
1043 unsigned int dtype; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1044 int i; |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1045 char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1046 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1047 /* Check parameters. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1048 bus = args[0]; |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1049 service = args[1]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1050 path = args[2]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1051 interface = args[3]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1052 signal = args[4]; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1053 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1054 CHECK_SYMBOL (bus); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1055 CHECK_STRING (service); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1056 CHECK_STRING (path); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1057 CHECK_STRING (interface); |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1058 CHECK_STRING (signal); |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1059 GCPRO5 (bus, service, path, interface, signal); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1060 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1061 XD_DEBUG_MESSAGE ("%s %s %s %s", |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1062 SDATA (service), |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1063 SDATA (path), |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1064 SDATA (interface), |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1065 SDATA (signal)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1066 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1067 /* Open a connection to the bus. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1068 connection = xd_initialize (bus); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1069 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1070 /* Create the message. */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1071 dmessage = dbus_message_new_signal (SDATA (path), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1072 SDATA (interface), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1073 SDATA (signal)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1074 if (dmessage == NULL) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1075 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1076 UNGCPRO; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1077 xsignal1 (Qdbus_error, build_string ("Unable to create a new message")); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1078 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1079 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1080 UNGCPRO; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1081 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1082 /* Initialize parameter list of message. */ |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1083 dbus_message_iter_init_append (dmessage, &iter); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1084 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1085 /* Append parameters to the message. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1086 for (i = 5; i < nargs; ++i) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1087 { |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1088 dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]); |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1089 if (XD_DBUS_TYPE_P (args[i])) |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1090 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1091 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1092 XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1093 XD_DEBUG_MESSAGE ("Parameter%d %s %s", i-4, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1094 SDATA (format2 ("%s", args[i], Qnil)), |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1095 SDATA (format2 ("%s", args[i+1], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1096 ++i; |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1097 } |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1098 else |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1099 { |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1100 XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1101 XD_DEBUG_MESSAGE ("Parameter%d %s", i-4, |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1102 SDATA (format2 ("%s", args[i], Qnil))); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1103 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1104 |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1105 /* Check for valid signature. We use DBUS_TYPE_INVALID as |
87361
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1106 indication that there is no parent type. */ |
0b387233ea86
* dbusbind.c (XD_BASIC_DBUS_TYPE, XD_DBUS_TYPE_P, XD_NEXT_VALUE):
Michael Albinus <michael.albinus@gmx.de>
parents:
87343
diff
changeset
|
1107 xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1108 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1109 xd_append_arg (dtype, args[i], &iter); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1110 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1111 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1112 /* Send the message. The message is just added to the outgoing |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1113 message queue. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1114 if (!dbus_connection_send (connection, dmessage, NULL)) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1115 xsignal1 (Qdbus_error, build_string ("Cannot send message")); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1116 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1117 /* Flush connection to ensure the message is handled. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1118 dbus_connection_flush (connection); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1119 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1120 XD_DEBUG_MESSAGE ("Signal sent"); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1121 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1122 /* Cleanup. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1123 dbus_message_unref (dmessage); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1124 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1125 /* Return. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1126 return Qt; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1127 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1128 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1129 /* Read queued incoming message of the D-Bus BUS. BUS is a Lisp |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1130 symbol, either :system or :session. */ |
87092
1ddad0de60e5
* dbusbind.c (xd_read_message): Return value is a Lisp_Object.
Michael Albinus <michael.albinus@gmx.de>
parents:
87053
diff
changeset
|
1131 Lisp_Object |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1132 xd_read_message (bus) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1133 Lisp_Object bus; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1134 { |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1135 Lisp_Object args, key, value; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1136 struct gcpro gcpro1; |
87501
38cad849184d
* dbusbind.c (xd_read_message): Use non-static input_event struct.
Michael Albinus <michael.albinus@gmx.de>
parents:
87497
diff
changeset
|
1137 struct input_event event; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1138 DBusConnection *connection; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1139 DBusMessage *dmessage; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1140 DBusMessageIter iter; |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
1141 unsigned int dtype; |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1142 int mtype; |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1143 char uname[DBUS_MAXIMUM_NAME_LENGTH]; |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1144 char path[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; /* Unlimited in D-Bus spec. */ |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1145 char interface[DBUS_MAXIMUM_NAME_LENGTH]; |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1146 char member[DBUS_MAXIMUM_NAME_LENGTH]; |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1147 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1148 /* Open a connection to the bus. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1149 connection = xd_initialize (bus); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1150 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1151 /* Non blocking read of the next available message. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1152 dbus_connection_read_write (connection, 0); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1153 dmessage = dbus_connection_pop_message (connection); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1154 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1155 /* Return if there is no queued message. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1156 if (dmessage == NULL) |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1157 return Qnil; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1158 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1159 /* Collect the parameters. */ |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1160 args = Qnil; |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1161 GCPRO1 (args); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1162 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1163 /* Loop over the resulting parameters. Construct a list. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1164 if (dbus_message_iter_init (dmessage, &iter)) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1165 { |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1166 while ((dtype = dbus_message_iter_get_arg_type (&iter)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1167 != DBUS_TYPE_INVALID) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1168 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1169 args = Fcons (xd_retrieve_arg (dtype, &iter), args); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1170 dbus_message_iter_next (&iter); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1171 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1172 /* The arguments are stored in reverse order. Reorder them. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1173 args = Fnreverse (args); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1174 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1175 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1176 /* Read message type, unique name, object path, interface and member |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1177 from the message. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1178 mtype = dbus_message_get_type (dmessage); |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1179 strcpy (uname, dbus_message_get_sender (dmessage)); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1180 strcpy (path, dbus_message_get_path (dmessage)); |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1181 strcpy (interface, dbus_message_get_interface (dmessage)); |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1182 strcpy (member, dbus_message_get_member (dmessage)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1183 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1184 XD_DEBUG_MESSAGE ("Event received: %d %s %s %s %s %s", |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1185 mtype, uname, path, interface, member, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1186 SDATA (format2 ("%s", args, Qnil))); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1187 |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1188 /* Search for a registered function of the message. */ |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1189 key = list3 (bus, build_string (interface), build_string (member)); |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1190 value = Fgethash (key, Vdbus_registered_functions_table, Qnil); |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1191 |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1192 /* Loop over the registered functions. Construct an event. */ |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1193 while (!NILP (value)) |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1194 { |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1195 key = CAR_SAFE (value); |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1196 /* key has the structure (UNAME SERVICE PATH HANDLER). */ |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
1197 if (((uname == NULL) |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1198 || (NILP (CAR_SAFE (key))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1199 || (strcmp (uname, SDATA (CAR_SAFE (key))) == 0)) |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
1200 && ((path == NULL) |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1201 || (NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1202 || (strcmp (path, SDATA (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1203 == 0)) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1204 && (!NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key))))))) |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1205 { |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1206 EVENT_INIT (event); |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1207 event.kind = DBUS_EVENT; |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1208 event.frame_or_window = Qnil; |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1209 event.arg = Fcons (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key)))), |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1210 args); |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1211 |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1212 /* Add uname, path, interface and member to the event. */ |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1213 event.arg = Fcons ((member == NULL ? Qnil : build_string (member)), |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1214 event.arg); |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1215 event.arg = Fcons ((interface == NULL |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1216 ? Qnil : build_string (interface)), |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1217 event.arg); |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1218 event.arg = Fcons ((path == NULL ? Qnil : build_string (path)), |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1219 event.arg); |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1220 event.arg = Fcons ((uname == NULL ? Qnil : build_string (uname)), |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1221 event.arg); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1222 |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1223 /* Add the message serial if needed, or nil. */ |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1224 event.arg = Fcons ((mtype == DBUS_MESSAGE_TYPE_METHOD_CALL |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1225 ? make_number (dbus_message_get_serial (dmessage)) |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1226 : Qnil), |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1227 event.arg); |
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1228 |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1229 /* Add the bus symbol to the event. */ |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1230 event.arg = Fcons (bus, event.arg); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1231 |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1232 /* Store it into the input event queue. */ |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1233 kbd_buffer_store_event (&event); |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1234 } |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1235 value = CDR_SAFE (value); |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1236 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1237 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1238 /* Cleanup. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1239 dbus_message_unref (dmessage); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1240 RETURN_UNGCPRO (Qnil); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1241 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1242 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1243 /* Read queued incoming messages from the system and session buses. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1244 void |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1245 xd_read_queued_messages () |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1246 { |
87092
1ddad0de60e5
* dbusbind.c (xd_read_message): Return value is a Lisp_Object.
Michael Albinus <michael.albinus@gmx.de>
parents:
87053
diff
changeset
|
1247 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1248 /* Vdbus_registered_functions_table will be initialized as hash |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1249 table in dbus.el. When this package isn't loaded yet, it doesn't |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1250 make sense to handle D-Bus messages. Furthermore, we ignore all |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1251 Lisp errors during the call. */ |
87092
1ddad0de60e5
* dbusbind.c (xd_read_message): Return value is a Lisp_Object.
Michael Albinus <michael.albinus@gmx.de>
parents:
87053
diff
changeset
|
1252 if (HASH_TABLE_P (Vdbus_registered_functions_table)) |
1ddad0de60e5
* dbusbind.c (xd_read_message): Return value is a Lisp_Object.
Michael Albinus <michael.albinus@gmx.de>
parents:
87053
diff
changeset
|
1253 { |
1ddad0de60e5
* dbusbind.c (xd_read_message): Return value is a Lisp_Object.
Michael Albinus <michael.albinus@gmx.de>
parents:
87053
diff
changeset
|
1254 internal_condition_case_1 (xd_read_message, QCdbus_system_bus, |
1ddad0de60e5
* dbusbind.c (xd_read_message): Return value is a Lisp_Object.
Michael Albinus <michael.albinus@gmx.de>
parents:
87053
diff
changeset
|
1255 Qerror, Fidentity); |
1ddad0de60e5
* dbusbind.c (xd_read_message): Return value is a Lisp_Object.
Michael Albinus <michael.albinus@gmx.de>
parents:
87053
diff
changeset
|
1256 internal_condition_case_1 (xd_read_message, QCdbus_session_bus, |
1ddad0de60e5
* dbusbind.c (xd_read_message): Return value is a Lisp_Object.
Michael Albinus <michael.albinus@gmx.de>
parents:
87053
diff
changeset
|
1257 Qerror, Fidentity); |
1ddad0de60e5
* dbusbind.c (xd_read_message): Return value is a Lisp_Object.
Michael Albinus <michael.albinus@gmx.de>
parents:
87053
diff
changeset
|
1258 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1259 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1260 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1261 DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1262 6, 6, 0, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1263 doc: /* Register for signal SIGNAL on the D-Bus BUS. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1264 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1265 BUS is either the symbol `:system' or the symbol `:session'. |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1266 |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1267 SERVICE is the D-Bus service name used by the sending D-Bus object. |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1268 It can be either a known name or the unique name of the D-Bus object |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1269 sending the signal. When SERVICE is nil, related signals from all |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1270 D-Bus objects shall be accepted. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1271 |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1272 PATH is the D-Bus object path SERVICE is registered. It can also be |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1273 nil if the path name of incoming signals shall not be checked. |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1274 |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1275 INTERFACE is an interface offered by SERVICE. It must provide SIGNAL. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1276 HANDLER is a Lisp function to be called when the signal is received. |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1277 It must accept as arguments the values SIGNAL is sending. INTERFACE, |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1278 SIGNAL and HANDLER must not be nil. Example: |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1279 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1280 \(defun my-signal-handler (device) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1281 (message "Device %s added" device)) |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1282 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1283 \(dbus-register-signal |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1284 :system "org.freedesktop.Hal" "/org/freedesktop/Hal/Manager" |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1285 "org.freedesktop.Hal.Manager" "DeviceAdded" 'my-signal-handler) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1286 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1287 => ((:system "org.freedesktop.Hal.Manager" "DeviceAdded") |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1288 ("org.freedesktop.Hal" "/org/freedesktop/Hal/Manager" my-signal-handler)) |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1289 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1290 `dbus-register-signal' returns an object, which can be used in |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1291 `dbus-unregister-object' for removing the registration. */) |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1292 (bus, service, path, interface, signal, handler) |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1293 Lisp_Object bus, service, path, interface, signal, handler; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1294 { |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1295 Lisp_Object uname, key, key1, value; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1296 DBusConnection *connection; |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1297 char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1298 DBusError derror; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1299 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1300 /* Check parameters. */ |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1301 CHECK_SYMBOL (bus); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1302 if (!NILP (service)) CHECK_STRING (service); |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1303 if (!NILP (path)) CHECK_STRING (path); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1304 CHECK_STRING (interface); |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1305 CHECK_STRING (signal); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1306 if (!FUNCTIONP (handler)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1307 wrong_type_argument (intern ("functionp"), handler); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1308 |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1309 /* Retrieve unique name of service. If service is a known name, we |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1310 will register for the corresponding unique name, if any. Signals |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1311 are sent always with the unique name as sender. Note: the unique |
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1312 name of "org.freedesktop.DBus" is that string itself. */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1313 if ((STRINGP (service)) |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1314 && (SBYTES (service) > 0) |
87280
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
1315 && (strcmp (SDATA (service), DBUS_SERVICE_DBUS) != 0) |
e0d7140e5b0e
* dbusbind.c (xd_retrieve_value, xd_retrieve_arg)
Michael Albinus <michael.albinus@gmx.de>
parents:
87175
diff
changeset
|
1316 && (strncmp (SDATA (service), ":", 1) != 0)) |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1317 { |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1318 uname = call2 (intern ("dbus-get-name-owner"), bus, service); |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1319 /* When there is no unique name, we mark it with an empty |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1320 string. */ |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1321 if (NILP (uname)) |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1322 uname = build_string (""); |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1323 } |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1324 else |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1325 uname = service; |
87156
e0ab56e63db8
* dbusbind.c (Fdbus_get_unique_name, xd_read_message)
Michael Albinus <michael.albinus@gmx.de>
parents:
87092
diff
changeset
|
1326 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1327 /* Create a matching rule if the unique name exists (when no |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1328 wildcard). */ |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1329 if (NILP (uname) || (SBYTES (uname) > 0)) |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1330 { |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1331 /* Open a connection to the bus. */ |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1332 connection = xd_initialize (bus); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1333 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1334 /* Create a rule to receive related signals. */ |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1335 sprintf (rule, |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1336 "type='signal',interface='%s',member='%s'", |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1337 SDATA (interface), |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1338 SDATA (signal)); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1339 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1340 /* Add unique name and path to the rule if they are non-nil. */ |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1341 if (!NILP (uname)) |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1342 sprintf (rule, "%s,sender='%s'", rule, SDATA (uname)); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1343 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1344 if (!NILP (path)) |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1345 sprintf (rule, "%s,path='%s'", rule, SDATA (path)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1346 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1347 /* Add the rule to the bus. */ |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1348 dbus_error_init (&derror); |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1349 dbus_bus_add_match (connection, rule, &derror); |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1350 if (dbus_error_is_set (&derror)) |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1351 XD_ERROR (derror); |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1352 |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1353 XD_DEBUG_MESSAGE ("Matching rule \"%s\" created", rule); |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1354 } |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1355 |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1356 /* Create a hash table entry. */ |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1357 key = list3 (bus, interface, signal); |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1358 key1 = list4 (uname, service, path, handler); |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1359 value = Fgethash (key, Vdbus_registered_functions_table, Qnil); |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1360 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1361 if (NILP (Fmember (key1, value))) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1362 Fputhash (key, Fcons (key1, value), Vdbus_registered_functions_table); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1363 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1364 /* Return object. */ |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1365 return list2 (key, list3 (service, path, handler)); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1366 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1367 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1368 DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1369 6, 6, 0, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1370 doc: /* Register for method METHOD on the D-Bus BUS. |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1371 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1372 BUS is either the symbol `:system' or the symbol `:session'. |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1373 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1374 SERVICE is the D-Bus service name of the D-Bus object METHOD is |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1375 registered for. It must be a known name. |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1376 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1377 PATH is the D-Bus object path SERVICE is registered. INTERFACE is the |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1378 interface offered by SERVICE. It must provide METHOD. HANDLER is a |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1379 Lisp function to be called when a method call is received. It must |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1380 accept the input arguments of METHOD. The return value of HANDLER is |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1381 used for composing the returning D-Bus message. */) |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1382 (bus, service, path, interface, method, handler) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1383 Lisp_Object bus, service, path, interface, method, handler; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1384 { |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1385 Lisp_Object key, key1, value; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1386 DBusConnection *connection; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1387 int result; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1388 DBusError derror; |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1389 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1390 /* Check parameters. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1391 CHECK_SYMBOL (bus); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1392 CHECK_STRING (service); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1393 CHECK_STRING (path); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1394 CHECK_STRING (interface); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1395 CHECK_STRING (method); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1396 if (!FUNCTIONP (handler)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1397 wrong_type_argument (intern ("functionp"), handler); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1398 /* TODO: We must check for a valid service name, otherwise there is |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1399 a segmentation fault. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1400 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1401 /* Open a connection to the bus. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1402 connection = xd_initialize (bus); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1403 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1404 /* Request the known name from the bus. We can ignore the result, |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1405 it is set to -1 if there is an error - kind of redundancy. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1406 dbus_error_init (&derror); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1407 result = dbus_bus_request_name (connection, SDATA (service), 0, &derror); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1408 if (dbus_error_is_set (&derror)) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1409 XD_ERROR (derror); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1410 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1411 /* Create a hash table entry. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1412 key = list3 (bus, interface, method); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1413 key1 = list4 (Qnil, service, path, handler); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1414 value = Fgethash (key, Vdbus_registered_functions_table, Qnil); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1415 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1416 /* We use nil for the unique name, because the method might be |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1417 called from everybody. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1418 if (NILP (Fmember (key1, value))) |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1419 Fputhash (key, Fcons (key1, value), Vdbus_registered_functions_table); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1420 |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1421 /* Return object. */ |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1422 return list2 (key, list3 (service, path, handler)); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1423 } |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1424 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1425 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1426 void |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1427 syms_of_dbusbind () |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1428 { |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1429 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1430 Qdbus_get_unique_name = intern ("dbus-get-unique-name"); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1431 staticpro (&Qdbus_get_unique_name); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1432 defsubr (&Sdbus_get_unique_name); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1433 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1434 Qdbus_call_method = intern ("dbus-call-method"); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1435 staticpro (&Qdbus_call_method); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1436 defsubr (&Sdbus_call_method); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1437 |
87887
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1438 Qdbus_method_return_internal = intern ("dbus-method-return-internal"); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1439 staticpro (&Qdbus_method_return_internal); |
c7d6ce47abe2
* dbusbind.el (Fdbus_method_return_internal): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
87584
diff
changeset
|
1440 defsubr (&Sdbus_method_return_internal); |
87584
af7df042c392
* dbusbind.c (Fdbus_method_return): New function.
Michael Albinus <michael.albinus@gmx.de>
parents:
87539
diff
changeset
|
1441 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1442 Qdbus_send_signal = intern ("dbus-send-signal"); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1443 staticpro (&Qdbus_send_signal); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1444 defsubr (&Sdbus_send_signal); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1445 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1446 Qdbus_register_signal = intern ("dbus-register-signal"); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1447 staticpro (&Qdbus_register_signal); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1448 defsubr (&Sdbus_register_signal); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1449 |
87490
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1450 Qdbus_register_method = intern ("dbus-register-method"); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1451 staticpro (&Qdbus_register_method); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1452 defsubr (&Sdbus_register_method); |
5db1ff3b9244
* dbusbind.c: Fix several errors and compiler warnings. Reported
Michael Albinus <michael.albinus@gmx.de>
parents:
87364
diff
changeset
|
1453 |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1454 Qdbus_error = intern ("dbus-error"); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1455 staticpro (&Qdbus_error); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1456 Fput (Qdbus_error, Qerror_conditions, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1457 list2 (Qdbus_error, Qerror)); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1458 Fput (Qdbus_error, Qerror_message, |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1459 build_string ("D-Bus error")); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1460 |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1461 QCdbus_system_bus = intern (":system"); |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1462 staticpro (&QCdbus_system_bus); |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1463 |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1464 QCdbus_session_bus = intern (":session"); |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1465 staticpro (&QCdbus_session_bus); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1466 |
87343
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1467 QCdbus_type_byte = intern (":byte"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1468 staticpro (&QCdbus_type_byte); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1469 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1470 QCdbus_type_boolean = intern (":boolean"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1471 staticpro (&QCdbus_type_boolean); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1472 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1473 QCdbus_type_int16 = intern (":int16"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1474 staticpro (&QCdbus_type_int16); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1475 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1476 QCdbus_type_uint16 = intern (":uint16"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1477 staticpro (&QCdbus_type_uint16); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1478 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1479 QCdbus_type_int32 = intern (":int32"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1480 staticpro (&QCdbus_type_int32); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1481 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1482 QCdbus_type_uint32 = intern (":uint32"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1483 staticpro (&QCdbus_type_uint32); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1484 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1485 QCdbus_type_int64 = intern (":int64"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1486 staticpro (&QCdbus_type_int64); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1487 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1488 QCdbus_type_uint64 = intern (":uint64"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1489 staticpro (&QCdbus_type_uint64); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1490 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1491 QCdbus_type_double = intern (":double"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1492 staticpro (&QCdbus_type_double); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1493 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1494 QCdbus_type_string = intern (":string"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1495 staticpro (&QCdbus_type_string); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1496 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1497 QCdbus_type_object_path = intern (":object-path"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1498 staticpro (&QCdbus_type_object_path); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1499 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1500 QCdbus_type_signature = intern (":signature"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1501 staticpro (&QCdbus_type_signature); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1502 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1503 QCdbus_type_array = intern (":array"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1504 staticpro (&QCdbus_type_array); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1505 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1506 QCdbus_type_variant = intern (":variant"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1507 staticpro (&QCdbus_type_variant); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1508 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1509 QCdbus_type_struct = intern (":struct"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1510 staticpro (&QCdbus_type_struct); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1511 |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1512 QCdbus_type_dict_entry = intern (":dict-entry"); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1513 staticpro (&QCdbus_type_dict_entry); |
02e327d7d839
* dbusbind.c (QCdbus_type_byte, QCdbus_type_boolean)
Michael Albinus <michael.albinus@gmx.de>
parents:
87307
diff
changeset
|
1514 |
87539
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1515 DEFVAR_LISP ("dbus-registered-functions-table", |
6a710fa21688
* dbusbind.c (all): Replace XCAR by CAR_SAFE and XCDR by CDR_SAFE.
Michael Albinus <michael.albinus@gmx.de>
parents:
87535
diff
changeset
|
1516 &Vdbus_registered_functions_table, |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1517 doc: /* Hash table of registered functions for D-Bus. |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1518 The key in the hash table is the list (BUS INTERFACE MEMBER). BUS is |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1519 either the symbol `:system' or the symbol `:session'. INTERFACE is a |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1520 string which denotes a D-Bus interface, and MEMBER, also a string, is |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1521 either a method or a signal INTERFACE is offering. All arguments but |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1522 BUS must not be nil. |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1523 |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1524 The value in the hash table is a list of quadruple lists |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1525 \((UNAME SERVICE PATH HANDLER) (UNAME SERVICE PATH HANDLER) ...). |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1526 SERVICE is the service name as registered, UNAME is the corresponding |
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1527 unique name. PATH is the object path of the sending object. All of |
87307
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1528 them can be nil, which means a wildcard then. HANDLER is the function |
710ac69daf1f
* dbusbind.c (top): Include <stdio.h>.
Michael Albinus <michael.albinus@gmx.de>
parents:
87280
diff
changeset
|
1529 to be called when a D-Bus message, which matches the key criteria, |
87175
30175fd3b679
* dbusbind.c (xd_read_message): Generate an event for every
Michael Albinus <michael.albinus@gmx.de>
parents:
87156
diff
changeset
|
1530 arrives. */); |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1531 /* We initialize Vdbus_registered_functions_table in dbus.el, |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1532 because we need to define a hash table function first. */ |
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1533 Vdbus_registered_functions_table = Qnil; |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1534 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1535 DEFVAR_LISP ("dbus-debug", &Vdbus_debug, |
87051
1da959e791de
* dbusbind.c (QCdbus_system_bus, QCdbus_session_bus): Renamed from
Michael Albinus <michael.albinus@gmx.de>
parents:
86940
diff
changeset
|
1536 doc: /* If non-nil, debug messages of D-Bus bindings are raised. */); |
86940
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1537 #ifdef DBUS_DEBUG |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1538 Vdbus_debug = Qt; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1539 #else |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1540 Vdbus_debug = Qnil; |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1541 #endif |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1542 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1543 Fprovide (intern ("dbusbind"), Qnil); |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1544 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1545 } |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1546 |
2dd672d9fe75
* config.in (HAVE_DBUS): Add.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1547 #endif /* HAVE_DBUS */ |
87053 | 1548 |
1549 /* arch-tag: 0e828477-b571-4fe4-b559-5c9211bc14b8 | |
1550 (do not change this comment) */ |