DBus-1-TQt  1.0
tqdbusconnection.h
Go to the documentation of this file.
1 /* qdbusconnection.h TQT_DBusConnection object
2  *
3  * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
4  * Copyright (C) 2005-2007 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 #ifndef TQDBUSCONNECTION_H
26 #define TQDBUSCONNECTION_H
27 
122 #include "tqdbusmacros.h"
123 #include <tqstring.h>
124 
126 class TQT_DBusError;
127 class TQT_DBusMessage;
128 class TQT_DBusObjectBase;
129 class TQObject;
130 
172 {
173 public:
177  enum BusType
178  {
185 
197 
198  // TODO find out about ActivationBus purpose
199  ActivationBus
200  };
201 
212 
224  TQT_DBusConnection(const TQString &name);
225 
235 
244 
256  TQT_DBusConnection &operator=(const TQT_DBusConnection &other);
257 
265  bool isConnected() const;
266 
275  TQT_DBusError lastError() const;
276 
283  {
288  NoReplace = 0,
289 
295  AllowReplace = 1,
296 
302  ReplaceExisting = 2
303  };
304 
336  bool requestName(const TQString &name, int modeFlags = NoReplace);
337 
348  TQString uniqueName() const;
349 
370  bool send(const TQT_DBusMessage &message) const;
371 
392  TQT_DBusMessage sendWithReply(const TQT_DBusMessage &message, TQT_DBusError *error = 0) const;
393 
420  int sendWithAsyncReply(const TQT_DBusMessage &message, TQObject *receiver,
421  const char *slot) const;
422 
428  void flush() const;
429 
441  void dispatch() const;
442 
454  void scheduleDispatch() const;
455 
499  bool connect(TQObject* object, const char* slot);
500 
511  bool disconnect(TQObject* object, const char* slot);
512 
538  bool registerObject(const TQString& path, TQT_DBusObjectBase* object);
539 
553  void unregisterObject(const TQString &path);
554 
568  static TQT_DBusConnection sessionBus();
569 
583  static TQT_DBusConnection systemBus();
584 
618  static TQT_DBusConnection addConnection(BusType type,
619  const TQString &name = default_connection_name);
620 
639  static TQT_DBusConnection addConnection(const TQString &address,
640  const TQString &name = default_connection_name);
641 
642  // TODO check why this doesn't close the D-Bus connection
652  static void closeConnection(const TQString &name = default_connection_name);
653 
657  static const char *default_connection_name;
658 
659 private:
661 };
662 
663 #endif
TQT_DBusConnection::default_connection_name
static const char * default_connection_name
Definition: tqdbusconnection.h:657
TQT_DBusError
Class for transporting D-Bus errors.
Definition: tqdbuserror.h:40
TQT_DBusConnection
Provides access to a specific D-Bus bus.
Definition: tqdbusconnection.h:171
TQT_DBusConnection::SessionBus
@ SessionBus
Definition: tqdbusconnection.h:184
TQT_DBusConnection::NameRequestMode
NameRequestMode
Flags for controlling the behavior name collision handling.
Definition: tqdbusconnection.h:282
TQT_DBusConnectionPrivate
Definition: tqdbusconnection_p.h:69
TQT_DBusConnection::BusType
BusType
Definition: tqdbusconnection.h:177
TQT_DBusObjectBase
Base interface for D-Bus service objects.
Definition: tqdbusobject.h:302
tqdbusmacros.h
TQT_DBusConnection::d
TQT_DBusConnectionPrivate * d
Definition: tqdbusconnection.h:660
TQT_DBusConnection::SystemBus
@ SystemBus
Definition: tqdbusconnection.h:196
TQT_DBusMessage
A message converts and transports data over D-Bus.
Definition: tqdbusmessage.h:115
TQDBUS_EXPORT
#define TQDBUS_EXPORT
Definition: tqdbusmacros.h:29