DBus-1-TQt  1.0
tqdbusconnection_p.h
Go to the documentation of this file.
1 /* qdbusconnection_p.h TQT_DBusConnection private object
2  *
3  * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
4  * Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at>
5  *
6  * Licensed under the Academic Free License version 2.1
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21  * USA.
22  *
23  */
24 
25 //
26 // W A R N I N G
27 // -------------
28 //
29 // This file is not part of the public API. This header file may
30 // change from version to version without notice, or even be
31 // removed.
32 //
33 // We mean it.
34 //
35 //
36 
37 #ifndef TQDBUSCONNECTION_P_H
38 #define TQDBUSCONNECTION_P_H
39 
40 #include <tqguardedptr.h>
41 #include <tqmap.h>
42 #include <tqobject.h>
43 #include <tqvaluelist.h>
44 
45 #include <dbus/dbus.h>
46 
47 #include "tqdbusatomic.h"
48 #include "tqdbuserror.h"
49 #include "tqdbusobject.h"
50 #include "tqdbusmessage.h"
51 
52 class TQT_DBusMessage;
53 class TQSocketNotifier;
54 class TQTimer;
55 class TQTimerEvent;
56 
57 struct DBusConnection;
58 struct DBusServer;
59 
61 {
62  public:
64  TQObject* receiver;
65  TQCString method;
66 };
68 
69 class TQT_DBusConnectionPrivate: public TQObject
70 {
71  TQ_OBJECT
72 
73 
74 public:
75  TQT_DBusConnectionPrivate(TQObject *parent = 0);
77 
78  void bindToApplication();
79 
80  void setConnection(DBusConnection *connection);
81  void setServer(DBusServer *server);
82  void closeConnection();
83  void timerEvent(TQTimerEvent *e);
84 
85  bool handleSignal(DBusMessage *msg);
86  bool handleObjectCall(DBusMessage *message);
87  bool handleError();
88  bool handleUnreadMessages();
89 
90  void emitPendingCallReply(const TQT_DBusMessage& message);
91 
92 signals:
93  void dbusSignal(const TQT_DBusMessage& message);
94 
95  void dbusPendingCallReply(const TQT_DBusMessage& message);
96 
97 public slots:
98  void socketRead(int);
99  void socketWrite(int);
100 
101  void objectDestroyed(TQObject* object);
102 
103  void purgeRemovedWatches();
104 
105  void scheduleDispatch();
106  void dispatch();
107 
108 public:
109  DBusError error;
111 
113 
114  // FIXME TQAtomic ref;
117  DBusConnection *connection;
118  DBusServer *server;
119 
120  TQTimer* dispatcher;
121 
122  static int messageMetaType;
123  static int registerMessageMetaType();
124  int sendWithReplyAsync(const TQT_DBusMessage &message, TQObject *receiver,
125  const char *method);
126  void flush();
127 
128  struct Watcher
129  {
130  Watcher(): watch(0), read(0), write(0) {}
131  DBusWatch *watch;
132  TQSocketNotifier *read;
133  TQSocketNotifier *write;
134  };
135  // FIXME typedef TQMultiHash<int, Watcher> WatcherHash;
138  typedef TQMap<int, WatcherList> WatcherHash;
140 
141  // FIXME typedef TQHash<int, DBusTimeout *> TimeoutHash;
142  typedef TQMap<int, DBusTimeout*> TimeoutHash;
144 
145  typedef TQMap<TQString, TQT_DBusObjectBase*> ObjectMap;
147 
149 
151  {
152  TQGuardedPtr<TQObject> receiver;
153  TQCString method;
154  DBusPendingCall *pending;
155  };
156  typedef TQMap<DBusPendingCall*, TQT_DBusPendingCall*> PendingCallMap;
158 
161 
163 
165 
166 public:
168 
169 private slots:
172 
173 private:
176 };
177 
178 #endif
TQT_DBusResultInfoList m_resultEmissionQueue
TQValueList< DBusTimeout * > pendingTimeouts
TQT_DBusConnectionPrivate(TQObject *parent=0)
void setConnection(DBusConnection *connection)
TQValueList< Watcher > WatcherList
PendingMessagesForEmit pendingMessages
TQMap< int, WatcherList > WatcherHash
TQMap< TQString, TQT_DBusObjectBase * > ObjectMap
void objectDestroyed(TQObject *object)
TQMap< DBusPendingCall *, TQT_DBusPendingCall * > PendingCallMap
TQValueList< TQT_DBusMessage > PendingMessagesForEmit
void timerEvent(TQTimerEvent *e)
void emitPendingCallReply(const TQT_DBusMessage &message)
void dbusSignal(const TQT_DBusMessage &message)
bool handleObjectCall(DBusMessage *message)
TQMap< int, DBusTimeout * > TimeoutHash
void setServer(DBusServer *server)
int sendWithReplyAsync(const TQT_DBusMessage &message, TQObject *receiver, const char *method)
void dbusPendingCallReply(const TQT_DBusMessage &message)
bool handleSignal(DBusMessage *msg)
Class for transporting D-Bus errors.
Definition: tqdbuserror.h:41
A message converts and transports data over D-Bus.
TQT_DBusMessage message
TQValueList< TQT_DBusResultInfo > TQT_DBusResultInfoList