Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef TQDBUSCONNECTION_H
00026 #define TQDBUSCONNECTION_H
00027
00122 #include "tqdbusmacros.h"
00123 #include <tqstring.h>
00124
00125 class TQT_DBusConnectionPrivate;
00126 class TQT_DBusError;
00127 class TQT_DBusMessage;
00128 class TQT_DBusObjectBase;
00129 class TQObject;
00130
00171 class TQDBUS_EXPORT TQT_DBusConnection
00172 {
00173 public:
00177 enum BusType
00178 {
00184 SessionBus,
00185
00196 SystemBus,
00197
00198
00199 ActivationBus
00200 };
00201
00211 TQT_DBusConnection();
00212
00224 TQT_DBusConnection(const TQString &name);
00225
00234 TQT_DBusConnection(const TQT_DBusConnection &other);
00235
00243 ~TQT_DBusConnection();
00244
00256 TQT_DBusConnection &operator=(const TQT_DBusConnection &other);
00257
00265 bool isConnected() const;
00266
00275 TQT_DBusError lastError() const;
00276
00282 enum NameRequestMode
00283 {
00288 NoReplace = 0,
00289
00295 AllowReplace = 1,
00296
00302 ReplaceExisting = 2
00303 };
00304
00336 bool requestName(const TQString &name, int modeFlags = NoReplace);
00337
00348 TQString uniqueName() const;
00349
00370 bool send(const TQT_DBusMessage &message) const;
00371
00392 TQT_DBusMessage sendWithReply(const TQT_DBusMessage &message, TQT_DBusError *error = 0) const;
00393
00420 int sendWithAsyncReply(const TQT_DBusMessage &message, TQObject *receiver,
00421 const char *slot) const;
00422
00428 void flush() const;
00429
00441 void dispatch() const;
00442
00454 void scheduleDispatch() const;
00455
00499 bool connect(TQObject* object, const char* slot);
00500
00511 bool disconnect(TQObject* object, const char* slot);
00512
00538 bool registerObject(const TQString& path, TQT_DBusObjectBase* object);
00539
00553 void unregisterObject(const TQString &path);
00554
00568 static TQT_DBusConnection sessionBus();
00569
00583 static TQT_DBusConnection systemBus();
00584
00618 static TQT_DBusConnection addConnection(BusType type,
00619 const TQString &name = default_connection_name);
00620
00639 static TQT_DBusConnection addConnection(const TQString &address,
00640 const TQString &name = default_connection_name);
00641
00642
00652 static void closeConnection(const TQString &name = default_connection_name);
00653
00657 QT_STATIC_CONST char *default_connection_name;
00658
00659 private:
00660 TQT_DBusConnectionPrivate *d;
00661 };
00662
00663 #endif