|
DBus-1-TQt
1.0
|
00001 /* qdbusconnection.h TQT_DBusConnection object 00002 * 00003 * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> 00004 * Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at> 00005 * 00006 * Licensed under the Academic Free License version 2.1 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00021 * USA. 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 // TODO find out about ActivationBus purpose 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 // TODO check why this doesn't close the D-Bus connection 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