edelib: edelib/EdbusConnection.h Source File

edelib 0.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List

EdbusConnection.h
1 /*
2 * $Id: EdbusConnection.h 2911 2009-10-13 10:37:34Z karijes $
3 *
4 * D-BUS stuff
5 * Copyright (c) 2008 edelib authors
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef __EDELIB_EDBUSCONNECTION_H__
22 #define __EDELIB_EDBUSCONNECTION_H__
23
24 #include "EdbusMessage.h"
25 #include "EdbusError.h"
26
27 EDELIB_NS_BEGIN
28
38 enum EdbusConnectionType {
39 EDBUS_SYSTEM,
40 EDBUS_SESSION
41 };
42
48 enum EdbusNameMode {
49 EDBUS_NAME_NO_REPLACE = 0,
50 EDBUS_NAME_ALLOW_REPLACE = 1,
51 EDBUS_NAME_REPLACE_EXISTING = 2
52 };
53
58 typedef int (*EdbusCallback)(const EdbusMessage*, void*);
59
60 #ifndef SKIP_DOCS
61 struct EdbusConnImpl;
62 #endif
63
144 class EDELIB_API EdbusConnection {
145 private:
146 EdbusConnImpl* dc;
147 void setup_filter(void);
148
149 E_DISABLE_CLASS_COPY(EdbusConnection)
150 public:
155 EdbusConnection();
156
160 ~EdbusConnection();
161
168 bool connect(EdbusConnectionType ctype);
169
173 void disconnect(void);
174
183 bool send(const EdbusMessage& content);
184
194 bool send_with_reply_and_block(const EdbusMessage& content, int timeout_ms, EdbusMessage& ret);
195
221 bool request_name(const char* name, int mode = EDBUS_NAME_NO_REPLACE);
222
226 const char* unique_name(void);
227
235 void signal_callback(EdbusCallback cb, void* data);
236
244 void method_callback(EdbusCallback cb, void* data);
245
252 void add_signal_match(const char* path, const char* interface, const char* name);
253
263 void add_method_match(const char* path, const char* interface, const char* name);
264
277 void register_object(const char* path);
278
283 void unregister_object(const char* path);
284
291 void setup_listener(void);
292
297 void setup_listener_with_fltk(void);
298
314 int wait(int timeout_ms);
315
320 EdbusError* error(void);
321 };
322
323 EDELIB_NS_END
324 #endif